title: Grouped boxplot combined with dotplot in ggplot2
body: <p>I am new to stackoverflow so please be forgiving, if the way of asking my question can be improved (in that case I'm happy if you let me know how).</p>
  
  <p>I am using the following code in ggplot2 to produce a grouped boxplot combined with a dotplot (unfortunately I cannot post an image yet (no reputation)):</p>
  
  <pre><code>ggplot(data24, aes(x=intensity, y=percacc, fill=group)) +
         geom_boxplot(position=position_dodge(1), notch=T,
                      outlier.colour = NA, width = .7, alpha=0.2) +
         geom_dotplot(binaxis = "y", stackdir = "center", binwidth = 3,
                      position=position_dodge(1), dotsize=0.5, alpha=1) +
         stat_summary(fun.y=mean, geom="point", shape=23, size=5,
                      position=position_dodge(0.3)) +
         stat_summary(fun.data=mean_cl_boot, geom="errorbar", width=0.1, 
                      position=position_dodge(0.3), size=1.2)+
         scale_y_continuous(limits=c(0,100)) +
         scale_fill_discrete(name="Group")
  </code></pre>
  
  <p>My questions are:</p>
  
  <ul>
  <li>How can use different colors for different elements? I tried to add color/fill commands within geom_boxplot() and geom_dotplot, but this doesn't work: e.g., if I add fill="green" to geom_dotplot(), all points become green and centered between the boxplots. How can I rewrite the code to get </li>
  <li>white fill for all boxplots</li>
  <li>blue fill and black line for dots of group 1</li>
  <li>green fill and black line for dots of group 2</li>
  <li><p>black fill for all mean diamonds </p>
  
  <ol start="2">
  <li><p>How can pull the categories of "intensity" (i.e. the three pairs of boxplots) further apart from each other?</p></li>
  <li><p>How can I display the dotplots next to the boxplots and the mean+CI in the boxplot?</p></li>
  <li><p>Why does my coordination system still go from &lt;0 to >100, even if I defined the y-axis to go from 0 to 100?</p></li>
  </ol></li>
  </ul>
  
  <p>Thank you!</p>
  
  <p>Edit 180722</p>
  
  <p>Thank you for your comments. The data head is:</p>
  
  <pre><code>   id intensity AQ_sum group acc   percacc
  1  54        40     11  COMP   5  20.83333
  2  54        60     11  COMP  18  75.00000
  3  54        80     11  COMP  24 100.00000
  4  55        40     12  COMP   9  37.50000
  5  55        60     12  COMP  22  91.66667
  6  55        80     12  COMP  24 100.00000
  7  58        40     10  COMP   8  33.33333
  8  58        60     10  COMP  22  91.66667
  9  58        80     10  COMP  23  95.83333
  10 59        40      6  COMP  19  79.16667
  11 59        60      6  COMP  24 100.00000
  12 59        80      6  COMP  24 100.00000
  13 60        40      9  COMP  10  41.66667
  14 60        60      9  COMP  23  95.83333
  15 60        80      9  COMP  22  91.66667
  16 61        40     13  COMP   4  16.66667
  17 61        60     13  COMP  19  79.16667
  18 61        80     13  COMP  24 100.00000
  19 62        40     12  COMP  16  66.66667
  20 62        60     12  COMP  23  95.83333
  </code></pre>
  
  <p>My updated code is </p>
  
  <pre><code>ggplot(data24, aes(x=intensity, y=percacc, fill=group)) +
    geom_boxplot(position=position_dodge(0.8), notch=T,
                 outlier.colour = NA, width = .4, alpha=0.3) +
    geom_dotplot(binaxis = "y", stackdir = "center", binwidth = 3,
                 position=position_dodge(0.8), dotsize=0.4, alpha=1)+
    scale_fill_manual(values=c("#999999", "#E69F00"), name="Group") +
    stat_summary(fun.y=mean, geom="point", shape=23, size=3,
                 position=position_dodge(0.2)) +
    stat_summary(fun.data=mean_cl_boot, geom="errorbar", width=0.1, 
                 position=position_dodge(0.2), size=0.5)+
    scale_y_continuous(limits=c(0,103), expand = c(0, 0), 
                       breaks=c(0,20,40,60,80,100), name="Percentage accuracy") +
    scale_x_discrete(expand = c(0, 0.6), name="Degree of intensity (in percent)") +
    labs(title="Accuracy by intensity and group\n") +
    theme_light()+
    theme(plot.title = element_text(face='bold', size=12, hjust = 0.5),
          axis.title.x = element_text(size=10,hjust=0.5),
          axis.title.y = element_text(size=10,vjust=1),
          axis.text.x = element_text(size=10,color='black'),
          axis.text.y = element_text(size=10, color='black'),
          panel.grid.major.y = element_line(size = 0.3, linetype = "dotted", color="darkgrey"), 
          panel.grid.minor.y = element_line(size = 0.3, linetype = "dotted", color="darkgrey"),
          panel.grid.major.x = element_blank(),
          panel.border = element_blank(),
          axis.line = element_line(size = 0.5, linetype = "solid", colour = "black")) +
    ggsave("plotintensity.png", width = 10, height = 5) 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/yTJ6u.png" alt="See image of the graph"></p>