[R] Way to iteratively change line color and line style
Jason Rupert
jasonkrupert at yahoo.com
Sat Sep 12 02:12:16 CEST 2009
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)
}
More information about the R-help
mailing list