plotKML coerce levels ?
Thanks Tom, That is correct. If you use the "cut" command to convert to factors and then assign the labels, then you can assign any colours you like following the example from the plotKML tutorial: > data(worldgrids_pal) > pal = as.character(worldgrids_pal["corine2k"][[1]][c(1,11,13,14,16,17,18)]) > plotKML(eberg_grid["LNCCOR6"], colour_scale=pal) http://gsif.isric.org/lib/exe/detail.php?id=wiki%3Atutorial_plotkml&media=wiki:plot_factorvar.png T. Hengl http://www.wageningenur.nl/en/Persons/dr.-T-Tom-Hengl.htm
On 6-8-2013 20:14, Tom Philippi wrote:
Florence--
I might misunderstand your question, but I think that your problem is the
type in your SpatialPixelsDataFrame, not your call to plotKML. From what
you describe, I assume that the values in your SpatialPixelsDataFrame are
numeric. If you want a specific color legend, you need to use a factor
instead of a numeric.
If your values in the SpatialPixelsDataFrame take exactly
{2,4,10,30,60,100}, you may need to convert the values from numeric to a
factor with factor(). If your values are numeric but take any value (e.g.,
from 0 to 100), you may want to convert it to a factor using cut() with
c(0,2,4,10,30,60,100).
I hope that this helps and points you in the right direction.
Tom
On Tue, Aug 6, 2013 at 8:48 AM, TROUDE Florence
<FTroude at air-rhonealpes.fr>wrote:
Dear list,
I use the plotKML library to plot maps of simulation results (pollen maps).
It's quite great but I'd like to have some colors at some defined levels
such as :
2 -> white
4 -> green
10 -> yellow
30 -> orange
60 -> red
100 -> black
my object is a SpatialPixelsdataframe or a SpatialGriddataframe.
When I use plotKML with for instance data range from 0 to 10, I don't
menage to coerce the levels/colors of the map :
the color_scale always fit to the min/max of the data and don't fellow the
levels (2,4,10,30,60,100)...
I have tried colour_scale, colour, levels options but it doesn't work.
Does anyone have encountered the same problem and fixed it ?
Regards,
Florence
[[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
[[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