title: Is it possible to usa a custom-defined palette in ggplot2?
body: <p>I would like to use a custom defined palette in drawing a graph with ggplot2. I take just an example made with viridis:</p>
  <pre><code>library(ggplot2)
  library(viridis)
  
  ggplot(data.frame(x = rnorm(10000), y = rnorm(10000)), aes(x = x, y = y)) +
    geom_hex() + coord_fixed() +
    scale_fill_viridis() + theme_bw()
  </code></pre>
  <p>My idea is to use the following palette:</p>
  <pre><code>palette &lt;- c(&quot;#771C19&quot;, &quot;#AA3929&quot;, &quot;#E25033&quot;, &quot;#F27314&quot;, &quot;#F8A31B&quot;, 
                &quot;#E2C59F&quot;, &quot;#B6C5CC&quot;, &quot;#8E9CA3&quot;, &quot;#556670&quot;, &quot;#000000&quot;)
  
  library(scales)
  show_col(palette)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/vsPgw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vsPgw.png" alt="enter image description here" /></a></p>
  <p>I supposed to use <code>scale_colour_manual(values = palette)</code> but it looks like it doesn't take my custom-defined one. I am doing some kind of mistake?</p>
  <pre><code>library(ggplot2)
  ggplot(data.frame(x = rnorm(10000), y = rnorm(10000)), aes(x = x, y = y)) +
    geom_hex() + coord_fixed() +
    scale_colour_manual(values = palette) + theme_bw()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/YvtCM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YvtCM.png" alt="enter image description here" /></a></p>