Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
FIX: use locators in adjust_bbox#25499
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -546,13 +546,24 @@ def test_savefig_pixel_ratio(backend): | ||
assert ratio1 == ratio2 | ||
def test_savefig_preserve_layout_engine(): | ||
fig = plt.figure(layout='compressed') | ||
fig.savefig(io.BytesIO(), bbox_inches='tight') | ||
assert fig.get_layout_engine()._compress | ||
def test_savefig_locate_colorbar(): | ||
fig, ax = plt.subplots() | ||
pc = ax.pcolormesh(np.random.randn(2, 2)) | ||
cbar = fig.colorbar(pc, aspect=40) | ||
fig.savefig(io.BytesIO(), bbox_inches=mpl.transforms.Bbox([[0, 0], [4, 4]])) | ||
# Check that an aspect ratio has been applied. | ||
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. Are you able to assert against the aspect ratio too? MemberAuthor 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. I couldn't figure out how to check the aspect ratio directly. 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. I didn't know either, I just figured since it was the aspect that was wrong that is better to test against, so figured I would ask if you tried :) but colorbars are never straightforward and there is still an open issue with the get/set aspect on them.#22103 Although here it could also be that the aspect is only changed in the setattr context manager while saving the figure, so you don't get it except while in that context manager? This still looks good to me! | ||
assert (cbar.ax.get_position(original=True).bounds != | ||
cbar.ax.get_position(original=False).bounds) | ||
@mpl.rc_context({"savefig.transparent": True}) | ||
@check_figures_equal(extensions=["png"]) | ||
def test_savefig_transparent(fig_test, fig_ref): | ||