A collection of ggplot2 themes that use palettes which mirror the colour schemes available in GraphPad Prism.
theme_prism(
palette = "black_and_white",
base_size = 14,
base_family = "sans",
base_fontface = "bold",
base_line_size = base_size/14,
base_rect_size = base_size/14,
axis_text_angle = 0,
border = FALSE
)
string
. Palette name, use
names(ggprism_data$themes)
to show all valid palette names.
numeric
. Base font size, given in "pt"
.
string
. Base font family, default is "sans"
.
string
. Base font face, default is "bold"
.
numeric
. Base linewidth for line elements
numeric
. Base linewidth for rect elements
integer
. Angle of axis text in degrees.
One of: 0, 45, 90, 270
.
logical
. Should a border be drawn around the plot?
Clipping will occur unless e.g. coord_cartesian(clip = "off")
is used.
Returns a list-like object of class theme.
library(ggplot2)
# see ?preview_theme for a convenient function to preview ggprism themes
# before using theme_prism
## base plot
base <- ggplot(mpg, aes(x = displ, y = cty, colour = class)) +
geom_point()
## default palette is "black_and_white"
## default base_size is 14 (compared with 11 for theme_grey)
base +
theme_prism()
## try some other palettes
base +
theme_prism(palette = "office")
base +
theme_prism(palette = "flames")
## try matching the theme_prism palette with same colour palette
base +
theme_prism(palette = "stained_glass") +
scale_color_prism(palette = "stained_glass")
base +
theme_prism(palette = "candy_bright") +
scale_color_prism(palette = "candy_bright")
## change the font face
base +
theme_prism(base_fontface = "plain")
## change the font family
base +
theme_prism(base_family = "serif")
## base_line_size scales automatically as you change base_size
base +
theme_prism(base_size = 10)
## but you can also change it manually
base +
theme_prism(base_size = 16, base_line_size = 0.8)
## easily change x axis text angle
base +
theme_prism(axis_text_angle = 45)
## add a border (need to turn off clipping)
base +
theme_prism(border = TRUE) +
coord_cartesian(clip = "off")
## change border thickness
base +
theme_prism(border = TRUE, base_rect_size = 2) +
coord_cartesian(clip = "off")