[R] Dont show zero values in line graph
smckinney at bccrc.ca
Fri Jan 7 05:57:03 CET 2011
How about this?
> plot(0,0,xlim=c(0,10), ylim=c(0,10),type="n",main="Dont show the bloody 0 values!!")
> lines(x~y, col="blue", lwd=2, subset = !is.na(x))
NAs let you do lots of useful manipulations in R.
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of LCOG1 [jroll at lcog.org]
Sent: January 6, 2011 7:10 PM
To: r-help at r-project.org
Subject: [R] Dont show zero values in line graph
Im getting better at plotting my data but cant for the life of me figure
out how to show a line graph with missing data that doesnt continue the line
down to zero then back up to the remaining values.
Consider the following
plot(0,0,xlim=c(0,10), ylim=c(0,10),type="n",main="Dont show the bloody 0
lines(x~y, col="blue", lwd=2,)
My data is missing the 6th and 7th values and they come in as NA's so i
change them to 0s but then the plot has these ugly lines that dive toward
the x axis then back up. I would do bar plots but i need to show multiple
sets of data on the same and side by side bars doesnt do it for me.
So i need a line graph that starts and stops where 0s or missing values
View this message in context: http://r.789695.n4.nabble.com/Dont-show-zero-values-in-line-graph-tp3178566p3178566.html
Sent from the R help mailing list archive at Nabble.com.
R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help