Hi all, I am new to R, but with the help I have received thus,I have already been able to work through a bunch of questions on my own in just a few days. I imagine my questions are relatively simple, but here she goes. 1) I am using a package where one of the objects generated represents X/Y coordinates for each observation. I have been able to plot my row names onto the graph using text() (with the help of this list), but because it is entirely possible for some rows to have the same X/Y coordinates, I need to separate the data labels so that I can clearly see each. I tried text(jitter(coordinates), labels = abbreviate(rownames(dataset), minlength=3)), but it appears that jitter effect is the same for each x/y pair and not unique to each row. 2) I want to vary the color palette. In the package help, it discusses the ability to change it, but never mentions anything about what my options are, other than showing "rainbow" in the documentation. I tried to use one from RColorBrewer, but the package does not appear recognize it. How can I find out what palettes exist and, if possible, how can I create my own? The palette I wanted was diverging Greys from RColorBrewer I have made the assumption that the package I am using doesn't matter, but I am using the kohonen package in case that matters. Any help you can provide will be greatly appreciated! - Brock
On 12/01/2009 01:56 PM, Brock Tibert wrote:> Hi all, > > I am new to R, but with the help I have received thus,I have already been able to work through a bunch of questions on my own in just a few days. I imagine my questions are relatively simple, but here she goes. > > 1) I am using a package where one of the objects generated represents X/Y coordinates for each observation. I have been able to plot my row names onto the graph using text() (with the help of this list), but because it is entirely possible for some rows to have the same X/Y coordinates, I need to separate the data labels so that I can clearly see each. > > I tried text(jitter(coordinates), labels = abbreviate(rownames(dataset), minlength=3)), but it appears that jitter effect is the same for each x/y pair and not unique to each row. > >Hi Brock, You have just found another use for the "spreadout" function in the plotrix package: plot(1:10,type="n") labels<-c("one","two","three","four","five","six", "seven","eight","nine","ten") xpos<-c(2,2,4,4,6,6,8,8,9,9) ypos<-c(2,2,4,4,6,6,8,8,9,9) library(plotrix) text(xpos,spreadout(ypos,0.3),labels) Jim