On 05/03/2011 04:26 AM, Paul Davison wrote:
Hi. I need a very short piece of help regarding colouring segments plotted
on a graph.
When I am plotting segments for the graph, I am using "red" and "darkgreen
for the values "1" and "2" respectively. Heres the relevant line of code in
R:
Hi Paul,
Try this simple bit of code and see if it contains the elements you need
to solve the problem.
# grab a bunch of easily distinguishable colors
linecolors<-col2rgb(c(1:6,"#8888dd","brown","orange","pink"))
# make an empty plot
plot(0:10,type="n")
# plot segments with the colors
segments(1:10,0:9,2:11,1:10,col=linecolors)
# stick some points on to better see the colors
points(1:10,0:9,pch=19,col=linecolors)
Jim
______________________________________________
R-help@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.