🍑 Pomological plot theme for ggplot2
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

114 lines
4.1KB

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