3. dataCrunchFont
Slide 3
The font argument can be used along with main, sub, axis and lab arguments to specify the font of
the title, subtitle, axes and the labels.
Feature Argument
Title font.main
Subtitle font.sub
Axis font.axis
Labels font.lab
The font argument takes values from 1 - 5. The font type represented by each value is shown in the
above table.
Value Font Type
1 Plain
2 Bold
3 Italic
4 Bold Italic
5 Symbol
4. dataCrunchFont: Title
Slide 4
# modify the font of the title
plot(mtcars$disp, mtcars$mpg,
main = "Displacement vs Miles Per Gallon",
font.main = 1)
Description
The font of the title can be modified using the font.
main argument in the plot() function.
Code
6. dataCrunchFont: Subtitle
Slide 6
# modify the font of the subtitle
plot(mtcars$disp, mtcars$mpg,
sub= "Displacement vs Miles Per Gallon",
font.sub = 3)
Description
The font of the subtitle can be modified using the
font.sub argument in the plot() function.
Code
8. dataCrunchFont: Axis
Slide 8
# modify the font of the axis
plot(mtcars$disp, mtcars$mpg,
font.axis = 3)
Description
The font of the axis can be modified using the
font.axis argument in the plot() function.
Code
10. dataCrunchFont: Labels
Slide 10
# modify the font of the labels
plot(mtcars$disp, mtcars$mpg,
xlab = "Displacement",
ylab = "Miles Per Gallon",
font.lab = 3)
Description
The font of the labels can be modified using the
font.lab argument in the plot() function.
Code
13. dataCrunchFont Size
Slide 13
The cex argument can be used along with main, sub, axis and lab arguments to specify the font size
of the title, subtitle, axes and the labels.
Feature Argument
Title cex.main
Subtitle cex.sub
Axis cex.axis
Labels cex.lab
The values taken by the cex argument are relative to 1 i.e the default size is represented by 1 and if
the supplied value is less than 1, the size of the font will be relatively smaller, and if the supplied value
is greater than 1, the size of the font will be relatively bigger.
14. dataCrunchFont Size: Title
Slide 14
# modify the font size of the title
plot(mtcars$disp, mtcars$mpg,
main = "Scatter Plot",
cex.main = 1.5)
Description
The font size of the title can be modified using the
cex.main argument in the plot() function.
Code
15. dataCrunchFont Size: Title
Slide 15
The below plot depicts the appearance of the title when different options for font size are applied:
16. dataCrunchFont Size: Subtitle
Slide 16
# modify the font size of the subtitle
plot(mtcars$disp, mtcars$mpg,
sub= "Scatter Plot",
cex.sub = 1.5)
Description
The font size of the subtitle can be modified using
the cex.sub argument in the plot() function.
Code
18. dataCrunchFont Size: Axis
Slide 18
# modify the font size of the axis
plot(mtcars$disp, mtcars$mpg,
cex.axis = 1.5)
Description
The font size of the axis can be modified using the
cex.axis argument in the plot() function.
Code
19. dataCrunchFont Size: Axis
Slide 19
The below plot depicts the appearance of the axis when different options for font size are applied:
20. dataCrunchFont Size: Labels
Slide 20
# modify the font size of the labels
plot(mtcars$disp, mtcars$mpg,
xlab = "Displacement",
ylab = "Miles Per Gallon",
cex.lab = 1.5)
Description
The font size of the labels can be modified using the
cex.lab argument in the plot() function.
Code
21. dataCrunchFont Size: Labels
Slide 21
The below plot depicts the appearance of the subtitle when different options for font size are applied:
22. dataCrunch
Slide 22
Visit dataCrunch for
tutorials on:
→ R Programming
→ Business Analytics
→ Data Visualization
→ Web Applications
→ Package Development
→ Git & GitHub