-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: remove colorbar from list of colorbars on axes #20980
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,7 +221,7 @@ def test_colorbar_single_scatter(): | |
ids=['no gridspec', 'with gridspec']) | ||
def test_remove_from_figure(use_gridspec): | ||
""" | ||
Test `remove_from_figure` with the specified ``use_gridspec`` setting | ||
Test `remove` with the specified ``use_gridspec`` setting | ||
""" | ||
fig, ax = plt.subplots() | ||
sc = ax.scatter([1, 2], [3, 4], cmap="spring") | ||
|
@@ -235,6 +235,23 @@ def test_remove_from_figure(use_gridspec): | |
assert (pre_position.get_points() == post_position.get_points()).all() | ||
|
||
|
||
def test_remove_from_figure_cl(): | ||
""" | ||
Test `remove` with constrained_layout | ||
""" | ||
fig, ax = plt.subplots(constrained_layout=True) | ||
sc = ax.scatter([1, 2], [3, 4], cmap="spring") | ||
sc.set_array(np.array([5, 6])) | ||
fig.draw_without_rendering() | ||
pre_position = ax.get_position() | ||
cb = fig.colorbar(sc) | ||
cb.remove() | ||
fig.draw_without_rendering() | ||
post_position = ax.get_position() | ||
np.testing.assert_allclose(pre_position.get_points(), | ||
post_position.get_points()) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly add an assert that cb.ax isn't in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that we don't usually check private attributes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
|
||
def test_colorbarbase(): | ||
# smoke test from #3805 | ||
ax = plt.gca() | ||
|
Uh oh!
There was an error while loading. Please reload this page.