histogram hatching

Thank you very much for the info.

As an aside, after saving it one can use epstopdf to convert the crosshatched eps figure to pdf. If you want to edit it, inkscape can import pdf and save to svg.


----- Original Message ----
From: John Hunter <jdh2358@…287…>
To: izak marais <izakmarais@…9…>
Cc: matplotlib-users@lists.sourceforge.net
Sent: Wednesday, June 25, 2008 3:49:56 PM
Subject: Re: [Matplotlib-users] histogram hatching

On Wed, Jun 25, 2008 at 6:05 AM, izak marais <izakmarais@…9…> wrote:


I see there is a “hatch: unknown” kwarg mentioned in the hist()
documentation. Can anyone shed some light on how to use this please? I
assume it might be used to generate monochrome rectangles with
differentiating hatched fills?

The rectangles generates by “hist” are matplotlib.patch.Rectangle
instances, and the “hatch” property is controlled by the “set_hatch”
method. Here is the docstring which should tell you most everything
you need to know. Note the caveat at the end that it is only
currently supported on postscript – patches for other backends much

def set_hatch(self, h):
     Set the

hatching pattern

  hatch can be one of::

      /  - diagonal hatching
      \  - back diagonal
      >  - vertical
      -  - horizontal
      #  - crossed
      x  - crossed diagonal

    Letters can be combined, in which case all the specified
    hatchings are done.  If same letter repeats, it increases the
    density of hatching in that direction.


    1. Hatching is supported in the PostScript backend only.

    2. Hatching is done with solid black lines of width 0.