[R] overlaying a levelplot on a map plot
Peter Ehlers
ehlers at ucalgary.ca
Wed Apr 21 21:33:44 CEST 2010
Try using contour() instead of levelplot. See the examples
in help('contour') for how to add contour lines to an
existing plot.
-Peter Ehlers
On 2010-04-21 13:08, David Winsemius wrote:
>
> On Apr 21, 2010, at 2:27 PM, Simon Goodman wrote:
>
>>
>> I've generated a levelplot showing the density distribution of a species
>> derived from survey transects, with lon, lat co-ordinates.
>>
>> I'd like to overlay this on a map of the study region specified by:
>>
>> map('worldHires', xlim = range(mlon), ylim = range(mlat)), where mlon,
>> mlat
>> specifies the study region.
>
> > ?map
> No documentation for 'map' in specified packages and libraries:
> you could try '??map'
> > ??map
> > require(maps)
> Loading required package: maps
> > map
>
> So map uses base graphics.
>
>
>> I've tried plotting the map first, then using the options: 'add=TRUE,
>> axes=FALSE' in the levelplot,
>
>
> levelplot is a lattice function. You will have failure with most efforts
> to mix base and grid graphics.
>
>
>
>
>> but this doesn't work - a new plot is
>> generated for the level plot despite the 'add' option. If I try to add
>> the
>> map on top of the level plot, they are not to the same scale.
>>
>> Any suggestions on how to get round this.
>>
>> Thanks
>>
>> --
>> View this message in context:
>> http://n4.nabble.com/overlaying-a-levelplot-on-a-map-plot-tp2019419p2019419.html
>>
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Peter Ehlers
University of Calgary
More information about the R-help
mailing list