You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# With na.value = NA extra cells are filledp_raster+
scale_fill_viridis_c(na.value=NA)
#> Warning: Removed 16 rows containing missing values (`geom_raster()`).
# Not happening with geom_tile
ggplot(ex, aes(x, y)) +
geom_tile(aes(fill=ExampleMap2)) +
coord_equal() +
scale_fill_viridis_c(na.value=NA)
Is this the same as #3025?
In any case, I think this particular example may also be solved by setting na.value = "transparent".
The fill is a non-missing aesthetic in geom_raster(), meaning that rows that have NA fills will be removed. Subsequently, there are too few cells to reconstruct the resolution of the data.
dieghernan
changed the title
Different behaviour of scales param na.value = NA in geom_tile() and `geom_raster()
Different behaviour of scales param na.value = NA in geom_tile() and geom_raster()Nov 15, 2023
HI:
Following an issue on
tidyterra
(dieghernan/tidyterra#120, see also https://stackoverflow.com/questions/77474839/ggplot-of-raster-maps-horizontal-vertical-grid-cells-distortion/77486091#77486091) I think the root cause may be on howggplot2
handles the paramna.value = NA
ongeom_raster()
(note thatgeom_spatraster()
is leveraging on thisggplot2
function). See the different behaviour compared withgeom_tile()
:Created on 2023-11-15 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: