cartoframes icon indicating copy to clipboard operation
cartoframes copied to clipboard

Add back legend subtypes

Open makella opened this issue 5 years ago • 3 comments

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:

Screen Shot 2020-01-06 at 2 46 00 PM

That is similar to what I did in this map (when we still had subtypes available): Screen Shot 2019-12-23 at 1 36 55 PM

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'
    )
)

makella avatar Jan 06 '20 21:01 makella

related: https://github.com/CartoDB/cartoframes/issues/1444

makella avatar Jan 06 '20 22:01 makella

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 avatar Jan 07 '20 08:01 elenatorro

@elenatorro good point! i'll do some looking around and think about different descriptive words for legends that isn't tied to geometry

makella avatar Jan 07 '20 15:01 makella