How to change the size of the numbers under the axis

Hello,

Do you know to change the size of the numbers under the axis?

fabien

import matplotlib
matplotlib.rcParams['axes.labelsize'] = 12.0

Hope this helps.

···

On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote:

Hello,

Do you know to change the size of the numbers under the axis?

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

There is no effect…

2012/8/30 Damon McDougall <damon.mcdougall@…287…>

···

On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote:

Hello,

Do you know to change the size of the numbers under the axis?

import matplotlib

matplotlib.rcParams[‘axes.labelsize’] = 12.0

Hope this helps.

Damon McDougall

http://www.damon-is-a-geek.com

B2.39

Mathematics Institute

University of Warwick

Coventry

West Midlands

CV4 7AL

United Kingdom

You want to modify “xtick.labelsize” or “ytick.labelsize”. By default, they are “medium”, but you can use a number for it as well. “axes.labelsize” effects the axes labels, not the labels for the ticks.

Cheers!
Ben Root

···

On Thu, Aug 30, 2012 at 11:58 AM, Fabien Lafont <lafont.fabien@…287…> wrote:

There is no effect…

2012/8/30 Damon McDougall <damon.mcdougall@…878…287…>

On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote:

Hello,

Do you know to change the size of the numbers under the axis?

import matplotlib

matplotlib.rcParams[‘axes.labelsize’] = 12.0

Hope this helps.

Hi,

But how can I do it for every graph and without creating axis?

I’ve seen this example:

import numpy as np
import matplotlib.pyplot as plt

# plt.figure creates a matplotlib.figure.Figure instance
fig = plt.figure()
rect = fig.patch # a rectangle instance
rect.set_facecolor('lightgoldenrodyellow')

ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
rect = ax1.patch
rect.set_facecolor('lightslategray')

for label in ax1.xaxis.get_ticklabels():
    # label is a Text instance
    label.set_color('red')
    label.set_rotation(45)
    label.set_fontsize(16)

I don’t manage to use only label.set_fontsize(16). It looks so complicated.

2012/8/30 Benjamin Root <ben.root@…3176…>

···

On Thu, Aug 30, 2012 at 11:58 AM, Fabien Lafont <lafont.fabien@…287…> wrote:

There is no effect…

2012/8/30 Damon McDougall <damon.mcdougall@…287…>

On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote:

Hello,

Do you know to change the size of the numbers under the axis?

import matplotlib

matplotlib.rcParams[‘axes.labelsize’] = 12.0

Hope this helps.

You want to modify “xtick.labelsize” or “ytick.labelsize”. By default, they are “medium”, but you can use a number for it as well. “axes.labelsize” effects the axes labels, not the labels for the ticks.

Cheers!
Ben Root

We just told you:

import matplotlib

matplotlib.rcParams[‘xticks.labelsize’] = 12.0

Whenever a plot is made, it obtains the defaults from the rcParams. Note, if you are changing the rcParams after creating a plot, then this would have no effect.

Cheers!
Ben Root

···

On Thu, Aug 30, 2012 at 12:53 PM, Fabien Lafont <lafont.fabien@…287…> wrote:

Hi,

But how can I do it for every graph and without creating axis?

Thanks for that, Ben. Apologies if I caused confusion.

···

On Thu, Aug 30, 2012 at 12:04:48PM -0400, Benjamin Root wrote:

On Thu, Aug 30, 2012 at 11:58 AM, Fabien Lafont <lafont.fabien@...287...>wrote:

> There is no effect...
>
>
> 2012/8/30 Damon McDougall <damon.mcdougall@...287...>
>
>> On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote:
>> > Hello,
>> >
>> > Do you know to change the size of the numbers under the axis?
>> >
>>
>> import matplotlib
>> matplotlib.rcParams['axes.labelsize'] = 12.0
>>
>> Hope this helps.
>>
>>
You want to modify "xtick.labelsize" or "ytick.labelsize". By default,
they are "medium", but you can use a number for it as well.
"axes.labelsize" effects the axes labels, not the labels for the ticks.

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

I’ve tried also but it returns an error:

matplotlib.rcParams[‘xticks.labelsize’] = 12.0
File “C:\Python27\lib\site-packages\matplotlib_init_.py”, line 653, in setitem
See rcParams.keys() for a list of valid parameters.’ % (key,))
KeyError: ‘xticks.labelsize is not a valid rc parameter.See rcParams.keys() for a list of valid parameters.’

