I would like the labels and colours for the categorical raster object afrilandcover to be stored in the object so that it is easy for new users to be able to plot them.
The current sub-optimal solution enables this to work in mapview but similar seems not to work in tmap
I would like the labels and colours for the categorical raster object
afrilandcover
to be stored in the object so that it is easy for new users to be able to plot them.The current sub-optimal solution enables this to work in
mapview
but similar seems not to work intmap
mapview(afrilandcover, att="landcover", col.regions=levels(afrilandcover)[[1]]$colour)
Here is my unfinished experimentation including trying
stars
&terra
. Ideally I'd like to usestars
.https://github.com/afrimapr/afrilearndata/blob/d8510ed4a732418c4cf1a385867604d341528ad0/data-raw/afrilearndata-data-creation.R#L456
If anyone has a good solution for this I'd be very grateful.