change linewidth of ticks?

Hello everyone,

Arnd Baecker and I tried a while to enlarge the thickness of tick-lines.
One of our presumptions was:

  ax = gca()
  xticks = ax.xaxis.get_ticklines()
  setp(xticks, linewidth= 4)

This was not working.
But we finally found a way to do so. To do the desired enlargement we had to
edit the 'lines.py'-file. Because of the ticks also just being lines we
added something to the methods

  _draw_tickleft(self, renderer, gc, xt, yt)
  _draw_tickright(self, renderer, gc, xt, yt)
  _draw_tickup(self, renderer, gc, xt, yt)
  _draw_tickdown(self, renderer, gc, xt, yt).

Right after each

  offset = renderer.points_to_pixels(self._markersize)

(which as far as we know sets the lenght of the ticks with help of the
rc-file via some minor detours)
we wrote a

  gc.set_linewidth(self._linewidth).

Now the

  ax = gca()
  xticks = ax.xaxis.get_ticklines()
  setp(xticks, linewidth= 4)

did work well!

Now there are three more things to ask:

a) Is there any drawback? We just used the self._linewidth without really
knowing what it was for. Could it be that some user sets a parameter
somewhere to change some other linewidth and changes the tickwidth "en
passant"?
b) In behalf of unification it would possibly be better to add this option
to the .matplotlibrc-file in the neighbourhood of

  tick.major.size : 4 # major tick size in points.

(As far as I can see this means changeing the Class Tick's __init__ placed
in axis.py a little bit.)
c) Now it is possible to change 'lw'. Should it also be possible to change
'color', 'linestyle'?

Bye,
Martin

···

--
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

I was just working on the same problem when I saw
your post. There is a way to do this without having to hack
code. As I myself learned from this list, the ticks
are markers. The trick is to set the markeredgewidth
of the ticks. For example:

  plot1 = subplot(111,axisbg='w')
  set(plot1.get_xticklines() + plot1.get_yticklines() , mew=3.0)

   This should do the trick.

  Doug

···

On Thursday 08 September 2005 04:58 am, Martin Richter wrote:

Hello everyone,

Arnd Baecker and I tried a while to enlarge the thickness of tick-lines.
One of our presumptions was:

  ax = gca()
  xticks = ax.xaxis.get_ticklines()
  setp(xticks, linewidth= 4)

This was not working.
But we finally found a way to do so. To do the desired enlargement we had
to edit the 'lines.py'-file. Because of the ticks also just being lines we
added something to the methods

  _draw_tickleft(self, renderer, gc, xt, yt)
  _draw_tickright(self, renderer, gc, xt, yt)
  _draw_tickup(self, renderer, gc, xt, yt)
  _draw_tickdown(self, renderer, gc, xt, yt).

Right after each

  offset = renderer.points_to_pixels(self._markersize)

(which as far as we know sets the lenght of the ticks with help of the
rc-file via some minor detours)
we wrote a

  gc.set_linewidth(self._linewidth).

Now the

  ax = gca()
  xticks = ax.xaxis.get_ticklines()
  setp(xticks, linewidth= 4)

did work well!

Now there are three more things to ask:

a) Is there any drawback? We just used the self._linewidth without really
knowing what it was for. Could it be that some user sets a parameter
somewhere to change some other linewidth and changes the tickwidth "en
passant"?
b) In behalf of unification it would possibly be better to add this option
to the .matplotlibrc-file in the neighbourhood of

  tick.major.size : 4 # major tick size in points.

(As far as I can see this means changeing the Class Tick's __init__ placed
in axis.py a little bit.)
c) Now it is possible to change 'lw'. Should it also be possible to change
'color', 'linestyle'?

Bye,
Martin

--
----------------------------------------------------------------------------
  F. Douglas Swesty
  Research Assistant Professor
  Department of Physics and Astronomy, SUNY at Stony Brook

  email: dswesty@...799...
  www: http://www.astro.sunysb.edu/dswesty
  phone: (631)-632-8055 FAX: (631)-632-1745

  Postal mail: Dept. of Physics and Astronomy
                 SUNY at Stony Brook
                 Stony Brook, NY 11794+3800

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