geom_segment

27 views
Skip to first unread message

like

unread,
Sep 14, 2020, 4:56:26 AM9/14/20
to ggp...@googlegroups.com
Hi guys,
I am studying ggplot2 from R graphics cookbook(

3.10 Making a Cleveland Dot Plot ,https://r-graphics.org/recipe-bar-graph-dot-plot), if I use the code :

ggplot(tophit, aes(x = avg, y = name)) +
   geom_segment(aes(yend = name),xend=0) 
the plot looks like in upper panel in attachment., this is what i want  otherwise,
when the code:
ggplot(tophit, aes(x = avg, y = name)) +
   geom_segment(aes(yend = name,xend=0))
the plot looks like lower panel. this is a bad thing.
 I am wondering about  if xend put in aes ,x-axis sort of starts from 3.0. xend put outside the aes, the x-axis  starts from 0.
who could expain it?
many thanks!


 

plot.docx
Reply all
Reply to author
Forward
0 new messages