2012/8/30 Damon McDougall <damon.mcdougall@…287…>

···

On Thu, Aug 30, 2012 at 12:04:48PM -0400, Benjamin Root wrote:

On Thu, Aug 30, 2012 at 11:58 AM, Fabien Lafont <lafont.fabien@…287…>wrote:

There is no effect…

2012/8/30 Damon McDougall <damon.mcdougall@…287…>

On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote:

Hello,

Do you know to change the size of the numbers under the axis?

import matplotlib

matplotlib.rcParams[‘axes.labelsize’] = 12.0

Hope this helps.

You want to modify “xtick.labelsize” or “ytick.labelsize”. By default,

they are “medium”, but you can use a number for it as well.

“axes.labelsize” effects the axes labels, not the labels for the ticks.

Thanks for that, Ben. Apologies if I caused confusion.

Damon McDougall

http://www.damon-is-a-geek.com

B2.39

Mathematics Institute

University of Warwick

Coventry

West Midlands

CV4 7AL

United Kingdom

It's actually 'xtick.labelsize'. No 's'.

···

On Thu, Aug 30, 2012 at 07:06:14PM +0200, Fabien Lafont wrote:

I've tried also but it returns an error:

matplotlib.rcParams['xticks.labelsize'] = 12.0
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 653, in
__setitem__
    See rcParams.keys() for a list of valid parameters.' % (key,))
KeyError: 'xticks.labelsize is not a valid rc parameter.See rcParams.keys()
for a list of valid parameters.'

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

Thanks,

I’ve found the problem. I use xlabel(“name of my axis”, size= 30) after
matplotlib.rcParams['xtick.

labelsize’] = 12.0 and it cancel it! Is it possible to have a name on the axe and matplotlib.rcParams[‘xticks.
labelsize’] = 12.0 ??

2012/8/30 Damon McDougall <damon.mcdougall@…287…>

···

On Thu, Aug 30, 2012 at 07:06:14PM +0200, Fabien Lafont wrote:

I’ve tried also but it returns an error:

matplotlib.rcParams[‘xticks.labelsize’] = 12.0

File “C:\Python27\lib\site-packages\matplotlib_init_.py”, line 653, in

setitem

See rcParams.keys() for a list of valid parameters.' % (key,))

KeyError: 'xticks.labelsize is not a valid rc parameter.See rcParams.keys()

for a list of valid parameters.’

It’s actually ‘xtick.labelsize’. No ‘s’.

Damon McDougall

http://www.damon-is-a-geek.com

B2.39

Mathematics Institute

University of Warwick

Coventry

West Midlands

CV4 7AL

United Kingdom

Wait a minute. What exactly are you trying to do?

···

On Thu, Aug 30, 2012 at 07:28:40PM +0200, Fabien Lafont wrote:

Thanks,

