Skip to content

Raster legend not updated if specifying manual breaks #282

@lbusett

Description

@lbusett

Hi,

on current mapview@develop, the raster legend is apparently not properly updated when manually specifying breaks. For example:

library(raster)
library(mapview)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
pal <- grDevices::colorRampPalette(RColorBrewer::brewer.pal(5, "RdYlGn"))
mapview(r, col.regions= pal)

gives:

image

, but if we manually specify breaks, the map is modified, but the legend is no longer "correct":

brks <- classInt::classIntervals(1:10000,
                                 style = "fixed",
                                 fixedBreaks = seq(0,10000,500),
                                 intervalClosure = "right")
mapview(r, col.regions= pal, at = brks$brks)

image

I may be wrong, but I think previous mapview behaviour was different, and the legend followed the specified "breaks". Am I wrong?

HTH,

Lorenzo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions