Question on geom_points

46 views
Skip to first unread message

Lancaster, Vicki

unread,
Jun 3, 2015, 7:35:13 AM6/3/15
to ggp...@googlegroups.com

When I use geom_points to overlay the observations over box plots, I often get the following message:

 

Warning message:

Removed 13 rows containing missing values (geom_point).

 

I am interested in seeing the observations over time so the fact that some points are not being plotted is bothersome.

Is there any way I can fix this?  Below is the code and the output.

 

# Rld ggplot code

win.graph(height=8.5, width=11)

p1 <- ggplot(Rld77, aes(HOUR, SCORE))

p1 <- p1 + stat_summary(fun.data = box.stats, geom = "boxplot") + ylim(-0.25,4) +

  geom_jitter(position=position_jitter(width=0.40, height=0.10), size=2) +

  ggtitle("Adhesion Scores by Measurement Event") + xlab("Hour") + ylab("Score")

p1 + annotate("segment",x=5.55,xend=6.45,y=3.78,yend=3.78, size=1.5,lty=1,colour=cbPalette[2]) +

  annotate("segment",x=4.55,xend=5.45,y=3.77,yend=3.77, size=1.5,lty=1,colour=cbPalette[2]) +

  annotate("segment",x=3.55,xend=4.45,y=3.23,yend=3.23, size=1.5,lty=1,colour=cbPalette[2]) +

  annotate("segment",x=2.55,xend=3.45,y=2.29,yend=2.29, size=1.5,lty=1,colour=cbPalette[2]) +

  annotate("segment",x=1.55,xend=2.45,y=1.02,yend=1.02, size=1.5,lty=1,colour=cbPalette[2]) +

  annotate("segment",x=0.55,xend=1.45,y=0.05,yend=0.05, size=1.5,lty=1,colour=cbPalette[2]) +

  annotate("point",x="72",y=3.78,size=3,colour=cbPalette[2]) +

  annotate("point",x="60",y=3.77,size=3,colour=cbPalette[2]) +

  annotate("point",x="48",y=3.23,size=3,colour=cbPalette[2]) +

  annotate("point",x="36",y=2.29,size=3,colour=cbPalette[2]) +

  annotate("point",x="24",y=1.02,size=3,colour=cbPalette[2]) +

 annotate("point",x="12",y=0.05,size=3,colour=cbPalette[2])    

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Vicki Ann Lancaster, Ph.D. | Mathematical Statistician

FDA | Center for Drug Evaluation and Research | Office of Translational Sciences | Office of Biostatistics | DBVIII

10903 New Hampshire Avenue, Bldg. 21, Room 4646, Silver Springs, MD  20852  

Phone:  240.402.3872    

 

To know one's ignorance is the best part of knowledge.

Lao Tzu, The Tao, no. 71

 

 

 

 

 

Roman Luštrik

unread,
Jun 3, 2015, 7:40:44 AM6/3/15
to Lancaster, Vicki, ggp...@googlegroups.com
I found that this usually happens when you have missing values in (some) combination of factors you're trying to plot. Since you have only one factor, I would guess you have some NAs. Would that be the case?


Cheers,
Roman

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.

rajivkk1

unread,
Jun 17, 2015, 12:31:54 PM6/17/15
to ggp...@googlegroups.com, Vicki.L...@fda.hhs.gov
Hi Vicki,

If you use "ylim" in your ggplot, it removes all the data points that are below/above that limit. On the other hand, coord_cartesian just restricts the size of the plot border while keeping the datapoints outside the range present, but just hidden. So try replacing

ylim(-0.25,4)

with

coord_cartesian(ylim = c(-0.25, 4))

and I think you'll see the warning message go away.
Reply all
Reply to author
Forward
0 new messages