[R-sig-Geo] filled.contour and legend height control

Paul Hiemstra p.hiemstra at geo.uu.nl
Tue Jul 7 14:57:10 CEST 2009


Hi Patrick,

Thanks for the code! My suggestion would be to use spplot instead of 
filled.contour, this function is really made to display spatial data. It 
works for grids, points and polygons and makes it really easy to combine 
those in one plot. You need to put your data into the spatial R classes 
provided by the sp-package. See:

http://wiki.r-project.org/rwiki/doku.php?id=tips:spatial-data:spatial_data_visualization

some tips on how to visualize data using spplot.

cheers,
Paul

Patrick Giraudoux wrote:
> Paul Hiemstra a écrit :
>> Patrick Giraudoux wrote:
>>> Hello,
>>>
>>> Filled contour is a really nice function, except when one use the 
>>> argument asp=1. In this case the legend height can be too large 
>>> compared to the image plot height.
>>>
>>> Is there a way to control the legend height in filled.contour (eg 
>>> fixing somewhere a ylim=c(min value, max value) to make it the same 
>>> height as the image in the big plot) ?
>>>
>>> Best,
>>>
>>> Patrick
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> Hi,
>>
>> Could you provide use with a piece of code that reproduces your 
>> problem. That would make it much easier to help you.
>>
>> cheers,
>> Paul
>>
>
> Yes indeed. Here we are:
>
> # example without asp
>
> x<-seq(1,10,l=20)
> y<-seq(1,5,l=20)
> z<-rnorm(400)
> zmat<-matrix(z,ncol=20)
> filled.contour(x,y,zmat,frame.plot = FALSE)
>
> # example with asp (eg: a geographic map projected where x and y 
> display ratio must be 1
>
> x<-seq(1,10,l=20)
> y<-seq(1,5,l=20)
> z<-rnorm(400)
> zmat<-matrix(z,ncol=20)
> filled.contour(x,y,zmat,frame.plot = FALSE,asp=1)
>
> I wonder if there is a way to resize the legend in such a way it as 
> the same height as the image displayed...
>
> Best,
>
> Patrick


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul



More information about the R-sig-Geo mailing list