😎 Give your xaringan slides some style
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

330 lines
16KB

  1. <!-- Generated by pkgdown: do not edit by hand -->
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>The ggplot2 xaringanthemer base plot theme — theme_xaringan_base • xaringanthemer</title>
  9. <!-- jquery -->
  10. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  11. <!-- Bootstrap -->
  12. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
  13. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
  14. <!-- Font Awesome icons -->
  15. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
  16. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
  17. <!-- clipboard.js -->
  18. <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
  19. <!-- headroom.js -->
  20. <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
  21. <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
  22. <!-- pkgdown -->
  23. <link href="../pkgdown.css" rel="stylesheet">
  24. <script src="../pkgdown.js"></script>
  25. <link href="../extra.css" rel="stylesheet">
  26. <meta property="og:title" content="The ggplot2 xaringanthemer base plot theme — theme_xaringan_base" />
  27. <meta property="og:description" content="Lifecycle: Experimental.
  28. Provides a base plot theme for ggplot2 to match the xaringan slide theme
  29. created by xaringanthemer. The theme is designed to create a general plot
  30. style from two colors, a background_color and a text_color (or foreground
  31. color). Also accepts an accent_color and an accent_secondary_color that are
  32. xaringanthemer is not required for the base theme. Use
  33. theme_xaringan() or theme_xaringan_inverse() in xaringan slides styled by
  34. xaringanthemer for a plot theme that matches the slide style." />
  35. <meta name="twitter:card" content="summary" />
  36. <meta name="robots" content="noindex">
  37. <!-- mathjax -->
  38. <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
  39. <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
  40. <!--[if lt IE 9]>
  41. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  42. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  43. <![endif]-->
  44. </head>
  45. <body>
  46. <div class="container template-reference-topic">
  47. <header>
  48. <div class="navbar navbar-default navbar-fixed-top" role="navigation">
  49. <div class="container">
  50. <div class="navbar-header">
  51. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
  52. <span class="sr-only">Toggle navigation</span>
  53. <span class="icon-bar"></span>
  54. <span class="icon-bar"></span>
  55. <span class="icon-bar"></span>
  56. </button>
  57. <span class="navbar-brand">
  58. <a class="navbar-link" href="../index.html">xaringanthemer</a>
  59. <span class="version label label-danger" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.2.0.9100</span>
  60. </span>
  61. </div>
  62. <div id="navbar" class="navbar-collapse collapse">
  63. <ul class="nav navbar-nav">
  64. <li>
  65. <a href="../articles/xaringanthemer.html">Get started</a>
  66. </li>
  67. <li>
  68. <a href="../reference/index.html">Reference</a>
  69. </li>
  70. <li>
  71. <a href="../articles/themes.html">Themes</a>
  72. </li>
  73. <li>
  74. <a href="../articles/fonts.html">Fonts</a>
  75. </li>
  76. <li>
  77. <a href="../articles/template-variables.html">Template Variables</a>
  78. </li>
  79. <li>
  80. <a href="../articles/css-help.html">CSS Help</a>
  81. </li>
  82. </ul>
  83. <ul class="nav navbar-nav navbar-right">
  84. <li>
  85. <a href="../news/index.html">
  86. <span class="fa fa fa fa-newspaper-o fa-lg"></span>
  87. </a>
  88. </li>
  89. <li>
  90. <a href="https://github.com/gadenbuie/xaringanthemer">
  91. <span class="fa fa-github fa-lg"></span>
  92. </a>
  93. </li>
  94. <li>
  95. <a href="https://twitter.com/grrrck">
  96. <span class="fa fa-twitter fa-lg"></span>
  97. </a>
  98. </li>
  99. <li>
  100. <a href="https://www.garrickadenbuie.com">
  101. <span class="fa fa-home fa-lg"></span>
  102. </a>
  103. </li>
  104. </ul>
  105. </div><!--/.nav-collapse -->
  106. </div><!--/.container -->
  107. </div><!--/.navbar -->
  108. </header>
  109. <div class="row">
  110. <div class="col-md-9 contents">
  111. <div class="page-header">
  112. <h1>The ggplot2 xaringanthemer base plot theme</h1>
  113. <small class="dont-index">Source: <a href='https://github.com/gadenbuie/xaringanthemer/blob/master/R/ggplot2.R'><code>R/ggplot2.R</code></a></small>
  114. <div class="hidden name"><code>theme_xaringan_base.Rd</code></div>
  115. </div>
  116. <div class="ref-description">
  117. <p><strong>Lifecycle:</strong> <a href='https://www.tidyverse.org/lifecycle/#experimental'>Experimental</a>.</p>
  118. <p>Provides a base plot theme for <span class="pkg">ggplot2</span> to match the <span class="pkg">xaringan</span> slide theme
  119. created by <a href='xaringanthemer-package.html'>xaringanthemer</a>. The theme is designed to create a general plot
  120. style from two colors, a <code>background_color</code> and a <code>text_color</code> (or foreground
  121. color). Also accepts an <code>accent_color</code> and an <code>accent_secondary_color</code> that are
  122. <a href='xaringanthemer-package.html'>xaringanthemer</a> is not required for the base theme. Use
  123. <code><a href='theme_xaringan.html'>theme_xaringan()</a></code> or <code><a href='theme_xaringan_inverse.html'>theme_xaringan_inverse()</a></code> in xaringan slides styled by
  124. xaringanthemer for a plot theme that matches the slide style.</p>
  125. </div>
  126. <pre class="usage"><span class='fu'>theme_xaringan_base</span>(
  127. <span class='no'>text_color</span>,
  128. <span class='no'>background_color</span>,
  129. <span class='no'>...</span>,
  130. <span class='kw'>set_ggplot_defaults</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
  131. <span class='kw'>accent_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  132. <span class='kw'>accent_secondary_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  133. <span class='kw'>text_font</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  134. <span class='kw'>text_font_use_google</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  135. <span class='kw'>text_font_size</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  136. <span class='kw'>title_font</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  137. <span class='kw'>title_font_use_google</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  138. <span class='kw'>title_font_size</span> <span class='kw'>=</span> <span class='kw'>NULL</span>
  139. )</pre>
  140. <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
  141. <table class="ref-arguments">
  142. <colgroup><col class="name" /><col class="desc" /></colgroup>
  143. <tr>
  144. <th>text_color</th>
  145. <td><p>Color for text and foreground</p></td>
  146. </tr>
  147. <tr>
  148. <th>background_color</th>
  149. <td><p>Color for background</p></td>
  150. </tr>
  151. <tr>
  152. <th>...</th>
  153. <td><p>Ignored</p></td>
  154. </tr>
  155. <tr>
  156. <th>set_ggplot_defaults</th>
  157. <td><p>Should defaults be set for <span class="pkg">ggplot2</span> <em>geoms</em>?
  158. Defaults to TRUE. To restore ggplot's defaults, or the previously set geom
  159. defaults, see <code><a href='theme_xaringan_set_defaults.html'>theme_xaringan_restore_defaults()</a></code>.</p></td>
  160. </tr>
  161. <tr>
  162. <th>accent_color</th>
  163. <td><p>Color for titles and accents, inherits from
  164. <code>header_color</code> or <code>text_color</code>. Used for the <code>title</code> base setting in
  165. <code><a href='https://ggplot2.tidyverse.org/reference/theme.html'>ggplot2::theme()</a></code>, and additionally for setting the <code>color</code> or <code>fill</code> of
  166. <span class="pkg">ggplot2</span> geom defaults.</p></td>
  167. </tr>
  168. <tr>
  169. <th>accent_secondary_color</th>
  170. <td><p>Color for secondary accents, inherits from
  171. <code>text_bold_color</code> or <code>accent_color</code>. Used only when setting <span class="pkg">ggplot2</span> geom
  172. defaults.</p></td>
  173. </tr>
  174. <tr>
  175. <th>text_font</th>
  176. <td><p>Font to use for text elements, passed to
  177. <code><a href='https://rdrr.io/pkg/sysfonts/man/font_add_google.html'>sysfonts::font_add_google()</a></code>, if available and <code>text_font_use_google</code> is
  178. <code>TRUE</code>. Inherits from <code>text_font_family</code>.</p></td>
  179. </tr>
  180. <tr>
  181. <th>text_font_use_google</th>
  182. <td><p>Is <code>text_font</code> available on <a href='https://fonts.google.com'>Google Fonts</a>?</p></td>
  183. </tr>
  184. <tr>
  185. <th>text_font_size</th>
  186. <td><p>Base text font size, inherits from <code>text_font_size</code>, or
  187. defaults to 11.</p></td>
  188. </tr>
  189. <tr>
  190. <th>title_font</th>
  191. <td><p>Font to use for title elements, passed to
  192. <code><a href='https://rdrr.io/pkg/sysfonts/man/font_add_google.html'>sysfonts::font_add_google()</a></code>, if available and <code>title_font_use_google</code> is
  193. <code>TRUE</code>. Inherits from <code>title_font_family</code>.</p></td>
  194. </tr>
  195. <tr>
  196. <th>title_font_use_google</th>
  197. <td><p>Is <code>title_font</code> available on <a href='https://fonts.google.com'>Google Fonts</a>?</p></td>
  198. </tr>
  199. <tr>
  200. <th>title_font_size</th>
  201. <td><p>Base text font size, inherits from <code>title_font_size</code>,
  202. or defaults to 14.</p></td>
  203. </tr>
  204. </table>
  205. <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
  206. <p>A ggplot2 theme</p>
  207. <h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
  208. <div class='dont-index'><p>Other xaringanthemer ggplot2 themes:
  209. <code><a href='theme_xaringan_inverse.html'>theme_xaringan_inverse</a>()</code>,
  210. <code><a href='theme_xaringan_set_defaults.html'>theme_xaringan_set_defaults</a>()</code>,
  211. <code><a href='theme_xaringan.html'>theme_xaringan</a>()</code></p></div>
  212. <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
  213. <pre class="examples"><div class='input'><span class='co'># Requires ggplot2</span>
  214. <span class='no'>has_ggplot2</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/ns-load.html'>requireNamespace</a></span>(<span class='st'>"ggplot2"</span>, <span class='kw'>quietly</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
  215. <span class='kw'>if</span> (<span class='no'>has_ggplot2</span>) {
  216. <span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>ggplot2</span>)
  217. <span class='no'>plot1</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>iris</span>) +
  218. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='no'>Petal.Length</span>, <span class='no'>Petal.Width</span>) +
  219. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/geom_point.html'>geom_point</a></span>() +
  220. <span class='fu'>theme_xaringan_base</span>(
  221. <span class='kw'>text_color</span> <span class='kw'>=</span> <span class='st'>"#602f6b"</span>, <span class='co'># imperial</span>
  222. <span class='kw'>background_color</span> <span class='kw'>=</span> <span class='st'>"#f8f8f8"</span>, <span class='co'># light gray</span>
  223. <span class='kw'>accent_color</span> <span class='kw'>=</span> <span class='st'>"#317873"</span>, <span class='co'># myrtle green</span>
  224. <span class='kw'>title_font</span> <span class='kw'>=</span> <span class='st'>"sans"</span>,
  225. <span class='kw'>text_font</span> <span class='kw'>=</span> <span class='st'>"serif"</span>,
  226. <span class='kw'>set_ggplot_defaults</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>
  227. ) +
  228. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>labs</a></span>(
  229. <span class='kw'>title</span> <span class='kw'>=</span> <span class='st'>"Basic Iris Plot"</span>,
  230. <span class='kw'>subtitle</span> <span class='kw'>=</span> <span class='st'>"+ theme_xaringan_base()"</span>,
  231. <span class='kw'>caption</span> <span class='kw'>=</span> <span class='st'>"xaringanthemer"</span>
  232. )
  233. <span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span>(<span class='no'>plot1</span>)
  234. <span class='no'>plot2</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>iris</span>) +
  235. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='no'>Sepal.Width</span>) +
  236. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/geom_histogram.html'>geom_histogram</a></span>(<span class='kw'>binwidth</span> <span class='kw'>=</span> <span class='fl'>0.1</span>) +
  237. <span class='fu'>theme_xaringan_base</span>(
  238. <span class='kw'>text_color</span> <span class='kw'>=</span> <span class='st'>"#a8a9c8"</span>, <span class='co'># light purple</span>
  239. <span class='kw'>background_color</span> <span class='kw'>=</span> <span class='st'>"#303163"</span>, <span class='co'># deep slate purple</span>
  240. <span class='kw'>accent_color</span> <span class='kw'>=</span> <span class='st'>"#ffff99"</span>, <span class='co'># canary yellow</span>
  241. <span class='kw'>title_font</span> <span class='kw'>=</span> <span class='st'>"sans"</span>,
  242. <span class='kw'>text_font</span> <span class='kw'>=</span> <span class='st'>"serif"</span>,
  243. <span class='kw'>set_ggplot_defaults</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>
  244. ) +
  245. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>labs</a></span>(
  246. <span class='kw'>title</span> <span class='kw'>=</span> <span class='st'>"Basic Iris Plot"</span>,
  247. <span class='kw'>subtitle</span> <span class='kw'>=</span> <span class='st'>"+ theme_xaringan_base()"</span>,
  248. <span class='kw'>caption</span> <span class='kw'>=</span> <span class='st'>"xaringanthemer"</span>
  249. )
  250. <span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span>(<span class='no'>plot2</span>)
  251. }</div><div class='img'><img src='theme_xaringan_base-1.png' alt='' width='700' height='433' /></div><div class='img'><img src='theme_xaringan_base-2.png' alt='' width='700' height='433' /></div></pre>
  252. </div>
  253. <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
  254. <h2>Contents</h2>
  255. <ul class="nav nav-pills nav-stacked">
  256. <li><a href="#arguments">Arguments</a></li>
  257. <li><a href="#value">Value</a></li>
  258. <li><a href="#see-also">See also</a></li>
  259. <li><a href="#examples">Examples</a></li>
  260. </ul>
  261. </div>
  262. </div>
  263. <footer>
  264. <div class="copyright">
  265. <p>Developed by <a href='https://www.garrickadenbuie.com'>Garrick Aden-Buie</a>.</p>
  266. </div>
  267. <div class="pkgdown">
  268. <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
  269. </div>
  270. </footer>
  271. </div>
  272. </body>
  273. </html>