fig | R Documentation |
repr.plot.*
behaviourChange the behaviour of repr.plot.*
.
fig(
width = 10,
height = 7,
pointsize = 12,
bg = "white",
antialias = "gray",
res = 120,
quality = 90,
family = "sans"
)
reset.fig(
width = 10,
height = 7,
pointsize = 12,
bg = "white",
antialias = "gray",
res = 120,
quality = 90,
family = "sans"
)
width |
Plotting area width in inches. Default is 10. |
height |
Plotting area height in inches. Default is 7. |
pointsize |
Text height in pt. Default is 12. |
bg |
Background colour. Default is "white". |
antialias |
Which kind of antialiasing to use for for lines and text? 'gray', 'subpixel' or 'none'? Default is "gray". |
res |
PPI for rasterization. Defaults to 120. |
quality |
Quality of JPEG format in %. Default is 90. |
family |
Font family. "sans", "serif", "mono" or a specific one. Default is "sans". |
The function uses options()
to change the behaviour of repr.plot.*
.
It provides a quick and easy way to change plot size and other
repr.plot.*
behaviours when running R in a Jupyter Notebook. If use
without indicating any argument, the plot behaviour will be reset to
default. The reset.fig()
is an alias of fig()
.
I-Hsuan Lin
## Not run:
library(ggplot2)
# Change plot area width to 8 inches and height to 5 inches
fig(width = 8, height = 5)
ggplot(mpg, aes(class)) +
geom_bar()
# Reset to default settings
fig()
# Change plot wider and taller
fig(width = 14, height = 10)
ggplot(mpg, aes(class)) +
geom_bar()
# Alias of fig()
reset.fig()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.