Message-ID: <20111014132720.0fd89128@OPL-EUITI>
Date: 2011-10-14T11:27:20Z
From: Oscar PerpiƱan
Subject: Logarithmic legend
In-Reply-To: <4E8D6CBA.8010709@knmi.nl>
Hello,
I have been working on a suitable approach with lattice and raster. Now
you can use levelplot with a logarithmic scale both for the colorkey and
the contour lines.
First you have to install the 0.10-6 version of rasterVis from R-Forge:
install.packages("rasterVis", repos="http://R-Forge.R-project.org")
library(raster)
library(rasterVis) ## 0.10-6
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
levelplot(r, zscaleLog=10, contour=TRUE, labels=TRUE)
Still in development!
Cheers,
Oscar.
-------------------
Oscar Perpi??n Lamigueiro
Dpto. Ingenier?a El?ctrica
EUITI-UPM
http://procomun.wordpress.com
-----------------------------------------
>Hi,
>
>You could use ggplot:
>
>library(gstat)
>library(ggplot2)
>loadMeuse()
>
>meuse.grid.df = as.data.frame(meuse.grid)
>head(meuse.grid.df)
>
># Create a dist + 1 for log transformation
># prevents -Inf for 0 values
>meuse.grid.df$dist_plus1 = meuse.grid.df$dist + 1
>
>ggplot(aes(x = x, y = y, fill = dist_plus1), data = meuse.grid.df) +
>geom_tile() +
> coord_equal() + scale_fill_continuous(trans="log")
>
># Some theme changes I like
>theme_set(theme_bw())
>ggplot(aes(x = x, y = y, fill = dist_plus1), data = meuse.grid.df) +
>geom_tile() +
> coord_equal() + scale_fill_continuous(trans="log")
>
>hope this helps,
>Paul
>
>On 10/05/2011 06:21 PM, Arnaud Mosnier wrote:
>> Dear Geo Users,
>>
>> Please, can someone explain me how to plot a raster using a
>> logarithmic scale and obtaining the legend with this scale ?
>>
>> Thanks for any help,
>>
>> Arnaud
>>
>> [[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
>
>
>--
>Paul Hiemstra, Ph.D.
>Global Climate Division
>Royal Netherlands Meteorological Institute (KNMI)
>Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
>P.O. Box 201 | 3730 AE | De Bilt
>tel: +31 30 2206 494
>
>http://intamap.geo.uu.nl/~paul
>http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770