Skip to content

Partial fix for grid alpha #22234

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

Merged
merged 1 commit into from
Feb 11, 2022
Merged

Conversation

timhoffm
Copy link
Member

PR Summary

Partial fix for #22231.

This is clearly a logic error fix, see comment in code. Unfortunately, there is a much larger underlying problem, which is why this PR alone won't fix the problem and I cannot add tests.

The underlying problem lies in the arcane tick mechanism; roughly: via the _LazyTickLists we generate majorTicks[0], which gets not parameters and thus resolves rcParams['grid.alpha'] to a float. OTOH new ticks are created by copying properties from existing ticks. Even though this PR fixes the tick gridline initialization to respect a color alpha, _copy_tick_props() overwrites the gridline alpha afterwards.

I've spent a couple of hours digging this out and trying to find a proper fix. My time budget on this issue is exhausted. You may merge this PR as a partial fix if you think it's reasonable; or you may take it as a basis for digging into the complete fix.

@@ -1413,7 +1419,7 @@ def grid(self, visible=None, which='major', **kwargs):
visible = True
which = which.lower()
_api.check_in_list(['major', 'minor', 'both'], which=which)
gridkw = {'grid_' + item[0]: item[1] for item in kwargs.items()}
gridkw = {f'grid_{name}': value for name, value in kwargs.items()}
Copy link
Member Author

Choose a reason for hiding this comment

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

No functional change, only better formatting for readability.

@jklymak jklymak added this to the v3.6.0 milestone Feb 1, 2022
@QuLogic QuLogic merged commit bba8e9e into matplotlib:main Feb 11, 2022
@timhoffm timhoffm deleted the grid-color-alpha branch February 11, 2022 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants