-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Strange behavior of extended contourf colors in a figure with multiple axes #13038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you please post a full minimal example, including code and the resulting figure? |
Right, here is a minimal working example that replicates the logic of what I'm doing and produces the apparent bug:
You can easily check that switching to plot_1 results in out of range values on the first set of axes being properly colored in red/blue. Commenting out the colorbar lines removes red/blue colors from both sets of axes. |
There is, however, an ugly workaround - adding a phantom colorbar for each set of axes, by inserting the following line,
|
Reason / SolutionThe
Therefore, please add The partial update happens because you add a colorbar to |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
I think this was addressed by the documentation update at #13047. |
I am creating a figure with 6 filled contour plots and a color bar (so, 7 axes total). The function creating the figure loops over a list of variable pairs and arranges the axes in 3x2 pattern with colorbar at the bottom, with a call to figure.colorbar at the end taking the last contourf call's output as leading input.
The problem - all out-of-range colors appear to be colored in as the "adjacent" color in the colorbar, except for the very last contourf plot, which seems to work as expected. But, commenting out the line that creates the colorbar results in the last plot also being broken (no "extended" colors).
All of the calls to contourf (inside of the loop) look like this; the levels and corresponding colors are fixed
plot = axes.contourf(aggregates_xs, aggregates_ys, aggregates_zs, color_levels, colors = color_values, extend = 'both'
plot.cmap.set_over('red')
plot.cmap.set_under('blue')
matplotlib version 3.0.2 (same behavior in 2.0.2, but I didn't guess to try removing the colorbar before updating)
The text was updated successfully, but these errors were encountered: