Last active
September 26, 2017 09:05
-
-
Save aravindhebbali/7a445b32ca3a6e1f75e7d4bbf66cb702 to your computer and use it in GitHub Desktop.
Data Visualization: Text Annotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# text inside plot | |
plot(mtcars$disp, mtcars$mpg) | |
text(x = 340, y = 30, labels = 'Sample Text') | |
# color | |
plot(mtcars$disp, mtcars$mpg) | |
text(x = 340, y = 30, labels = 'Sample Text', col = 'red') | |
# font | |
plot(mtcars$disp, mtcars$mpg) | |
text(x = 340, y = 30, labels = 'Sample Text', col = 'red', font = 2) | |
# font family | |
plot(mtcars$disp, mtcars$mpg) | |
text(x = 340, y = 30, labels = 'Sample Text', col = 'red', family = 'mono') | |
# font size | |
plot(mtcars$disp, mtcars$mpg) | |
text(x = 340, y = 30, labels = 'Sample Text', col = 'red', cex = 2) | |
# text on the margins | |
plot(mtcars$disp, mtcars$mpg) | |
mtext('Sample Text') | |
# specify margin | |
plot(mtcars$disp, mtcars$mpg) | |
mtext('Sample Text', side = 1) | |
# line | |
plot(mtcars$disp, mtcars$mpg) | |
mtext('Sample Text', line = 1) | |
# alignment | |
plot(mtcars$disp, mtcars$mpg) | |
mtext('Sample Text', adj = 0) | |
plot(mtcars$disp, mtcars$mpg) | |
mtext('Sample Text', adj = 1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment