[Matplotlib-users] Setting xticks rotation in matplotlibrc

Éric Depagne eric at depagne.org
Fri Oct 15 03:11:08 EDT 2021


Le jeudi 14 octobre 2021, 23:38:56 SAST Eric Firing a écrit :
Hi Eric, 

Thanks for the explanation.
My use case for being able to change it globally is that in the project I'm 
working on, I'm doing time analysis and I only have dates on the x-axis, so 
being able to have a separate matplotlibrc file in my data directory, where I 
set the xtick orientation once and for all is easier.
plt.tick_params() will definitely do the job, so I'll use that.

That said, I'm not sure that the minor tick size is changed often too, but it's 
accessible through a parameter in the rc file so I wonder why some parameters 
are accessible and some are not.
I apologise if the last paragraph sounds (looks?) like I'm complaining or 
ranting. I'm not, but as english is not my native language, it's sometimes 
difficult to convey the exact message I intend to in writing. I'm genuinely 
curious about the choices made.

Thanks for the help.

Éric.

> Eric,
> 
> Yes, it is expected: matplotlibrc does not include a key for this
> because it is not common that one would want to change the default
> orientation.
> 
> I suggest using plt.tick_params() or the equivalent Axes method for
> modifying your tick and tick label properties.
> 
> Eric
> 
> On 2021/10/14 4:01 AM, Éric Depagne wrote:
> > Hi all,
> > 
> > I'm trying to set the rotation angle of the xticks in my matplotlibrc file
> > using the following:
> > xtick.rotation:       45
> > But it has no effect.
> > When I start ipython, it loads my matplotlibrc file and I get the
> > following
> > message:
> > Bad key xtick.rotation in file /home/eric/.config/matplotlib/matplotlibrc,
> > line 472 ('xtick.rotation:       45')
> > 
> > I wonder if that's the expected behaviour, and that one can only set the
> > rotation using
> > plt.xticks(rotation=45)
> > 
> > Thanks.
> > Éric.
> > 
> > 
> > 
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users at python.org
> > https://mail.python.org/mailman/listinfo/matplotlib-users
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users


-- 
Un clavier azerty en vaut deux
----------------------------------------------------------
Éric Depagne                            





More information about the Matplotlib-users mailing list