[R] Can R plot multicolor lines?

justin bem justin_bem at yahoo.fr
Fri Jan 6 19:23:39 CET 2006


Try this if you have sort data in ascending order

part1x<-x[1:round(2/3*length,digits=0)]
part2x<-x[round(2/3*length,digits=0)+1:length(x)]
part1y<-y[1:round(2/3*length,digits=0)]
part2y<-y[round(2/3*length,digits=0)+1:length(x)]

after plot
points(part1x,part1y,col="col1",type="l")
points(part2x,part2y,col="col2",type="l")


--- Paul DeBruicker <pdebruic at gmail.com> a écrit :

> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list