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
Coloring the bars in the bar chart based on some value isn't uncommon (#23265, #26310) and colors=cmap(norm(values)) is serviceable but it'd be nice if folks could directly set the cmap, norm, and data separately-especially for legend and colorbar creation.
Proposed solution
While it has it's problems, scatter has an API for how to manage colormap/norm or colors for discrete markers, so I think it would stay consistent if the scatter API for colors could be ported to bars. Could then probably adapt scatter.legend_elements implementation to auto generate legends from the colors.
ETA: If we did this, it'd probably also be a good reason to implement #7383
The text was updated successfully, but these errors were encountered:
While it is not strictly necessary, I think this would be conceptually related to moving bar() to return a single PathCollection (#22976), which is a fair bit of work but which I now think could be done in a way similar to the ContourSet transition recently merged (#25247).
is enough. (Apart from the question whether one should do this at all).
Continous color coding:
e.g.
This needs a colorbar as reference and is the only case possibly warranting an extension of our API. Be aware though that bars have color, edgecolor and ecolor (errorbars). And that we need a conscious decision how to handle them (likely only provide colormapping for the face color).
I think this would be conceptually related to moving bar() to return a single PathCollection
rather replace BarContainer.patches (currently list of Rectangle) by a collection. (t.b.d. wether a general PathCollection is suitable or whether a dedicated RectangleCollection is justified.
Problem
Coloring the bars in the bar chart based on some value isn't uncommon (#23265, #26310) and
colors=cmap(norm(values))
is serviceable but it'd be nice if folks could directly set the cmap, norm, and data separately-especially for legend and colorbar creation.Proposed solution
While it has it's problems, scatter has an API for how to manage colormap/norm or colors for discrete markers, so I think it would stay consistent if the scatter API for colors could be ported to bars. Could then probably adapt scatter.legend_elements implementation to auto generate legends from the colors.
ETA: If we did this, it'd probably also be a good reason to implement #7383
The text was updated successfully, but these errors were encountered: