Skip to content

Strange behavior from colorNumeric & colorFactor clipping raster values (setting as NA?). #224

@SimonGoring

Description

@SimonGoring

I am using leaflet to represent some spatial data (historical tree species distributions - see preprint here for more information) as part of a bigger shiny app. The branch I'm working on "leaflet" contains the code.

There's lots to the code, but of note is that both colorNumeric and colorFactor (around line 154 in server.R) are exhibiting some strange behavior. Both appear to be returning:

Warning in colors(.) :
  Some values were outside the color scale and will be treated as NA

even when I've tried to set the ranges to be greater than (or equal to) the range of the data. I don't think it's a problem on my end, since the clipping is happening in very particular places. In a strange geometric pattern for colorNumeric (see figure below) and at the boundaries between discrete levels for colorFactor.

Any help would be appreciated.
leaflet_colornumeric
The colorNumeric clipping.

leaflet_colorfactor
The colorFactor clipping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions