[R-sig-Geo] spplot without legend

Roger Bivand Roger.Bivand at nhh.no
Tue Sep 22 18:05:48 CEST 2009


On Tue, 22 Sep 2009, Tom Gottfried wrote:

> Thanks for the hint for the "colorkey" argument!
>
> Is there an equivalent for point data?
> I tried
>
> data(meuse.grid)
> coordinates(meuse.grid) <- ~x+y
> ?xyplot
> spplot(meuse.grid, "dist", auto.key=TRUE)
> spplot(meuse.grid, "dist", auto.key=FALSE)
>
> with no effect.

As a hack:

spplot(meuse.grid, "dist", key=list(lines=TRUE, col="transparent"))

but you're right that argument passing against the run of the function 
authors' intentions isn't easy (lattice graphics really expect a key or 
legend). auto.key= gets passed through but a key gets generated anyway in 
sp:::fill.call.groups(), if a key isn't passed in the dots arguments, in 
which case it is respected. I've added a condition to 
sp:::fill.call.groups() which will be in the next release, so then 
auto.key=FALSE will work. Committed to r-spatial CVS.

Roger

Roger

>
> Thanks,
> Tom
>
> Roger Bivand schrieb:
>> On Tue, 22 Sep 2009, Tom Gottfried wrote:
>>
>>> Hi list,
>>>
>>> is there any way to draw a map with spplot() WITHOUT a legend?
>>
>> library(sp)
>> data(meuse.grid)
>> gridded(meuse.grid)=~x+y
>> spplot(meuse.grid, "dist")
>> library(lattice)
>> ?levelplot
>> spplot(meuse.grid, "dist", colorkey=FALSE)
>>
>>
>>>
>>> By the way: is there any documentation available for the function
>>> mapLegendGrob()? I mean besides the usage and arguments section in the
>>> relevant help page. I'm sorry I can't find it.
>>
>> http://r-spatial.sourceforge.net/gallery/#fig04.R
>> http://www.nceas.ucsb.edu/scicomp/GISSeminar/UseCases/MapProdWithRGraphics/OneMapProdWithRGraphics.html
>>
>>
>> are two examples - the function is for the placing of North arrows and
>> similar items.
>>
>> Roger
>>
>>>
>>> Thanks in advance!
>>>
>>> Tom
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list