-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
matplotlibrc validates some parameters wrongly #16583
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
Comments
It looks like #7970 headed out to introduce a vertical-alignment parameter to y-ticklabels only. But then a rework of that in #8081 introduceda parameter for the vertical alignment for y-ticklabels and the horizontal alignment for x-ticklabels - except that validation is still for vertical-alignment only. I suppose the easy fix is to just replace matplotlib/lib/matplotlib/rcsetup.py Lines 1306 to 1307 in 8ac3ea1
Such fix has to go on top of #16483 which is milestoned for 3.3, but given that the problem hasn't bothered anyone since 2.0.1, it might be ok to not hassle about backporting. |
If no one is working on this, I would like take a shot at it. |
Go for it. |
Thanks, I've updated the rcsetup.py like so:
and validated it works. As for unit testing, is there a way to test this other than using image comparison tests? Something like a "get_tick_alignment" of the axis or something like that? |
Closed by #16727. |
Bug report
Bug summary
I would like to set how xticks are aligned. There is the ha (for horizontalalignment) parameter which controls this with the possible values 'left', 'center' and 'right'.
To globally set this parameter, I tried to set
xtick.alignment
in my .matplotlibrc config file.However when setting it to 'left', I get an error (when I start ipython):
So I tried to set it to 'bottom' (to see what happens) and plotted a simple curve (see code below), but then I got a ValueError:
In conclusion, the matplotlibrc validation for the xtick.alignment parameter is bogus.
Code for reproduction
Either
xtick.alignment : top
Or
xtick.alignment : left
in .matplotlibrc
matplotlib.pyplot.plot([1,2,3], [5,3,9])
for provoking the ValueError (see above
Matplotlib version
print(matplotlib.get_backend())
):The text was updated successfully, but these errors were encountered: