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
{{ message }}
Repository navigation
Be able to order legend items when using GroupBy Legend [FEATURE] #9135
@bokeh/dev what do you think about deprecating legend kwarg for glyph methods (it is a little too magic in some ways) and having some more explicit (mutually exclusive) options:
legend_label="foo" always creates a single legend item and always with that text as a label
legend_field="foo" sets a "field" for client-side grouping on column "foo" in BokehJS
legend_group="foo" does a Python side grouping on column "foo" and creates multiple legend items with appropriate indices values
For the last I think there should be API for it so the items could easily be updated in a Bokeh server app callback. But the main point is that there are definitely cases when it's preferable to do the grouping in python, and that's currently very hard. And there are cases when people don't want grouping in JS but they get it when it's not expected. So this idea would be to disentangle all those cases more clearly.
To be clear I would leave legend in place for a long time (with a warning message). Also maybe there is better names. The cases I'd like to distinguish:
just a label, as-is
group on the JS side
group on the Python side
Reacted by Mateusz Paprocki and Arturo Moncada-Torres
This seems great. Obviously a long deprecation cycle for legend kwarg, but yes, the ability to be more specific seems very appropriate and your API suggestions seem intuitive and compact. That said, I haven't done a lot of legend work in a while and don't feel like I have a deep feeling for the API currently.
Activity
bryevdv commentedon Aug 3, 2019
@bokeh/dev what do you think about deprecating
legendkwarg for glyph methods (it is a little too magic in some ways) and having some more explicit (mutually exclusive) options:legend_label="foo"always creates a single legend item and always with that text as a labellegend_field="foo"sets a "field" for client-side grouping on column "foo" in BokehJSlegend_group="foo"does a Python side grouping on column "foo" and creates multiple legend items with appropriate indices valuesFor the last I think there should be API for it so the items could easily be updated in a Bokeh server app callback. But the main point is that there are definitely cases when it's preferable to do the grouping in python, and that's currently very hard. And there are cases when people don't want grouping in JS but they get it when it's not expected. So this idea would be to disentangle all those cases more clearly.
To be clear I would leave
legendin place for a long time (with a warning message). Also maybe there is better names. The cases I'd like to distinguish:birdsarah commentedon Aug 6, 2019
This seems great. Obviously a long deprecation cycle for
legendkwarg, but yes, the ability to be more specific seems very appropriate and your API suggestions seem intuitive and compact. That said, I haven't done a lot of legend work in a while and don't feel like I have a deep feeling for the API currently.github-actions commentedon Oct 27, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.