Closed richardsc closed 11 years ago
The source code you've given produces an error for me:
Error in dim(z) : 'z' is missing
Ooops, try this:
library(oce)
data(coastlineWorld)
data(topoWorld)
lon <- topoWorld[['longitude']]
lat <- topoWorld[['latitude']]
z <- topoWorld[['z']]
x11() ## the plotting is *very* slow, especially on a quartz device
mapPlot(coastlineWorld)
mapImage(lon, lat, z)
I just pushed a develop
commit that can take a topo object as first arg. Now looking at the actual bug.
Pushed another commit that speeds up by 33%, but still has this bug.
The horizontal-line problem is now fixed in the develop
branch.
I'll now look at the problem of drawing the whole dataset. Normally, we rely on R for clipping to a box, but in this case we should be able to speed things up, because if all vertices in a polygon are outside par('usr')
then we can skip it...
Speeded up for sub-domains, as in test code:
library(oce)
data(coastlineWorld)
data(topoWorld)
x11() ## the plotting is *very* slow, especially on a quartz device
mapPlot(coastlineWorld, latitudelim=c(45,50), longitudelim=c(-70,-50), projection='polyconic',orientation=c(90,-60,0))
mapImage(topoWorld)
@richardsc -- please close if this seems OK to you. Thanks!
PS: it's still not terribly fast on sub-domains, but the problem is that mapproject() has to be called on every patch, before we can know whether to draw it.
Thanks, looks good!
Yes, it is still kind of slow (more so when the sub-domain spans the prime meridian), but works as expected and looks pretty good.
Now, how about some other options consistent with imagep
, including colormaps etc?! :)
I wonder if you could put in an issue for color maps? That way, we have good granularity for changes. Thanks!
I know
mapImage
is still pretty experimental, but maybe this can be motivation to get it fine tuned. I just tried using it to plot thetopoWorld
dataset, and it chokes in all instances. It seems to have something to do with wrapping past longitude 180, whether or not that meridian is in the plot. Some example code:A related issue is that it seems to have to draw the entire dataset, regardless of whether it's all in the range, which makes it very slow to plot.