Yves Revaz wrote:
> Hi all,
>
> How is it possible to display by default the minor ticks with an
> interval 5 times
> smaller than the major ticks.
>
> I can do that for a known range of data : for example :
>
> ax = pt.gca()
> ax.xaxis.set_major_locator(MultipleLocator(10))
> ax.xaxis.set_minor_locator(MultipleLocator(10/5.))
>
>
> but I would like to have the major still set by default, i.e. :
> ax.xaxis.set_major_locator(AutoLocator())
>
> and now the minor automatically set to 1/5. of the value used for the major.
>
> How can I do that ?
>   
Dear Yves,

Here is the trick :

ax = gca()
ax.xaxis.set_major_locator(AutoLocator())
x_major = ax.xaxis.get_majorticklocs()
dx_minor =  (x_major[-1]-x_major[0])/(len(x_major)-1) /5.
ax.xaxis.set_minor_locator(MultipleLocator(dx_minor))

Cheers !

yves




>
> Thanks for your help,
>
> yves
>
>   


>
>
> --
>                                                  (o o)
> --------------------------------------------oOO--(_)--OOo-------
>   Yves Revaz
>   Laboratory of Astrophysics EPFL
>   Observatoire de Sauverny     Tel : ++ 41 22 379 24 28
>   51. Ch. des Maillettes       Fax : ++ 41 22 379 22 05
>   1290 Sauverny             e-mail : [EMAIL PROTECTED]
>   SWITZERLAND                  Web : http://www.lunix.ch/revaz/
> ----------------------------------------------------------------
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   


-- 
                                                 (o o)
--------------------------------------------oOO--(_)--OOo-------
  Yves Revaz
  Laboratory of Astrophysics EPFL
  Observatoire de Sauverny     Tel : ++ 41 22 379 24 28
  51. Ch. des Maillettes       Fax : ++ 41 22 379 22 05
  1290 Sauverny             e-mail : [EMAIL PROTECTED]
  SWITZERLAND                  Web : http://www.lunix.ch/revaz/
----------------------------------------------------------------


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to