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 Update Axes limits from Axes.add_collection(... autolim=True)#30327
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
base:main
Are you sure you want to change the base?
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 |
---|---|---|
@@ -899,17 +899,23 @@ def test_collection_set_array(): | ||
def test_blended_collection_autolim(): | ||
f, ax = plt.subplots() | ||
# sample data to give initial data limits | ||
ax.plot([2, 3, 4], [0.4, 0.6, 0.5]) | ||
np.testing.assert_allclose((ax.dataLim.xmin, ax.dataLim.xmax), (2, 4)) | ||
data_ymin, data_ymax = ax.dataLim.ymin, ax.dataLim.ymax | ||
# LineCollection with vertical lines spanning the Axes vertical, using transAxes | ||
x = [1, 2, 3, 4, 5] | ||
vertical_lines = [np.array([[xi, 0], [xi, 1]]) for xi in x] | ||
trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes) | ||
ax.add_collection(LineCollection(vertical_lines, transform=trans)) | ||
# check that the x data limits are updated to include the LineCollection | ||
np.testing.assert_allclose((ax.dataLim.xmin, ax.dataLim.xmax), (1, 5)) | ||
# check that the y data limits are not updated (because they are not transData) | ||
np.testing.assert_allclose((ax.dataLim.ymin, ax.dataLim.ymax), (0.4, 0.6)) | ||
Comment on lines +904 to +918 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. Note 1: Before, the test did only check that the x data limits were expanded. It did not investigate the y data limits. Now it also ensures, that y data limits are not changed. Note 2: I've switched from testing view limits to testing data limits, because that's the relevant quantity autolim influences. We save the | ||
def test_singleton_autolim(): | ||
Uh oh!
There was an error while loading.Please reload this page.