Make tick labels thicker

Hi,

First of all, thanks to the developers
for such a great Python plotting package. I use matplotlib more and more
for my work.

There is one thing, which I cannot get
to work, namely to change the linewidth of the tick lines.

I have tried

ticklines = ax.get_xticklines()

ticklines.extend(ax.get_yticklines())

for line in ticklines:

line.set_linewidth(10)

but nothing changes. I can change the
color and other properties, but no matter what I set for the linewidth,
it does not change. I have also tried to go in and

ticklines[0]._linewidth = 10

but again no change. If I do a similar
thing for the color

ticklines[0]._color = ‘b’

the color is changed.

I use matplotlib 0.91 on a RedHat EL
4 machine.

Any ideas on how to solve this would
be much appreciated. I have searched the mailing lists and the site, but
could not find a solution (apologies if I should have missed it)

Best regards,

Berit

···

Berit Hinnemann

Research Scientist | Characterization Department | Research & Development
Haldor Topsøe A/S

Nymøllevej 55

DK-2800 Kgs. Lyngby

Phone: +45 4527 2130 (direct)

Haldor Topsøe is market
leading within heterogeneous catalysis and supplies catalysts and process
design for oil refineries, chemical plants and the energy sector. The environment
plays an important role in Topsøe’s research and production, and through
the introduction of new catalysts and technologies the company supports
a more sustainable use of the world’s resources. Annual revenues total
DKK 3.5 billion generated by our 1,700 dedicated employees. For additional
information please see our web site
www.topsoe.com


This e-mail message (including attachments, if any) is confidential and
may be privileged. It is intended only for the addressee.

Any unauthorised distribution or disclosure is prohibited. Disclosure to
anyone other than the intended recipient does not constitute waiver of
privilege.

If you have received this e-mail in error, please notify the sender by
e-mail and delete it and any attachments from your computer system and
records.

HALDOR TOPSOE (www.topsoe.com)

This is the correct approach but it is a tricky one. In matplotlib,
the ticks are *markers*. All Line2D objects support a line (solid,
dashed, etc) and a marker (circle, square, tick). The tick linewidth
is controlled by the "markeredgewidth" property.

from pylab import figure, show
fig = figure()
ax = fig.add_subplot(111)
ax.plot(range(10))

for line in ax.get_xticklines() + ax.get_yticklines():
    line.set_markeredgewidth(10)

show()

BTW -- this is covered in the somewhat new artist api tutorial at
http://matplotlib.sf.net/pycon/artist_api_tut.pdf

···

On Mon, Jun 2, 2008 at 12:32 PM, Berit Hinnemann <behi@...1691...> wrote:

There is one thing, which I cannot get to work, namely to change the
linewidth of the tick lines.

I have tried

ticklines = ax.get_xticklines()
ticklines.extend(ax.get_yticklines())

for line in ticklines:
    line.set_linewidth(10)

but nothing changes. I can change the color and other properties, but no
matter what I set for the linewidth, it does not change. I have also tried
to go in and

Correction ( I should have read the link myself first). The property
you are probably interested is the markersize (marker size in points)
though markeredgewidth may be useful too....

JDH

···

On Mon, Jun 2, 2008 at 12:45 PM, John Hunter <jdh2358@...287...> wrote:

for line in ax.get_xticklines() + ax.get_yticklines():
   line.set_markeredgewidth(10)

Hi again,

Thanks a lot for all the replies. Markersize
and Markeredgewidth work beautifully.

A couple more questions, which is, I
think, are related to what Erik Tollerud asked

-Is it correct that I can only mix math
symbols and normal text in an axis label, when I use “usetex = True”

-When I do that and set the default
font to e.g. Helvetica, everything gets printed in Helvetica, except the
numbers on the axes. How can I get them in Helvetica as well?

Thanks a lot!

Best regards,

Berit

···

Berit Hinnemann

Research Scientist | Characterization Department | Research & Development
Haldor Topsøe A/S

Nymøllevej 55

DK-2800 Kgs. Lyngby

Phone: +45 4527 2130 (direct)

Haldor Topsøe is market
leading within heterogeneous catalysis and supplies catalysts and process
design for oil refineries, chemical plants and the energy sector. The environment
plays an important role in Topsøe’s research and production, and through
the introduction of new catalysts and technologies the company supports
a more sustainable use of the world’s resources. Annual revenues total
DKK 3.5 billion generated by our 1,700 dedicated employees. For additional
information please see our web site
www.topsoe.com

"John Hunter"
<jdh2358@…287…>

02-06-2008 19:51

To

Berit Hinnemann [BEHI]@htas
cc

matplotlib-users@…504…et

Subject

Re: [Matplotlib-users] Make tick labels
thicker

`On Mon, Jun 2, 2008 at 12:45 PM, John Hunter <jdh2358@…287…>
wrote:

for line in ax.get_xticklines() + ax.get_yticklines():

line.set_markeredgewidth(10)

Correction ( I should have read the link myself first). The property

you are probably interested is the markersize (marker size in points)

though markeredgewidth may be useful too…

JDH

`


