Palette feature request
Opened this issue · 0 comments
andy-esch commented
Sometimes its important to associate a palette with specific values. This can be done with color_category_style
but it feels laborious:
palette = {
"Residential": "blue",
"Commercial": "yellow",
"BPP,Commercial": "orange",
"BPP,Residential": "purple",
"BPP,Commercial,Residential": "white",
"Commercial,Residential": "green",
"BPP": "red",
}
Layer(
polys,
color_category_style(
"usedesc", palette=list(palette.values()), cat=list(palette.keys())
),
)
It'd be really nice if we could directly pass in palette
to the palette
argument like so:
Layer(
polys,
color_category_style("usedesc", palette=palette),
)
This is more inline with what seaborn and other libraries do:
Besides this, I've had issues with passing different iterables into the palette
and cat
kwargs above. I had to cast them to list
for it to work. Extracting the keys and values from the dictionary (palette.keys()
and palette.values()
) gave me the following errors after passed them in:
IMO most iterables should work as arguments here (excluding str
type)