Skip to content
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

Fix gridliner when datalim updated by constrained layout #2254

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented Oct 2, 2023

Rationale

Fixes #2245. See #2245 (comment) for an explanation.

Implications

array=[1, 2, 3, 4],
)
ax.add_collection(collection)
fig.colorbar(collection, ax=ax, location='right')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem does show up if the colorbar isn't included, but is less obvious.

@rcomer rcomer changed the title Fix gridliner datalim updated by constrained layout Fix gridliner when datalim updated by constrained layout Oct 2, 2023
@@ -481,11 +481,12 @@ def _draw_preprocess(self, renderer):
if self.get_autoscale_on() and self.ignore_existing_data_limits:
self.autoscale_view()

self.apply_aspect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment indicating this needs to come before the other updates so we don't accidentally move it somewhere else later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

ax.autoscale()

# Add some gridlines
ax.gridlines(draw_labels=["bottom", "left"], auto_update=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help to have the gridlines "solid" rather than dashed for these tests? I feel like sometimes the tolerances are because some of the dashes slightly moving along the line rather than the full line moving up/down. Maybe that is just my eyes though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rcomer rcomer marked this pull request as draft October 5, 2023 15:47
@rcomer rcomer marked this pull request as ready for review October 6, 2023 18:38
@greglucas greglucas merged commit 38bc420 into SciTools:main Oct 6, 2023
2 of 14 checks passed
@QuLogic QuLogic added this to the Next Release milestone Oct 7, 2023
@rcomer rcomer deleted the gridliner-constrained branch October 7, 2023 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using Gridliner and Figure(layout="constrained") together misbehaves
3 participants