# Can R plot multicolor lines?

3 messages
Open this post in threaded view
|
Report Content as Inappropriate

## Can R plot multicolor lines?

 I have a number of continuous data series I'd like to plot with the first 2/3 or so of each plotted in one color with the last 1/3 plotted in another color. I've thought of plotting 2 lines that abut each other by determining where the first portion ends and attach the second portion. Is there a simpler way that i have not thought of or discovered through the mailing list, Intro to R, or Lattice PDF? Thanks Paul ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Can R plot multicolor lines?

 Hi one way is to use segments  x<-rnorm(200) plot(1:200, x, type="n") segments(1:199,x[1:199], 2:200, x[2:200], col=c(rep(1,150), rep(2,50))) HTH Petr On 6 Jan 2006 at 12:28, Paul DeBruicker wrote: Date sent:       Fri, 6 Jan 2006 12:28:36 -0500 From:           Paul DeBruicker <[hidden email]> To:             [hidden email] Subject:         [R] Can R plot multicolor lines? > I have a number of continuous data series I'd like to plot with the > first 2/3 or so of each plotted in one color with the last 1/3 plotted > in another color. > > I've thought of plotting 2 lines that abut each other by determining > where the first portion ends and attach the second portion. > > > Is there a simpler way that i have not thought of or discovered > through the mailing list, Intro to R, or Lattice PDF? > > Thanks > Paul > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.htmlPetr Pikal [hidden email] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html