[R] plot only non-zero values

Joshua Wiley jwiley.psych at gmail.com
Sat Mar 17 10:19:41 CET 2012


What about just setting them to missing and plotting?

md <- yourdata
md[md==0] <- NA

My other idea depending how you want the plot to look would be to try something where 0 values get a blank colour or null plotting value 

On Mar 16, 2012, at 22:53, Noah Silverman <noahsilverman at ucla.edu> wrote:

> Hi,
> 
> i have some data in a matrix.  It has zero values scattered throughout, at random.
> 
> I'd like to create a line plot, with a line for each row, that *excludes* the zero or NA values.
> 
> The data looks like this (toy example)
> 
> 10 12 21 0 23 0 43 0 NA 41
> 0 0 0 34 35 0 35 0 44 0
> NA NA NA 3 2 5 0 3 2
> etc...
> 
> Suggestions on an easy way to do this?
> 
> Thanks!
> 
> --
> Noah Silverman
> UCLA Department of Statistics
> 8208 Math Sciences Building
> Los Angeles, CA 90095
> 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> 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 mailing list