Add geom_segment to geom_point plot in ggplot
<p>How can I add a geom_segment to my geom_point plot so that there is line from x-axis to the point?</p>

<p>Here is my dummy code:</p>

<pre><code>library(grid);library(gridExtra);library(dplyr);library(ggplot2)

## Data
group1 &lt;- seq(1, 10, 2); group2 &lt;-  seq(1, 20, 3)
x = c(group1, group2)
mydf &lt;- data.frame (X =x , Y = rnorm (length (x),5,1), 
                    groups = c(rep(1, length (group1)), rep(2, length(group2))))

## Plots
p1 &lt;- ggplot(data=mydf[mydf$groups==1,],aes(x=X,y=Y))+
  geom_point(size=2)+
  theme_bw()

p2 &lt;- ggplot(data=mydf[mydf$groups==2,],aes(x=X,y=Y))+
  geom_point(size=2)+
  theme_bw()

## Facetting
summ &lt;- mydf %&gt;% group_by(groups) %&gt;% summarize(len=diff(range(X)))
summ$p &lt;- summ$len/max(summ$len)
summ$q &lt;- 1-summ$p

ng &lt;- nullGrob()
grid.arrange(arrangeGrob(p1,ng,widths=summ[1,3:4]),
             arrangeGrob(p2,ng,widths=summ[2,3:4]))
</code></pre>

<p>And my plot:
<a href="https://i.stack.imgur.com/pXfD1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pXfD1.png" alt="enter image description here"></a></p>

<p>Thanks</p>

<p>Bade</p>