This e-mail message (including attachments, if any) is confidential and
may be privileged. It is intended only for the addressee.

Any unauthorised distribution or disclosure is prohibited. Disclosure to
anyone other than the intended recipient does not constitute waiver of
privilege.

If you have received this e-mail in error, please notify the sender by
e-mail and delete it and any attachments from your computer system and
records.

HALDOR TOPSOE (www.topsoe.com)

Berit Hinnemann wrote:

Hi again,

Thanks a lot for all the replies. Markersize and Markeredgewidth work beautifully.

A couple more questions, which is, I think, are related to what Erik Tollerud asked

-Is it correct that I can only mix math symbols and normal text in an axis label, when I use "usetex = True"

No. As of 0.91 and later, you can mix normal text with math. Just stick the math inside a pair of '$'.

-When I do that and set the default font to e.g. Helvetica, everything gets printed in Helvetica, except the numbers on the axes. How can I get them in Helvetica as well?

Can you include a snippet of code showing how you set those fonts?

Cheers,
Mike

···

Thanks a lot!

Best regards,
Berit
------------------------------------------------------------------------
*Berit Hinnemann*
Research Scientist | Characterization Department | Research & Development

*Haldor Tops�e A/S*
Nym�llevej 55
DK-2800 Kgs. Lyngby
Phone: +45 4527 2130 (direct)

/Haldor Tops�e is market leading within heterogeneous catalysis and supplies catalysts and process design for oil refineries, chemical plants and the energy sector. The environment plays an important role in Tops�e's research and production, and through the introduction of new catalysts and technologies the company supports a more sustainable use of the world's resources. Annual revenues total DKK 3.5 billion generated by our 1,700 dedicated employees. For additional information please see our web site /*_www.topsoe.com_* <http://www.topsoe.com/>

*"John Hunter" <jdh2358@...287...>*

02-06-2008 19:51

To
  Berit Hinnemann [BEHI]@htas
cc
  matplotlib-users@lists.sourceforge.net

Subject
  Re: [Matplotlib-users] Make tick labels thicker

On Mon, Jun 2, 2008 at 12:45 PM, John Hunter <jdh2358@...287...> wrote:

> for line in ax.get_xticklines() + ax.get_yticklines():
> line.set_markeredgewidth(10)

Correction ( I should have read the link myself first). The property
you are probably interested is the markersize (marker size in points)
though markeredgewidth may be useful too....

JDH

------------------------------------------------------------------------

This e-mail message (including attachments, if any) is confidential and may be privileged. It is intended only for the addressee.
Any unauthorised distribution or disclosure is prohibited. Disclosure to anyone other than the intended recipient does not constitute waiver of privilege.
If you have received this e-mail in error, please notify the sender by e-mail and delete it and any attachments from your computer system and records.
HALDOR TOPSOE (_www.topsoe.com_ <http://www.topsoe.com/>)
------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Hi Michael,

Thanks a lot for your reply.

`>No. As of 0.91 and later, you can mix normal
text with math. Just

stick the math inside a pair of ‘$’.`

I just realized that I have version
0.90 installed. Is it advisable to upgrade to 0.93 or to 0.98 directly?
Also, how do I uninstall the 0.90 version before installing the new one?
My old version is located in site-packages as an .egg directory.

As for the code to set the fonts, I
use

rc(‘font’,**{‘family’:‘sans-serif’,
‘sans-serif’:[‘Helvetica’]})

Best regards, Berit

`

No. As of 0.91 and later, you can mix normal text with math. Just

stick the math inside a pair of ‘$’.

-When I do that and set the default font to e.g. Helvetica, everything

gets printed in Helvetica, except the numbers on the axes. How can
I

get them in Helvetica as well?

Can you include a snippet of code showing how you set those fonts?

`

···

This e-mail message (including attachments, if any) is confidential and
may be privileged. It is intended only for the addressee.

Any unauthorised distribution or disclosure is prohibited. Disclosure to
anyone other than the intended recipient does not constitute waiver of
privilege.

If you have received this e-mail in error, please notify the sender by
e-mail and delete it and any attachments from your computer system and
records.

HALDOR TOPSOE (www.topsoe.com)

Berit Hinnemann wrote:

Hi Michael,

Thanks a lot for your reply.

>No. As of 0.91 and later, you can mix normal text with math. Just
>stick the math inside a pair of '$'.

I just realized that I have version 0.90 installed. Is it advisable to upgrade to 0.93 or to 0.98 directly? Also, how do I uninstall the 0.90 version before installing the new one? My old version is located in site-packages as an .egg directory.

I never use eggs myself, but you should be able to delete that egg directory and then install a new matplotlib version. matplotlib doesn't install anything required outside of site-packages/matplotlib.

As for the code to set the fonts, I use

rc('font',**{'family':'sans-serif', 'sans-serif':['Helvetica']})

That seems to work for me for any font I throw at it. Do you have usetex on, or any other non-default settings in your matplotlibrc file? Are you running this line (above) before any plotting?

Cheers,
Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA