Hello Kind and Generous Volunteers,

I'm trying to use a scatter plot to visualize three variables: time, radius, 
and intensity. I would like each point on the scatterplot to be colored 
according to a gradient, in which red indicates an intensity less than 1, white 
indicates an intensity of 1, and green indicates an intensity more than 1.

```
#A1 scatter plot

colors <- c("firebrick2", "white", "darkolivegreen3")
class <- classIntervals(A1.matrix[,3], 10) #A1.matrix[,3] is "Intensity"
colorcode <- findColours(class, colors)
plot(A1.matrix[,1], A1.matrix[,2]) #A1.matrix[,1] is "Time" and A1.matrix[,2] 
is "Radius"
points(A1.matrix[,1], A1.matrix[,2], pch = 19, col = colorcode)

```

It is very close to what I am looking for. Firebrick2 and darkolivegreen3 
correspond to the minimum and maximum values in A1.matrix[,3] respectively. But 
white does not correspond to 1. How can I set white equal to 1?


Ideally, the graph would also have a color bar scale to show what the min and 
max values are. I’ve read that findColours returns two attributes for use in 
constructing a legend, but I haven’t been able to find much more information 
than that.

I've had success doing something similar with a levelplot heatmap, using 
at=unique as shown below. However, I just copied that from somewhere online and 
it doesn't seem to work in the points function, I can’t find it using help() or 
google, and I'm not sure how it works or if it could somehow be applied. The 
colorbar scale is automatically part of the graph with levelplot.

```
#A1 heat map

levelplot(nbin.A1, cuts = 50, at= unique(c(seq(A1min,1, length = 100), 
seq(1,A1max, length=100))), col.regions = colorRampPalette(c("firebrick2", 
"white", "darkolivegreen3"))(1e3), xlab = "Radius (Microns)", ylab = "Time")

```

Thank you for reading! Your volunteer work is SO appreciated!!

Best,
Sarah Flaherty

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to