title: How to plot a heatmap with a color hex as the z direction component (plotly or ggplot prefered)
body: <p>I want to plot a figure where my third dimension (Z) is defined by a color hex which is defined by the make up of three values. </p>
  
  <p>I have already converted three values into a hex using rgb(). I now have a data frame which has the x and y values as numbers and a z column with a bunch of hex values. </p>
  
  <p>Is there a way to create a plot where each point is colored by the hex value, whether that is by creating a heat map in plotly or using geom_raster/geom_tile in ggplot2.</p>
  
  <p>If there is another package that I could use thats fine too. </p>
  
  <p>Here is some code to show what I have done thus far</p>
  
  <pre><code>library(dplyr)
  set.seed(1)
  
  x &lt;- c(1,1,1,2,2,2,3,3,3)
  y &lt;- c(1,2,3,1,2,3,1,2,3)
  cap_1 &lt;- runif(9,0,10)
  cap_2 &lt;- runif(9,0,10)
  cap_3 &lt;- runif(9,0,10)
  df &lt;- data.frame(x,y,cap_1,cap_2, cap_3)
  </code></pre>
  
  <p>I convert the capacity (cap_1 to cap_3) into percentages and then create a color hex based on the primary colors from the percentages</p>
  
  <pre><code>df &lt;- df %&gt;%
      mutate(cap_sum = rowSums(df[3:5])) %&gt;%
      mutate(cap_1_p = cap_1/cap_sum) %&gt;%
      mutate(cap_2_p = cap_2/cap_sum) %&gt;%
      mutate(cap_3_p = cap_3/cap_sum) %&gt;%
      mutate(z = rgb(cap_1_p, cap_2_p,cap_3_p))
  </code></pre>
  
  <p>I have tried plotting it as a heat map unsuccessfully:</p>
  
  <pre><code>library(plotly)
  fig &lt;- plot_ly(df, x='x', y='y', z='z', 
             type = "heatmap")
  fig
  </code></pre>