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
Often, when you crop existing categorical raster data, the new object does not contain all of the original categories. This could be a problem when plotting the raster using some custom palettes and labels. Custom palettes still could be used in this situation by setting the raster values as names of the palette vector. However, the same operation does not work for labels. You can see some examples below, for data with values between 1 and 7 with 5 missing.
# wrong labels for 6 and 7
tm_shape(lc) +
tm_raster(style="cat", palette=lc_palette_df$color,
labels=lc_palette_df$label)
# the fix for colors does not work for labelsmy_label=lc_palette_df$label
names(my_label) =lc_palette_df$value
tm_shape(lc) +
tm_raster(style="cat", palette=my_color,
labels=my_label)
Often, when you crop existing categorical raster data, the new object does not contain all of the original categories. This could be a problem when plotting the raster using some custom palettes and labels. Custom palettes still could be used in this situation by setting the raster values as names of the palette vector. However, the same operation does not work for labels. You can see some examples below, for data with values between 1 and 7 with 5 missing.
tmc.zip
CC: @blakos1
The text was updated successfully, but these errors were encountered: