[R] adding color bar to a graph
pisicandru at hotmail.com
Thu Aug 6 21:45:26 CEST 2009
I am wondering how i can add a "stretch" color bar / legend to a graph that uses colorBrewer to define the colors in it. I will try to explain my graph, but i also uploaded it at: ftp://ftpext.usgs.gov/pub/er/fl/st.petersburg/Monica_pal/
The file is: robcor_training_pca.pdf - i will also attach this file in case some people accept attachments.
So i took apart the cor.plot function from mvoutlier and i used instead of the scatter plot function the smooth scatter density plot from geneplotter, generating my own function called cordens.plot. Now i would like to add a colorbar on the right side of the graph with red as my highest density and purple as the lowest density and right next to the colors labels "min" for purple and "max" for red (i don't want actual numbers, although i suppose i can deal with that as well if need be).
I've tried image.plot function but i cannot set correctly the colors in the bar since i am not using an "orthodox" rainbow set. Originally my colors in the graph are set with colorRampPalette(c("darkviolet", "deepskyblue4", "green", "yellow", "red")).
Thanks in advance for all the help,
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 733906 bytes
Desc: not available
More information about the R-help