[R-sig-Geo] Logarithmic legend

Paul Hiemstra paul.hiemstra at knmi.nl
Thu Oct 6 10:54:18 CEST 2011


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



More information about the R-sig-Geo mailing list