title: Heat Map Density Over Time in R
body: <p>A sample dataset is provided below.  </p>
  
  <p>I'm not sure if there is a name for the graph I'm thinking of.  I have a value recorded daily, and rather than create a simple line graph, I'd like to display it as if looking at a body of water from above, where shallow depths are light and deeper depths are colored darker.  </p>
  
  <p>I'm just looking to create a simple rectangle, where Date is on the X axis, the Y axis is just a uniform value, and the Color of the line at the date is defined by the Value recorded, without any spacing between the lines at each date.</p>
  
  <p>I'm hoping it would look something like this color scale line, with differing shades at differing depths, and with user control over the color at maximal depth.  </p>
  
  <p><a href="https://i.stack.imgur.com/MKSbc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MKSbc.png" alt="Color Scale"></a></p>
  
  <p>I'm relatively new to visualizations in R, and my main goal is simply to experiment with different ways to represent some simple data.  I'd appreciate any suggestions regarding what I could do to learn how to create not just a graph like this, but perhaps other non-traditional graphs in the future.  </p>
  
  <pre><code>D &lt;- structure(list(Date = structure(c(16709, 16710, 16711, 16712, 
  16713, 16714, 16715, 16716, 16717, 16718, 16719, 16720, 16721, 
  16722, 16723, 16724, 16725, 16726, 16727, 16728, 16729, 16730, 
  16731, 16732, 16733, 16734, 16735, 16736, 16737, 16738), class = "Date"), 
  Length = c(288, 426, 315, 844, 587, 224, 859, 1052, 892, 
  483, 497, 927, 2697, 1647, 2494, 1525, 0, 0, 1263, 0, 753, 
  671, 673, 792, 1615, 739, 1268, 367, 0, 120)), class = c("tbl_df", 
  "tbl", "data.frame"), row.names = c(NA, -30L), .Names = c("Date", "Value"))
  </code></pre>
  
  <p>Edit:</p>
  
  <p>I'm currently working with <code>geom_raster()</code> in <code>ggplot2</code>.  It's not as pretty as I thought it would be, but I'll take this as a starting point.</p>
  
  <pre><code>library(dplyr)
  
  ggplot(D %&gt;% mutate(y = 1),
     aes(x = Date, y = y, fill = Value)) +
    geom_raster() +
    scale_fill_gradientn(colors = c("white", "black"))
  </code></pre>