Jason Rupert
2009-Sep-12 00:12 UTC
[R] Way to iteratively change line color and line style
I would like to have a way to automatically change the line color and line style. Below is an example of the items I am plotting. I've contemplated coming up with a list of desired colors and styles, but I am hoping there is an automated way for this to be accomplished as the number of lines I will be adding to a plot will be changing over time. Thanks again for any insights and feedback. plot(1,1, xlim=c(1000,4000), ylim=c(100000,800000), col=0, xlab=c("Sq. Footage"), ylab=c("Cost ($)")) square_footage_values<-c(1000:4000) initial_val<-300 cost_per_square_footage_vals<-seq(from=100, to=200, by=10) for(ii in 1:length(cost_per_square_footage_vals)) { lines(square_footage_values, cost_per_square_footage_vals[ii]*square_footage_values) }
Steve Lianoglou
2009-Sep-14 00:47 UTC
[R] Way to iteratively change line color and line style
Hi, On Fri, Sep 11, 2009 at 8:12 PM, Jason Rupert <jasonkrupert at yahoo.com> wrote:> I would like to have a way to automatically change the line color and line style.For auto-generating colors, try ?rainbow Not sure about what you can do about alternating the line style ... -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact