🍑 Pomological plot theme for ggplot2
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

110 lines
3.8KB

  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/theme_pomological.R
  3. \name{theme_pomological}
  4. \alias{theme_pomological}
  5. \alias{theme_pomological_nobg}
  6. \alias{theme_pomological_plain}
  7. \title{Pomological Theme}
  8. \usage{
  9. theme_pomological(base_family = "Homemade Apple", base_size = 18,
  10. text.color = pomological_base$dark_blue,
  11. plot.background.color = pomological_base$paper,
  12. panel.border.color = pomological_base$light_line, with.panel.grid = FALSE,
  13. panel.grid.color = pomological_base$light_line,
  14. panel.grid.linetype = "dashed",
  15. axis.text.color = pomological_base$medium_line, axis.text.size = base_size
  16. * 3/4, base_theme = ggplot2::theme_minimal())
  17. theme_pomological_nobg(...)
  18. theme_pomological_plain(...)
  19. }
  20. \arguments{
  21. \item{base_family}{Base text family. See \strong{Fonts} in \code{\link[=theme_pomological]{theme_pomological()}}
  22. for some examples from Google Fonts options, including \code{"Mr De Haviland"},
  23. \code{"Homemade Apple"}, \code{"Marck Script"}, and \code{"Mr. Bedfort"}. For the
  24. authentic pomological look, use \code{"Homemade Apple"} or \code{"Mr De Haviland"}.
  25. Set to \code{NULL} or use \code{\link[=theme_pomological_plain]{theme_pomological_plain()}} for no change to fonts.}
  26. \item{base_size}{Base text size}
  27. \item{text.color}{Color of all text (except axis text, see \code{axis.text.color})}
  28. \item{plot.background.color}{Color of plot background, passed to \code{plot.background}}
  29. \item{panel.border.color}{Color of plot panel border}
  30. \item{with.panel.grid}{If \code{FALSE} gridlines in plot are removed}
  31. \item{panel.grid.color, panel.grid.linetype}{Color and linetype of panel grid, passed to \code{panel.grid}}
  32. \item{axis.text.color, axis.text.size}{Color and size of axis text}
  33. \item{base_theme}{Starting theme of plot, default is
  34. \code{\link[ggplot2:theme_minimal]{ggplot2::theme_minimal()}}. Any elements set by \code{theme_pomological()} will
  35. overwrite the \code{base_theme} unless the specific parameter is explicitly set
  36. to \code{NULL}.}
  37. }
  38. \description{
  39. \link{ggplot2} plot theme based on the USDA Pomological Watercolors paintings.
  40. }
  41. \section{Functions}{
  42. \itemize{
  43. \item \code{theme_pomological_nobg}: Pomological theme with white (transparent) background
  44. \item \code{theme_pomological_plain}: A "plain" pomological theme with white
  45. background and normal fonts.
  46. }}
  47. \section{Fonts}{
  48. Complete the pomological watercolor theme with a handwriting or cursive font.
  49. The following fonts from \href{https://fonts.google.com}{Google Fonts} work well.
  50. Visit the links below to install on your system.
  51. \itemize{
  52. \item \href{https://fonts.google.com/specimen/Homemade+Apple/}{Homemade Apple}
  53. \item \href{https://fonts.google.com/specimen/Mr+De+Haviland}{Mr. De Haviland}
  54. \item \href{https://fonts.google.com/specimen/Marck+Script/}{Marck Script}
  55. \item \href{https://fonts.google.com/specimen/Mr+Bedfort/}{Mr. Bedfort}
  56. }
  57. Fonts with R are notoriously tricky, so these may not work well for you. If
  58. you have installed the fonts but they aren't showing up or working, you can
  59. always try running \code{extrafont::font_import()} or \code{extrafont::load_fonts()} in
  60. the session or RMarkdown document. Or you can use \code{\link[=theme_pomological_plain]{theme_pomological_plain()}}.
  61. }
  62. \examples{
  63. library(ggplot2)
  64. basic_iris_plot <- ggplot(iris) +
  65. aes(x = Sepal.Length, y = Sepal.Width, color = Species) +
  66. geom_point(size = 2) +
  67. # with pomological color scale
  68. scale_color_pomological()
  69. # Pomological Theme
  70. basic_iris_plot +
  71. theme_pomological()
  72. # Don't change panel grid color
  73. basic_iris_plot +
  74. theme_pomological(
  75. panel.grid.color = NULL
  76. )
  77. # White background
  78. basic_iris_plot +
  79. theme_pomological_nobg()
  80. # Plain plot without font or background
  81. basic_iris_plot +
  82. theme_pomological_plain()
  83. }
  84. \references{
  85. https://usdawatercolors.nal.usda.gov/pom
  86. }
  87. \seealso{
  88. \link[ggplot2:theme]{ggplot2::theme}
  89. }