I've found the problem. I use xlabel("name of my axis", size= 30) after
matplotlib.rcParams['xtick.
labelsize'] = 12.0 and it cancel it! Is it possible to have a name on the
axe and matplotlib.rcParams['xticks.
labelsize'] = 12.0 ??

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

I’m just trying to plot a graph and add a label to each axis of that graph and change the labelsize of the ticks.

2012/8/30 Damon McDougall <damon.mcdougall@…287…>

···

On Thu, Aug 30, 2012 at 07:28:40PM +0200, Fabien Lafont wrote:

Thanks,

I’ve found the problem. I use xlabel(“name of my axis”, size= 30) after

matplotlib.rcParams['xtick.

labelsize’] = 12.0 and it cancel it! Is it possible to have a name on the

axe and matplotlib.rcParams['xticks.

labelsize’] = 12.0 ??

Wait a minute. What exactly are you trying to do?

Damon McDougall

http://www.damon-is-a-geek.com

B2.39

Mathematics Institute

University of Warwick

Coventry

West Midlands

CV4 7AL

United Kingdom

Could you post your code? What you are describing shouldn’t happen. Also, which version of matplotlib are you using?

Ben Root

···

On Thu, Aug 30, 2012 at 1:38 PM, Fabien Lafont <lafont.fabien@…287…> wrote:

I’m just trying to plot a graph and add a label to each axis of that graph and change the labelsize of the ticks.

I just create two vectors from a .txt file and I plot them.
I think I have the latest version of matplotlib. I have at least the
last version of python(x,y)

from pylab import*

import matplotlib
matplotlib.rcParams['xtick.labelsize'] = 20.0

B5= genfromtxt("2012-05-14_RC3D3D2C1_D2D1_m18T_18T_Vg32V_20K.dat", usecols =(2))
RH5 = genfromtxt("2012-05-14_RC3D3D2C1_D2D1_m18T_18T_Vg32V_20K.dat",
usecols =(3))
#plot(B5,RH5,"-o",label = "2012-05-14_RC3D3D2C1_D2D1_m18T_18T_Vg32V_20K.dat")

xlabel(u" B \(T\)", size= 30)
ylabel(u"R\_H \(\\Omega\)", size= 30)
grid()
legend()
show()

2012/8/30 Benjamin Root <ben.root@...1304...>:

···

On Thu, Aug 30, 2012 at 1:38 PM, Fabien Lafont <lafont.fabien@...287...> > wrote:

I'm just trying to plot a graph and add a label to each axis of that graph
and change the labelsize of the ticks.

Could you post your code? What you are describing shouldn't happen. Also,
which version of matplotlib are you using?

Ben Root

In your matplotlib config file
axes.titlesize : 10 # fontsize of the axes title
axes.labelsize : 10 # fontsize of the x any y labels
(see http://matplotlib.sourceforge.net/users/customizing.html )

···

Le jeudi 30 août 2012 à 19:48 +0200, Fabien Lafont a écrit :

I just create two vectors from a .txt file and I plot them.
I think I have the latest version of matplotlib. I have at least the
last version of python(x,y)

from pylab import*

import matplotlib
matplotlib.rcParams['xtick.labelsize'] = 20.0

Actually I just want to do it on that plot not on all my future plot.

2012/8/30 Fabrice Silva <silva@...1918...>:

···

Le jeudi 30 août 2012 à 19:48 +0200, Fabien Lafont a écrit :

I just create two vectors from a .txt file and I plot them.
I think I have the latest version of matplotlib. I have at least the
last version of python(x,y)

from pylab import*

import matplotlib
matplotlib.rcParams['xtick.labelsize'] = 20.0

In your matplotlib config file
axes.titlesize : 10 # fontsize of the axes title
axes.labelsize : 10 # fontsize of the x any y labels
(see http://matplotlib.sourceforge.net/users/customizing.html )

I think you're looking for this http://matplotlib.sourceforge.net/users/whats_new.html#tick-params

···

On 30/08/2012 19:00, Fabien Lafont wrote:

Actually I just want to do it on that plot not on all my future plot.

2012/8/30 Fabrice Silva <silva@...1918...>:

Le jeudi 30 ao�t 2012 � 19:48 +0200, Fabien Lafont a �crit :

I just create two vectors from a .txt file and I plot them.
I think I have the latest version of matplotlib. I have at least the
last version of python(x,y)

from pylab import*

import matplotlib
matplotlib.rcParams['xtick.labelsize'] = 20.0

In your matplotlib config file
axes.titlesize : 10 # fontsize of the axes title
axes.labelsize : 10 # fontsize of the x any y labels
(see http://matplotlib.sourceforge.net/users/customizing.html )

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

--
Cheers.

Mark Lawrence.

Hi,

I think I was tired yesterday.
matplotlib.rcParams['xtick.labelsize'] = 20.0 works perfectly also
with xlabel("name", size= 30)

Thanks all,

Fabien

2012/8/30 Mark Lawrence <breamoreboy@...225...>:

···

On 30/08/2012 19:00, Fabien Lafont wrote:

Actually I just want to do it on that plot not on all my future plot.

2012/8/30 Fabrice Silva <silva@...1918...>:

Le jeudi 30 août 2012 à 19:48 +0200, Fabien Lafont a écrit :

I just create two vectors from a .txt file and I plot them.
I think I have the latest version of matplotlib. I have at least the
last version of python(x,y)

from pylab import*

import matplotlib
matplotlib.rcParams['xtick.labelsize'] = 20.0

In your matplotlib config file
axes.titlesize : 10 # fontsize of the axes title
axes.labelsize : 10 # fontsize of the x any y labels
(see http://matplotlib.sourceforge.net/users/customizing.html )

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

I think you're looking for this
http://matplotlib.sourceforge.net/users/whats_new.html#tick-params

--
Cheers.

Mark Lawrence.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options