title: Creating squares with ggplot (what is the height of my y-axis when using categorical variable in y-scale?)
body: <p>I have data like this:</p>
  <pre><code>class date       color  
     &lt;chr&gt; &lt;date&gt;     &lt;chr&gt;  
   1 two   2021-01-21 #00FF00
   2 two   2021-02-01 #83FF83
   3 two   2021-02-11 #CDFFCD
   4 two   2021-02-21 #7BFF7B
   5 two   2021-03-03 #94FF94
   6 two   2021-03-13 #F6FFF6
   7 two   2021-03-23 #EEFFEE
   8 two   2021-04-02 #C5FFC5
   9 two   2021-04-12 #8BFF8B
  10 two   2021-04-22 #F6FFF6
  11 one   2021-01-21 #00FF00
  12 one   2021-02-01 #83FF83
  13 one   2021-02-11 #CDFFCD
  14 one   2021-02-21 #7BFF7B
  15 one   2021-03-03 #94FF94
  16 one   2021-03-13 #F6FFF6
  17 one   2021-03-23 #EEFFEE
  18 one   2021-04-02 #C5FFC5
  19 one   2021-04-12 #8BFF8B
  20 one   2021-04-22 #EEFFEE
  </code></pre>
  <p>You can reproduce it with this dput:</p>
  <pre><code>structure(list(class = c(&quot;two&quot;, &quot;two&quot;, &quot;two&quot;, &quot;two&quot;, &quot;two&quot;, &quot;two&quot;, 
  &quot;two&quot;, &quot;two&quot;, &quot;two&quot;, &quot;two&quot;, &quot;one&quot;, &quot;one&quot;, &quot;one&quot;, &quot;one&quot;, &quot;one&quot;, 
  &quot;one&quot;, &quot;one&quot;, &quot;one&quot;, &quot;one&quot;, &quot;one&quot;), date = structure(c(18648, 
  18659, 18669, 18679, 18689, 18699, 18709, 18719, 18729, 18739, 
  18648, 18659, 18669, 18679, 18689, 18699, 18709, 18719, 18729, 
  18739), class = &quot;Date&quot;), color = c(&quot;#00FF00&quot;, &quot;#83FF83&quot;, &quot;#CDFFCD&quot;, 
  &quot;#7BFF7B&quot;, &quot;#94FF94&quot;, &quot;#F6FFF6&quot;, &quot;#EEFFEE&quot;, &quot;#C5FFC5&quot;, &quot;#8BFF8B&quot;, 
  &quot;#F6FFF6&quot;, &quot;#00FF00&quot;, &quot;#83FF83&quot;, &quot;#CDFFCD&quot;, &quot;#7BFF7B&quot;, &quot;#94FF94&quot;, 
  &quot;#F6FFF6&quot;, &quot;#EEFFEE&quot;, &quot;#C5FFC5&quot;, &quot;#8BFF8B&quot;, &quot;#EEFFEE&quot;)), class = c(&quot;grouped_df&quot;, 
  &quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;), row.names = c(NA, -20L), groups = structure(list(
      class = c(&quot;one&quot;, &quot;two&quot;), .rows = structure(list(11:20, 1:10), ptype = integer(0), class = c(&quot;vctrs_list_of&quot;, 
      &quot;vctrs_vctr&quot;, &quot;list&quot;))), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;
  ), row.names = c(NA, -2L), .drop = TRUE))
  </code></pre>
  <p>What I wanted to create was something like this &quot;github&quot;-ish look. So I wanted to create square tiles over the entire range of the dates. For each class (one and two). The date-range is the same.</p>
  <p>So I, for example, want that square to have the height == width such that it fills the entire width of the plot. So I did this:</p>
  <pre><code>   ggplot() +
       geom_tile(data = df,
                 aes(x = date,
                     y = class,
                     fill = color),
                 show.legend = F) +
       scale_fill_identity()
  </code></pre>
  <p>The result is this:</p>
  <p><a href="https://i.stack.imgur.com/vxq9h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vxq9h.png" alt="enter image description here" /></a></p>
  <p>I do not understand what <code>y=class</code> exactly does. Where does it place the <code>class</code> variable on the y-axis. Assuming that it uses the range from 1 / (however many categories), I gave it a height of 0.5 (what units?) like this:</p>
  <pre><code>   ggplot() +
       geom_tile(data = df,
                 aes(x = date,
                     y = class,
                     height=.5,
                     fill = color),
                 show.legend = F) +
       scale_fill_identity() 
  </code></pre>
  <p>The result is the (better, yet not exactly what I want)</p>
  <p><a href="https://i.stack.imgur.com/ZNSEp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZNSEp.png" alt="enter image description here" /></a></p>
  <p>So I removed the <code>height=.5</code> and figured that I should get it done with the <code>coord_equal</code> argument. I just don't know how. Simply taking away the fixed height and add a <code>coord_equal</code> like this:</p>
  <pre><code>   ggplot() +
       geom_tile(data = df,
                 aes(x = date,
                     y = class,
                     fill = color),
                 show.legend = F) +
       scale_fill_identity()  +
       coord_equal()
  </code></pre>
  <p>Produces this :(</p>
  <p><a href="https://i.stack.imgur.com/RUynI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RUynI.png" alt="enter image description here" /></a></p>
  <p>So if anyone has any idea on how to get this done I'd highly appreciate it:)</p>