title: ggplot - Multiple legends arrangement
body: <p>I want to arrange mutiple legend in ggplot with multiple rows and columns. However currently, from the documentation I can only decide there direction or manipulate rows/columns within 1 legend. Am I overlook something? Thanks for any reference point to the solution.
  Here is the sample code and what I have done and the expect result.</p>
  
  <pre><code>data &lt;- seq(1000, 4000, by=1000)
  colorScales &lt;- c("#c43b3b", "#80c43b", "#3bc4c4", "#7f3bc4")
  names(colorScales) &lt;- data
  ggplot() +
      geom_point(aes(x=data, y=data, color=as.character(data), fill=data, size=data),
                 shape=21) +
      scale_color_manual(name="Legend 1",
                        values=colorScales) +
      scale_fill_gradientn(name="Legend 2",
                            labels=comma, limits=c(0, max(data)),
                            colours=rev(c("#000000", "#FFFFFF", "#BA0000")),
                           values=c(0, 0.5, 1)) +
      scale_size_continuous(name="Legend 3") +
      theme(legend.direction = "vertical", legend.box = "vertical")
  </code></pre>
  
  <p>Output vertical legend:
  <a href="https://i.stack.imgur.com/9aLeI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9aLeI.png" alt="enter image description here"></a></p>
  
  <pre><code>ggplot() +
      geom_point(aes(x=data, y=data, color=as.character(data), fill=data, size=data),
                 shape=21) +
      scale_color_manual(name="Legend 1",
                         values=colorScales) +
      scale_fill_gradientn(name="Legend 2",
                           labels=comma, limits=c(0, max(data)),
                           colours=rev(c("#000000", "#FFFFFF", "#BA0000")), 
                           values=c(0, 0.5, 1)) +
      scale_size_continuous(name="Legend 3") +
      theme(legend.direction = "vertical", legend.box = "horizontal")
  </code></pre>
  
  <p>Output horizontal legend
  <a href="https://i.stack.imgur.com/OEtrZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OEtrZ.png" alt="enter image description here"></a></p>
  
  <pre><code>ggplot() +
      geom_point(aes(x=data, y=data, color=as.character(data), fill=data, size=data),
                 shape=21) +
      scale_color_manual(name="Legend 1",
                         values=colorScales) +
      scale_fill_gradientn(name="Legend 2",
                           labels=comma, limits=c(0, max(data)),
                           colours=rev(c("#000000", "#FFFFFF", "#BA0000")), 
                           values=c(0, 0.5, 1)) +
      guides(colour = guide_legend(nrow = 2, byrow = T, override.aes=list(size=4))) +
      guides(size = guide_legend(nrow = 2, byrow = T)) +
      scale_size_continuous(name="Legend 3") +
      theme(legend.direction = "vertical", legend.box = "vertical")
  </code></pre>
  
  <p>Output legend with vertical layout, 2 columns within each legend:
  <a href="https://i.stack.imgur.com/se20w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/se20w.png" alt="enter image description here"></a></p>
  
  <p>What I want is this:</p>
  
  <p><a href="https://i.stack.imgur.com/gNQWN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gNQWN.png" alt="enter image description here"></a></p>