title: Order Bubble Chart bubbles along y-axis using ggplot2 in r
body: <p>I want to make a bubble chart using the following data:</p>
  <pre><code>&gt; head(data1)
  # A tibble: 6 x 4
    Group                        Group_Strength Group_N Group_Quality
    &lt;chr&gt;                                 &lt;dbl&gt;   &lt;dbl&gt;         &lt;dbl&gt;
  1 Young Controls                         1          1          18.5
  2 Healthy Age-Matched Controls          59         59          20  
  3 Neurodegenerative Disease             36        178          19.1
  4 Right Hemisphere Stroke                7.86     159          20.1
  5 Left Hemisphere Stroke               -19         19          15  
  6 Bilateral Stroke                      26         26          17  
  </code></pre>
  <p>I would like the size of each bubble to indicate the Group_N column, the color of each bubble to indicate the Group_Strength column, and the y-axis to indicate the Group_Quality column.</p>
  <p>SO far I have been able to represent the Group_N column (bubble size) and the Group_strength column (color) using the following code. But I cannot figure out how to change the order of the bubbles along the y-axis to indicate Group_Quality:</p>
  <pre><code>library(packcircles)
  library(ggplot2)
  library(tidyverse)
  
  data1$Group_N &lt;- as.numeric(data1$Group_N)
  
  # Generate the layout. sizetype can be area or radius, following your preference on what to be proportional to value.
  packing1 &lt;- circleProgressiveLayout(data1$Group_N, sizetype='area')
  data1 &lt;- cbind(data1, packing1)
  dat.gg1 &lt;- circleLayoutVertices(packing1, npoints=50)
  
  
  dat.gg1$Group_Strength &lt;- rep(data1$Group_Strength, each=51)
  # Plot
  ggplot() + 
    
    # bubbles
    geom_polygon(data = dat.gg1, aes(x, y, group = id, fill=Group_Strength), colour = &quot;black&quot;, alpha = 0.6) +
    scale_fill_distiller(palette = &quot;BuPu&quot;, direction = 1 ) +
    
    # text for each bubble
    geom_text(data = data1, aes(x, y, size=Group_N, label = Group)) +
    scale_size_continuous(range = c(1,4)) +
    
    # Theme:
    theme_void()  + 
    theme(legend.position=&quot;none&quot;) + 
    coord_equal()
  
  </code></pre>
  <p>Giving me the following figure:</p>
  <p><img src="https://i.stack.imgur.com/rK65N.png" alt="BubblePlot" /></p>
  <p>Can anyone suggest a way to represent Group_Quality along the y-axis, or in some other way? I am at a loss.</p>
  <hr />
  <p><strong>Data</strong></p>
  <pre class="lang-r prettyprint-override"><code>data1 &lt;- structure(list(Group = c(&quot;Young Controls&quot;, 
  &quot;Healthy Age-Matched Controls&quot;, 
  &quot;Neurodegenerative Disease&quot;, &quot;Right Hemisphere Stroke&quot;, &quot;Left Hemisphere Stroke&quot;, 
  &quot;Bilateral Stroke&quot;), Group_Strength = c(1, 59, 36, 7.86, -19, 
  26), Group_N = c(1L, 59L, 178L, 159L, 19L, 26L), Group_Quality = c(18.5, 
  20, 19.1, 20.1, 15, 17)), class = &quot;data.frame&quot;, row.names = c(NA, 
  -6L))
  </code></pre>