|
|
|
|
|
|
|
|
<h3 class="hasAnchor"> |
|
|
<h3 class="hasAnchor"> |
|
|
<a href="#scale-xaringan" class="anchor"></a>Custom Color and Fill Scales</h3> |
|
|
<a href="#scale-xaringan" class="anchor"></a>Custom Color and Fill Scales</h3> |
|
|
<p>xaringanthemer includes monotone color and fill scales to match your ggplot2 theme. The scale functions all follow the naming pattern <code>scale_xaringan_<aes>_<data_type>()</code>, where <code><aes></code> is replaced with either <code>color</code> or <code>fill</code> and <code><data_type></code> is one of <code>discrete</code> or <code>continuous</code>.</p> |
|
|
<p>xaringanthemer includes monotone color and fill scales to match your ggplot2 theme. The scale functions all follow the naming pattern <code>scale_xaringan_<aes>_<data_type>()</code>, where <code><aes></code> is replaced with either <code>color</code> or <code>fill</code> and <code><data_type></code> is one of <code>discrete</code> or <code>continuous</code>.</p> |
|
|
<p>These scales use <code><a href="https://rdrr.io/pkg/colorspace/man/hcl_palettes.html">colorspace::sequential_hcl()</a></code> to create a sequential, monotone color scale based on the primary accent color in your slides. Color scales matching the inverse slides are possible by setting the argument <code>inverse = TRUE</code>.</p> |
|
|
|
|
|
|
|
|
<p>These scales use <code><a href="https://colorspace.R-Forge.R-project.org//reference/hcl_palettes.html">colorspace::sequential_hcl()</a></code> to create a sequential, monotone color scale based on the primary accent color in your slides. Color scales matching the inverse slides are possible by setting the argument <code>inverse = TRUE</code>.</p> |
|
|
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r"> |
|
|
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r"> |
|
|
<code class="sourceCode R"><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op">(</span><span class="va">diamonds</span>, <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op">(</span>x <span class="op">=</span> <span class="va">cut</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span> |
|
|
<code class="sourceCode R"><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op">(</span><span class="va">diamonds</span>, <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op">(</span>x <span class="op">=</span> <span class="va">cut</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span> |
|
|
<span class="fu"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op">(</span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op">(</span>fill <span class="op">=</span> <span class="va">..count..</span><span class="op">)</span>, show.legend <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span> <span class="op">+</span> |
|
|
<span class="fu"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op">(</span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op">(</span>fill <span class="op">=</span> <span class="va">..count..</span><span class="op">)</span>, show.legend <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span> <span class="op">+</span> |