title: Plotting scatter plot by groups in r
body: <p>Is there any function in r that allows the plotting of this kind of scatter plots, which separates the dots by group?</p>
  
  <p><a href="https://i.stack.imgur.com/J7Ah3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J7Ah3.jpg" alt="enter image description here"></a></p>
  
  <p>Here is what I have done so far:</p>
  
  <pre><code>hours = c(0.00  ,-1.78  ,-0.50  ,-2.00  ,-2.80  ,2.00   ,-0.16  ,-0.34  ,1.00   ,1.00   ,2.00   ,-1.34  ,-1.00  ,-1.10  ,-0.43  ,-0.49  ,-0.02  ,-0.91,  0.48   ,2.33   ,1.00   ,0.00   ,1.18   ,1.29   ,-1.07  ,-0.26  ,1.96   ,0.36   ,2.00   ,-0.63  ,-0.80  ,-0.70  ,-2.00  ,1.17   ,0.67   ,-3.00)
  group = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
  df = data.frame(hours,group)
  
  ggplot(df, aes(group, hours)) + geom_point(shape = 16, size = 5, position = position_jitter(w=0.3,h=0.3))
  </code></pre>
  
  <p>But it turns out weird:</p>
  
  <p><a href="https://i.stack.imgur.com/RmR4w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RmR4w.png" alt="enter image description here"></a></p>
  
  <p>Any help is really appreciated!</p>