cartoframes
cartoframes copied to clipboard
Add back legend subtypes
For discussion @elenatorro @Jesus89
Previously, we gave users the option to use legend subtypes and with the new refactor, that option no longer is available.
I think this is really useful for different map types, and gives users the same flexibility as they had before and is in the same category as allowing a user to use a different legend type completely (for example, using a color_continuous legend with a color_bins style).
Here is an example we can discuss where we are looking at continuous point data and where something like the color_continuous_polygon
legend would provide a better representation of the continuous data:

That is similar to what I did in this map (when we still had subtypes available):
Since a user will already be working inside of the legend, I think we can add a parameter like type
to define which legend subtype they want to use:
Layer(
'temps',
color_continuous_style('value'),
legends=color_continuous_legend(
type='polygon',
title='Trees in San Francisco',
description='Top 3 species',
footer='Data: City of SF'
)
)
related: https://github.com/CartoDB/cartoframes/issues/1444
I like this idea of being able to change the legend type 👍
On one hand, I'd use a different way of identifying the legend type, cause in this case I think it's confusing to use a 'polygon' legend type in a point layer.
On the other hand, I know that this is what we're using as a layer type in Airship, and I don't know if we should keep using the same pattern for 'consistency'
@elenatorro good point! i'll do some looking around and think about different descriptive words for legends that isn't tied to geometry