raster icon indicating copy to clipboard operation
raster copied to clipboard

filledContour does not work with plot.axes arguments

Open brotherJ4mes opened this issue 3 years ago • 0 comments

The help page for filledContour states that it can take "Any argument that can be passed to filled.contour (graphics package)" However, I'm finding that it does not respect several arguments, including the plot.axes argument.

For example, in the case of trying to overlay contour lines on a filled contour plot, using graphics::filled.contour works as desired

filled.contour(volcano, plot.axes={contour(volcano, add=T)})

whereas, if I try to create a simple raster from volcano and try to use the raster analog method to overlay the lines:

ras_volc <- raster(volcano)
raster::filledContour(ras_volc, plot.axes={contour(ras_volc, add=T)})

No lines are overlaid. Additionally, I've found that some other arguments like key.title will work for graphics::filled.contour but not for raster::filledContour.

There are certainly other ways to achieve the desired result but the filledContour graphic looks the best in my opinion and it seems that it should be straight forward to do it this way ;)

If anyone can provide any insight into this issue would be greatly appreciated.

Note: If I plot a much larger raster this way to an X11 window, I can see the contour lines being drawn first for a fraction of a second but then the entire image is replaced with the filledContour plot, so it appears that it's trying to parse the plot.axes argument but it's not working the way it does with graphics::filled.contour

brotherJ4mes avatar Mar 04 '22 20:03 brotherJ4mes