title: Left-aligned axis labels when using cowplot to switch x axis to top
body: <p>I'm trying to make a correlation heatmap where the x axis is moved to the top using <code>cowplot::switch_axis_position</code>. I have axis labels of varying length and I want the labels to be left-aligned (or rather bottom-aligned, because they are rotated 90 degrees). Although I manage to align the labels, they are moved up far above the plot.</p>
  <pre><code>library(reshape2)
  library(ggplot2)
  library(cowplot)
  
  # some toy data
  set.seed(1)
  mydata &lt;- mtcars[, c(1, 3, 4, 5, 6, 7)]
  
  # to show difference in justification better, make names of unequal length 
  names(mydata) = paste0(sample(c(&quot;mtcars_&quot;, &quot;&quot;), 6, replace = TRUE), names(mydata))
  cormat &lt;- round(cor(mydata), 2)
  
  melted_cormat &lt;- melt(cormat)
  head(melted_cormat)
  </code></pre>
  <p>First a plot where the x axis is moved to the top, and the labels are centered vertically:</p>
  <pre><code>plot &lt;- ggplot(data = melted_cormat, aes(x=Var1, y=Var2, fill=value)) + 
          geom_tile() +
          theme_bw(base_size=20) + xlab(&quot;&quot;) + ylab(&quot;&quot;) +
          theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 0.5))
  ggdraw(switch_axis_position(plot, 'x'))
  </code></pre>
  <p><a href="https://i.stack.imgur.com/AQP9N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AQP9N.png" alt="link" /></a></p>
  <p>Then I use the same code as above but with <code>hjust = 0</code> instead to left-align the x axis text. It indeed aligns the text, but the text is moved weirdly far from graph so variable names are cut off: <a href="https://i.stack.imgur.com/GIYNh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GIYNh.png" alt="link" /></a></p>
  <p>Any ideas of how to fix this?</p>