Set color key for stplot
Hi Katherine
Yes, it looks like it is lattice plot functions.
I have an example where I wantes to plot the sea as blue and the land according to terrain.colors()
Here is my call to levelplot:
levelplot( Z ~ X + Y, data = xyz, labels = FALSE, aspect = "iso", contour = FALSE,
cuts = 16, , at = c(-Inf,do.breaks(range(xyz$Z), 15)),
col.regions = c("#0000FFFF", terrain.colors(15)),
subset = X > 370000 & X < 380000 & Y > 670000 & Y < 680000)
and a png is attached.
As you can see you need to combine the cuts and col.regions argument to do what you want.
Yours sincerely / Med venlig hilsen
Frede Aakmann T?gersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling
Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com
http://www.vestas.com
Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender.
-----Original Message-----
From: r-sig-geo-bounces at r-project.org [mailto:r-sig-geo-bounces at r-
project.org] On Behalf Of Katharine Walter
Sent: 14. maj 2014 18:53
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] Set color key for stplot
Hi,
Is there a way to use a color ramp when using stplot and simultaneously
assign a specific color for a single value? For example, I am trying to
plot disease cases and would like 0s to be plotted as grey and the rest of
the cases to be colored by a color ramp.
#this plots cases including 0s as a color ramp:
stplot(stfdf[,,"lyme_cases"], t, col.regions = brewer.pal(9, "YlOrRd"),
cuts=9 )[28]
cuts=c(1,seq(20,160,by=20), 186)
I have tried defining cuts so that any polygon with less than 1 case is
colored grey, but this does not work and instead plots any polygon with <20
cases as grey.
stplot(stfdf[,,"lyme_cases"], t, col.regions = c("grey", brewer.pal(9,
"YlOrRd")), cuts=c(0.1,seq(20,160,by=20), 186) )[28]
Thank you very much for your help!
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-------------- next part -------------- A non-text attachment was scrubbed... Name: seaANDland.png Type: image/png Size: 6981 bytes Desc: seaANDland.png URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140514/8ce17b12/attachment.png>