only vertical grid lines?

Hello, I used matplotlib to create a graphical

    > representation of the boot process of my Debian GNU/Linux
    > system. The result can be found at

    > Profile of the Boot Process of a Debian System

    > and especially in the (2400x1500 sized) picture

    > http://seehuhn.de/comp/bootlog2.png

Very nice - you manage to pack a lot of information into the graph.
Edward Tufte would be proud! It's nice to have folks stress testing
matplotlib

    > I have a question about matplotlib usage:

  * I would like the picture to have vertical grid lines at positions
    1, 2, 3, 4, ..., On the horizontal x-Axis I would like to see
    labels at positions 0, 5, 10, 15, ...

The best way to do this would be to use minor ticks on 1,2,3,4,etc and
major ticks on 0,5,10,15 - the grids occur at the locations of the
ticks, and you can customize how you want the ticks labeled. See
examples/major_minor_demo1.py and the use of the MultipleLocator. The
Multiple locator places ticks at multiples of some base. For you minor
ticks you would use MultipleLocator(1) and for your major ticks
MultipleLocator(1). The labels for the minor ticks are off by default
which is what you want, though you can customize this.

See http://matplotlib.sf.net/matplotlib.ticker.html for more info.

  * not horizonzal grid lines.

The ax.xaxis.grid and ax.yaxis.grid functions can be used to
selectively turn on and off the grids for the respective axes. The
signature is

    def grid(self, b, which='major'):

where b is a boolean. You can use this to control gridding for the
major and minor ticks on a per-axis basis. So

  ax.yaxis.grid(False)

selectively turns off the grids for the y axis major tick grid lines.
The minor grids are off by default. You can turn them on, eg with

   ax.xaxis.grid(True, which='minor')

  * and I would like to get rid of the labels on the y-Axis. Is this
    possible?

ax.set_yticklabels('')

See also the functions xticks and yticks in the matlab interface for
easy customization of tick locations and labels.

Cheers,
JDH

Hello John,

thanks a lot for your help. My picture is improving.
But one problem is left: the script

    from matplotlib.matlab import *
    from matplotlib.ticker import MultipleLocator

    subplot(211)
    ax=gca()
    ax.xaxis.set_minor_locator(MultipleLocator(1))
    ax.xaxis.set_major_locator(MultipleLocator(5))
    ax.xaxis.grid(True, which="minor")
    ax.yaxis.grid(False)
    semilogy([1,2,3,4,5,6,7,8,9,10,11],[1,2,3,4,5,6,7,8,9,10,11],basey=2)

    show()

has vertical grid lines ONLY on the minor ticks, which looks silly.
How do I get regularly spaced grid lines here?

All the best,
Jochen

···

--
http://seehuhn.de/