Non data elements of the plot is controlled by theme system.
theme give you control over things like fonts in all parts of the plot: title, axis labels, axis tick labels, strips ,
legends labels, legend key labels, color of ticks, grid lines, backgrounds(panel, plot, strip, legend)
1. built-in theme:
theme_gray()
theme_bw()
globally, affecting all plots when they are drawn: theme_set(theme_grey()) or theme_set(theme_bw())(note: this will return previous theme)
locally, qplot(...)+theme_grey()
2. theme elements:
a theme made up of multiple elements which control appearance of a single item on the plot.
four basic built-in element functions: text, lines, rect, and blank
element_text: draw labels and headings: control font family, face, color, size, hjust, vjust, angle, lineheight
element_line()
8.2 Customising scales:
set_default_scale(the name of the aesthetic, the type of variable(discrete or continuous) and the name of the scale to use as default
e.g. set_default_scale("color","discrete","grey")
set_default_scale("fill","discrete","grey")
set_default_scale("color",“continuous","gradient",low="white",high="black")
geoms and stats
e.g. update_geom_defaults("point",aes(color="darkblue"))
update_stat_defaults("bin",aes(y=..density..))
save plots:
1. ggsave(path,width=..,height=..,dpi=...)
8.4 multiple plots on the same page
use grid
viewport:a rectangular subregion of the display. The default viewport takes up the entire plotting region, and by
customising the viewport you can arrange a set of plots in just about any way
you can imagine