title: Colour mappings in R Plotly for geographical data
body: <p>I have a shapefile of the UK that I'm trying to plot in Plotly as part of a Shiny app. Each region has a value attributed to it, between 0 and 5, but may also be NA. How do I get the NA values to appear in grey (for example), and the rest of the plot to follow a gradient?</p>
  <p><code>data()</code> in the following is a reactive Shiny object which reads the shapefile joined to my data dependent on a user input.</p>
  <p>The Plotly code is as follows:</p>
  <pre><code>output$plot &lt;- renderPlotly({plot_ly(data(), 
                                       split = ~region,
                                       color = ~value,
                                       span = I(1),
                                       showlegend = FALSE,
                                       colors = colorRampPalette(c(&quot;green&quot;,&quot;yellow&quot;,&quot;red&quot;))(50),
                                       alpha = 1
                                       )
                             })    
  </code></pre>
  <p>Currently, the maps plot fine, but when there are <code>NA</code> values, these regions appear as white with colour borders and I get a load of</p>
  <pre><code>Warning: line.color doesnt (yet) support data arrays
  Warning: Only one fillcolor per trace allowed
  </code></pre>
  <p>I have tried a few things:</p>
  <ol>
  <li>Passing a custom <code>colorscale</code> into the <code>fillcolor</code> argument, but this did not do anything and just defaulted back to the standard <code>colorscale</code></li>
  <li>Setting all <code>NAs</code> to be -1, then doing something like</li>
  </ol>
  <pre><code>colors = c(colorRampPalette(c(&quot;#c3c3c3&quot;, &quot;c3c3c3&quot;))(9),
             colorRampPalette(c(&quot;#c3c3c3&quot;, &quot;green&quot;))(2)
             colorRampPalette(c(&quot;green&quot;,&quot;yellow&quot;,&quot;red&quot;))(49))
  </code></pre>
  <p>to segment the colors. This appears fine on the actual colorbar, but encounters issues when there are no <code>NA</code> values, since then values near to 0 get mapped into the grey region of the colorscale.</p>
  <p>Using <code>ggplot</code> and <code>ggplotly</code> is not an option as the data is too large.</p>
  <p>Any ideas? Ideally <code>plotly</code> would have an <code>nacolour</code> argument similar to that in <code>ggplot</code>, but I can't seem to find anything like that... thanks in advance!</p>