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

DOC: don't use deprecated collections attribute #2324

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented Feb 8, 2024

Rationale

I just spotted this while grepping for something else. The ContourSet.collections attribute was deprecated at mpl 3.8. We could now just call set_visible on the ContourSet itself, but that will break with older Matplotlib versions. I have checked that the current suggestion works with Cartopy main and mpl 3.8.2, and also with Cartopy 0.21.1 and mpl 3.6.3.

Implications

@rcomer
Copy link
Member Author

rcomer commented Feb 8, 2024

I guess another option would be to just have two commented-out lines, one each for older and newer Matplotlib versions. Is it more efficient at draw time to have the visible flag set to False than the color set to 'none'?

Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

I think there are some shortcuts if artist.get_visible() == False, so it likely is a bit faster. This is only an example though, people can expand from here themselves.

@greglucas greglucas merged commit 25a2154 into SciTools:main Feb 8, 2024
1 of 3 checks passed
@rcomer rcomer deleted the doc-contour-labels branch February 8, 2024 13:59
@QuLogic QuLogic added this to the Next Release milestone Feb 9, 2024
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.

3 participants