adding a filled rectangle

Hi. I’d like to add a filled area on my graph to denote the standard deviation from an average. Additionally, i’d prefer the fill to be a diagonal hatch. Reading online, i found that there is a ‘Rectangle’ class, but i can’t get this to work. Can someone suggest a good way to get the results i’m looking for? Thanks!

import matplotlib.pyplot as plt
import matplotlib.patches as mpatches

xy = 0.3, 0.3,
width, height = 0.2, 0.5

p = mpatches.Rectangle(xy, width, height, facecolor="orange", edgecolor="red")

plt.gca().add_patch(p)

plt.draw()

A Rectangle is a patch class and (although I'm not sure) I don't think
there is a helper function to easily create a patch object in the
pyplot level. To draw a Rectangle (or any patch object), you need to
import matplotlib.patches module, create a patch object and add it to
your axes (add_patch method).
The doc says that hatch is only supported in ps backend. Check the
set_hatch method.

Regards,

-JJ

···

On Wed, Sep 17, 2008 at 1:06 PM, Ryan Pavlovicz <pavlo2@...287...> wrote:

Hi. I'd like to add a filled area on my graph to denote the standard
deviation from an average. Additionally, i'd prefer the fill to be a
diagonal hatch. Reading online, i found that there is a 'Rectangle' class,
but i can't get this to work. Can someone suggest a good way to get the
results i'm looking for? Thanks!

-------------------------------------------------------------------------
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

Can you show us what you've tried thus far? This is a rather open-ended question...

Cheers,
Mike

Ryan Pavlovicz wrote:

···

Hi. I'd like to add a filled area on my graph to denote the standard deviation from an average. Additionally, i'd prefer the fill to be a diagonal hatch. Reading online, i found that there is a 'Rectangle' class, but i can't get this to work. Can someone suggest a good way to get the results i'm looking for? Thanks!
------------------------------------------------------------------------

-------------------------------------------------------------------------
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
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA