-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: set_position
function of spine will affect the color of ticklabels
#22672
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
set_position
f unction of spine will affect the color of ticklabelsset_position
function of spine will affect the color of ticklabels
It seems to come from this: matplotlib/lib/matplotlib/spines.py Lines 321 to 322 in a2ddfc0
See #2941 for a bit of background why that happens. |
Note: It's almost never a good idea to iterate over and modify individual ticks. Ticks are volatile and can change throughout the lifecycle of a figure. The correct approach to aboves code is to use
More details are discussed in #22856. |
Thank @timhoffm . But tick_params can not change only part of the ticks, correct? |
@y9c If you mean "some of the ticks", yes, |
Hi @timhoffm , I tried to set tick label color after all plotting function, but still don't work. It seem that once |
In https://matplotlib.org/stable/tutorials/intermediate/artists.html it is shown that one can iterate over the ticks and tick labels. This should probably be updated. Also, the approach there will not affect the tick color as expected (not at all...). |
Bug summary
When
.set_position()
function is applied to the plot, color of the ticklabels will change.Code for reproduction
Block A
Actual outcome
When apply
set_position
function, the color will be reset.Expected outcome
Color of yticklables should be red.
Additional information
No response
Operating system
No response
Matplotlib Version
3.5.0
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
No response
The text was updated successfully, but these errors were encountered: