😎 Give your xaringan slides some style
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

308 lines
14KB

  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>An Inverse Plot Theme for ggplot2 by xaringanthemer — theme_xaringan_inverse • xaringanthemer</title>
  9. <!-- jquery -->
  10. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  11. <!-- Bootstrap -->
  12. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous" />
  13. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>
  14. <!-- bootstrap-toc -->
  15. <link rel="stylesheet" href="../bootstrap-toc.css">
  16. <script src="../bootstrap-toc.js"></script>
  17. <!-- Font Awesome icons -->
  18. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
  19. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous" />
  20. <!-- clipboard.js -->
  21. <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script>
  22. <!-- headroom.js -->
  23. <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script>
  24. <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
  25. <!-- pkgdown -->
  26. <link href="../pkgdown.css" rel="stylesheet">
  27. <script src="../pkgdown.js"></script>
  28. <link href="../extra.css" rel="stylesheet">
  29. <meta property="og:title" content="An Inverse Plot Theme for ggplot2 by xaringanthemer — theme_xaringan_inverse" />
  30. <meta property="og:description" content="Lifecycle: Maturing
  31. A ggplot2 xaringanthemer plot theme to seamlessly match the &quot;inverse&quot;
  32. xaringan slide colors and styles as styled by xaringanthemer." />
  33. <meta name="robots" content="noindex">
  34. <!-- mathjax -->
  35. <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
  36. <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>
  37. <!--[if lt IE 9]>
  38. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  39. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  40. <![endif]-->
  41. </head>
  42. <body data-spy="scroll" data-target="#toc">
  43. <div class="container template-reference-topic">
  44. <header>
  45. <div class="navbar navbar-default navbar-fixed-top" role="navigation">
  46. <div class="container">
  47. <div class="navbar-header">
  48. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
  49. <span class="sr-only">Toggle navigation</span>
  50. <span class="icon-bar"></span>
  51. <span class="icon-bar"></span>
  52. <span class="icon-bar"></span>
  53. </button>
  54. <span class="navbar-brand">
  55. <a class="navbar-link" href="../index.html">xaringanthemer</a>
  56. <span class="version label label-danger" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.2.0.9100</span>
  57. </span>
  58. </div>
  59. <div id="navbar" class="navbar-collapse collapse">
  60. <ul class="nav navbar-nav">
  61. <li>
  62. <a href="../articles/xaringanthemer.html">Get started</a>
  63. </li>
  64. <li>
  65. <a href="../reference/index.html">Reference</a>
  66. </li>
  67. <li>
  68. <a href="../articles/themes.html">Themes</a>
  69. </li>
  70. <li>
  71. <a href="../articles/fonts.html">Fonts</a>
  72. </li>
  73. <li>
  74. <a href="../articles/template-variables.html">Template Variables</a>
  75. </li>
  76. </ul>
  77. <ul class="nav navbar-nav navbar-right">
  78. <li>
  79. <a href="../news/index.html">
  80. <span class="fa fa fa fa-newspaper-o fa-lg"></span>
  81. </a>
  82. </li>
  83. <li>
  84. <a href="https://github.com/gadenbuie/xaringanthemer">
  85. <span class="fa fa-github fa-lg"></span>
  86. </a>
  87. </li>
  88. <li>
  89. <a href="https://twitter.com/grrrck">
  90. <span class="fa fa-twitter fa-lg"></span>
  91. </a>
  92. </li>
  93. <li>
  94. <a href="https://www.garrickadenbuie.com">
  95. <span class="fa fa-home fa-lg"></span>
  96. </a>
  97. </li>
  98. </ul>
  99. </div><!--/.nav-collapse -->
  100. </div><!--/.container -->
  101. </div><!--/.navbar -->
  102. </header>
  103. <div class="row">
  104. <div class="col-md-9 contents">
  105. <div class="page-header">
  106. <h1>An Inverse Plot Theme for ggplot2 by xaringanthemer</h1>
  107. <small class="dont-index">Source: <a href='https://github.com/gadenbuie/xaringanthemer/blob/master/R/ggplot2.R'><code>R/ggplot2.R</code></a></small>
  108. <div class="hidden name"><code>theme_xaringan_inverse.Rd</code></div>
  109. </div>
  110. <div class="ref-description">
  111. <p><strong>Lifecycle:</strong> <a href='https://www.tidyverse.org/lifecycle/#maturing'>Maturing</a></p>
  112. <p>A <span class="pkg">ggplot2</span> xaringanthemer plot theme to seamlessly match the "inverse"
  113. <span class="pkg">xaringan</span> slide colors and styles as styled by <a href='xaringanthemer-package.html'>xaringanthemer</a>.</p>
  114. </div>
  115. <pre class="usage"><span class='fu'>theme_xaringan_inverse</span>(
  116. <span class='kw'>text_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  117. <span class='kw'>background_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  118. <span class='kw'>accent_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  119. <span class='kw'>accent_secondary_color</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  120. <span class='kw'>css_file</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  121. <span class='kw'>set_ggplot_defaults</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
  122. <span class='kw'>text_font</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  123. <span class='kw'>text_font_use_google</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  124. <span class='kw'>text_font_size</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  125. <span class='kw'>title_font</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  126. <span class='kw'>title_font_use_google</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  127. <span class='kw'>title_font_size</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  128. <span class='kw'>use_showtext</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>
  129. )</pre>
  130. <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
  131. <table class="ref-arguments">
  132. <colgroup><col class="name" /><col class="desc" /></colgroup>
  133. <tr>
  134. <th>text_color</th>
  135. <td><p>Color for text and foreground, inherits from <code>text_color</code></p></td>
  136. </tr>
  137. <tr>
  138. <th>background_color</th>
  139. <td><p>Color for background, inherits from
  140. <code>background_color</code></p></td>
  141. </tr>
  142. <tr>
  143. <th>accent_color</th>
  144. <td><p>Color for titles and accents, inherits from
  145. <code>header_color</code></p></td>
  146. </tr>
  147. <tr>
  148. <th>accent_secondary_color</th>
  149. <td><p>Color for secondary accents, inherits from
  150. <code>text_bold_color</code></p></td>
  151. </tr>
  152. <tr>
  153. <th>css_file</th>
  154. <td><p>Path to a <span class="pkg">xaringanthemer</span> CSS file, from which the
  155. theme variables and values will be inferred. In general, if you use the
  156. <span class="pkg">xaringathemer</span> defaults, you will not need to set this. This feature
  157. lets you create a <span class="pkg">ggplot2</span> theme for your <span class="pkg">xaringan</span> slides, even
  158. if you have only saved your theme CSS file and you aren't creating your
  159. CSS theme with <span class="pkg">xaringanthemer</span> in your slides' source file.</p></td>
  160. </tr>
  161. <tr>
  162. <th>set_ggplot_defaults</th>
  163. <td><p>Should defaults be set for <span class="pkg">ggplot2</span> <em>geoms</em>?
  164. Defaults to TRUE. To restore ggplot's defaults, or the previously set geom
  165. defaults, see <code><a href='theme_xaringan_set_defaults.html'>theme_xaringan_restore_defaults()</a></code>.</p></td>
  166. </tr>
  167. <tr>
  168. <th>text_font</th>
  169. <td><p>Font to use for text elements, passed to
  170. <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
  171. <code>TRUE</code>. Inherits from <code>text_font_family</code>.</p></td>
  172. </tr>
  173. <tr>
  174. <th>text_font_use_google</th>
  175. <td><p>Is <code>text_font</code> available on <a href='https://fonts.google.com'>Google Fonts</a>?</p></td>
  176. </tr>
  177. <tr>
  178. <th>text_font_size</th>
  179. <td><p>Base text font size, inherits from <code>text_font_size</code>, or
  180. defaults to 11.</p></td>
  181. </tr>
  182. <tr>
  183. <th>title_font</th>
  184. <td><p>Font to use for title elements, passed to
  185. <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
  186. <code>TRUE</code>. Inherits from <code>title_font_family</code>.</p></td>
  187. </tr>
  188. <tr>
  189. <th>title_font_use_google</th>
  190. <td><p>Is <code>title_font</code> available on <a href='https://fonts.google.com'>Google Fonts</a>?</p></td>
  191. </tr>
  192. <tr>
  193. <th>title_font_size</th>
  194. <td><p>Base text font size, inherits from <code>title_font_size</code>,
  195. or defaults to 14.</p></td>
  196. </tr>
  197. <tr>
  198. <th>use_showtext</th>
  199. <td><p>If <code>TRUE</code> (default) the <span class="pkg">showtext</span> package will be
  200. used to register Google fonts. Set to <code>FALSE</code> to disable this feature
  201. entirely, which may result in errors during plotting if the fonts used are
  202. not available locally.</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_base.html'>theme_xaringan_base</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='co'># Because this is an example, we'll save the CSS to a temp file</span>
  217. <span class='no'>path_to_css_file</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/tempfile.html'>tempfile</a></span>(<span class='kw'>fileext</span> <span class='kw'>=</span> <span class='st'>".css"</span>)
  218. <span class='co'># Create the xaringan theme: dark blue background with teal green accents</span>
  219. <span class='fu'><a href='style_duo.html'>style_duo</a></span>(
  220. <span class='kw'>primary_color</span> <span class='kw'>=</span> <span class='st'>"#002b36"</span>,
  221. <span class='kw'>secondary_color</span> <span class='kw'>=</span> <span class='st'>"#31b09e"</span>,
  222. <span class='co'># Using basic fonts for this example, but the plot theme will</span>
  223. <span class='co'># automatically use your theme font if you use Google fonts</span>
  224. <span class='kw'>text_font_family</span> <span class='kw'>=</span> <span class='st'>"sans"</span>,
  225. <span class='kw'>header_font_family</span> <span class='kw'>=</span> <span class='st'>"serif"</span>,
  226. <span class='kw'>outfile</span> <span class='kw'>=</span> <span class='no'>path_to_css_file</span>
  227. )
  228. <span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>ggplot2</span>)
  229. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>iris</span>) +
  230. <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>) +
  231. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/geom_point.html'>geom_point</a></span>() +
  232. <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>ggtitle</a></span>(<span class='st'>"Yet another Iris plot"</span>) +
  233. <span class='co'># themed to match the inverse slides: teal background with dark blue text</span>
  234. <span class='fu'>theme_xaringan_inverse</span>()
  235. }</div><div class='img'><img src='theme_xaringan_inverse-1.png' alt='' width='700' height='433' /></div></pre>
  236. </div>
  237. <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
  238. <nav id="toc" data-toggle="toc" class="sticky-top">
  239. <h2 data-toc-skip>Contents</h2>
  240. </nav>
  241. </div>
  242. </div>
  243. <footer>
  244. <div class="copyright">
  245. <p>Developed by <a href='https://www.garrickadenbuie.com'>Garrick Aden-Buie</a>.</p>
  246. </div>
  247. <div class="pkgdown">
  248. <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.0.</p>
  249. </div>
  250. </footer>
  251. </div>
  252. </body>
  253. </html>