Re: [Matplotlib-users] cross hatching in contours?

2011-09-17 Thread Jae-Joon Lee
On Thu, Sep 15, 2011 at 10:33 PM, Jonathan Slavin
jsla...@cfa.harvard.edu wrote:
 I'm wondering if there is some way to do cross hatching as a way to fill
 contours rather than colors (using contourf).  The only references to
 cross hatching I see in the documentation are for patches type objects.
 As far as I can tell, contour and contourf return objects of their own
 type (contour.QuadContourSet) that do not have hatch as an attribute.


Yes, it seems that hatching is only supported in patches.
You may workaround this by converting contours to multiple patches.
See the attachment.

 If it's not possible currently, how hard would it be to add that
 capability to contourf?  What approach would you recommend?


It may not be that difficult, but seems to require an api change
(e.g., draw_path_collections).
Can you file an issue on our github page?

Regards,

-JJ


 Regards,
 Jon


 --
 Doing More with Less: The Next Generation Virtual Desktop
 What are the key obstacles that have prevented many mid-market businesses
 from deploying virtual desktops?   How do next-generation virtual desktops
 provide companies an easier-to-deploy, easier-to-manage and more affordable
 virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



contour_to_hatched_patches.py
Description: Binary data
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] GridSpec has unecpected effect

2011-09-17 Thread Jae-Joon Lee
Thanks for reporting this.
I opened a pull request that I believe fixes this problem.

https://github.com/matplotlib/matplotlib/pull/472

Please test this if you can.

Depending on your need, you may work around this by calling all the
set_position method always after all the GridSpec.update call.

Regards,

-JJ


On Sat, Sep 17, 2011 at 1:37 AM, Kurt Mueller
kurt.alfred.muel...@gmail.com wrote:
 Hi,


 In the following script, it seems to me,
 that GridSpec does not work as expected.
 
 #!/usr/bin/env python
 # vim: set fileencoding=utf-8 :
 # adapted from http://matplotlib.sourceforge.net/users/gridspec.html

 import matplotlib.pyplot as plt
 from matplotlib.gridspec import GridSpec

 fig = plt.figure()

 gs1 = GridSpec(3,3)
 gs1.update( left=0.10, right=0.45 )
 ax1 = fig.add_subplot( gs1[ 0:1, 0:1 ] )
 ax1.set_position( [0.1, 0.1, 0.2, 0.8] )

 gs2 = GridSpec(3,3)
 gs2.update( left=0.55, right=0.95 )
 ax2 = fig.add_subplot( gs2[ 1:3, 1:3 ] )
 ax2.set_position( [0.5, 0.1, 0.2, 0.8] )

 plt.show()
 

 First I put an Axes ax1 with gs1.
 For some reason, I want to adjust ax1 with ax1.set_position.
 (In the real application only fine adjust)
 If I run the script only to this point it works as expected.

 Next I put another Axes ax2 with a new GridSpec gs2.
 With the command gs2.update() the Axes ax1 will be put back
 to the place where it would be without ax1.set_position().

 Is this behavior to be explained?



 Thanks
 --
 Kurt Mueller

 --
 BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
 http://p.sf.net/sfu/rim-devcon-copy2
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug report and fix for bracket arrow (annotations)

2011-09-17 Thread Jae-Joon Lee
Thanks for reporting this.
This is now fixed in the v1.0.x-maint branch and the master branch.

Regards,

-JJ


On Sat, Sep 17, 2011 at 10:33 AM, Daniel Hyams dhy...@gmail.com wrote:
 In  http://matplotlib.sourceforge.net/users/annotations_guide.html ,
 about 1/3 of the way down, there is a little demonstrator for the
 different arrowstyles -, -, ]-, etc.

 Looking at the figure closely, there is no difference between the -[
 and ]- styles.

 The fix for this is in patches.py, around line 3276 (matplotlib
 1.0.0).  Comments in that routine clipped out for brevity.

   class BracketA(_Bracket):
        def __init__(self, widthA=1., lengthA=0.2, angleA=None):

            super(ArrowStyle.BracketA, self).__init__(None,True,
                     widthA=widthA, lengthA=lengthA, angleA=angleA )

 If you flip the first two args of the __init__ call, that fixes it:

   class BracketA(_Bracket):
        def __init__(self, widthA=1., lengthA=0.2, angleA=None):

            super(ArrowStyle.BracketA, self).__init__(True,None,
 ## flip these arguments
                     widthA=widthA, lengthA=lengthA, angleA=angleA )


 --
 Daniel Hyams
 dhy...@gmail.com

 --
 BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
 http://p.sf.net/sfu/rim-devcon-copy2
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Drawing on a figure, not a subplot

2011-09-17 Thread Jae-Joon Lee
On Sat, Sep 17, 2011 at 6:10 AM, John Ladasky
john_lada...@sbcglobal.net wrote:
 But that isn't my goal here.  I want to add lines to the FIGURE, outside
 of any Axes.  Does anyone know how to accomplish this?  Thanks!

Not sure what you mean here.
Adding a patch to an axes does not mean it cannot be drawn outside of
axes. As far as you set (or unset) proper clip box, artists can be
drawn anywhere in the canvas regardless of the axes it belongs to.
Here is an example,

Regards,

-JJ


ax = subplot(111)

from matplotlib.patches import FancyArrow
p = FancyArrow(0.05, 0.5, 0.2, 0.0, width=0.01,
   length_includes_head=False,
   head_width=None, head_length=None,
   shape='full', overhang=0,
   head_starts_at_zero=False,
   transform=ax.figure.transFigure,
   clip_on=False)

ax.add_patch(p)

--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] GridSpec has unecpected effect

2011-09-17 Thread Kurt Mueller
Am 17.09.2011 um 15:38 schrieb Jae-Joon Lee:
 Thanks for reporting this.
 I opened a pull request that I believe fixes this problem.
 https://github.com/matplotlib/matplotlib/pull/472

Thank you very much!


 Please test this if you can.

I hope next week.


 Depending on your need, you may work around this by calling all the
 set_position method always after all the GridSpec.update call.

Thanks, yes this will work for me.
-- 
kurt.alfred.muel...@gmail.com


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [ANN] glumpy 0.2.0

2011-09-17 Thread Nicolas Rougier

Hi folks,

I am pleased to announce a new release of glumpy, a small python library for 
the (very) fast vizualization of numpy arrays, (mainly two dimensional) that 
has been designed with efficiency in mind. If you want to draw nice figures for 
inclusion in a scientific article, you’d better use matplotlib but if you want 
to have a sense of what’s going on in your simulation while it is running, then 
maybe glumpy can help you.


Download and screenshots at: http://code.google.com/p/glumpy/

Nicolas--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Klonuo Umom
Hi,
please consider this snippet:

import matplotlib.pyplot as plt

d={}
for i in range(1,21):
  d[i] = i**2

plt.plot(d.values())
plt.xticks(d.keys())
plt.show()


As it can be seen from attached screenshot, xticks values are shifted to
right (by 1).

Seems strange, but perhaps something to do with Python 0-start.
So why plot starts at beginning of x-axis and xticks start shifted by 1?
How does regular matplotlib users handle similar code?

Thanks
attachment: image.png--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Eric Firing
On 09/17/2011 09:57 AM, Klonuo Umom wrote:
 Hi,
 please consider this snippet:

 import matplotlib.pyplot as plt

 d={}
 for i in range(1,21):
d[i] = i**2

 plt.plot(d.values())

This is plotting values against the zero-based index.  What you want is

plt.plot(d.keys(), d.values())

 plt.xticks(d.keys())
 plt.show()


 As it can be seen from attached screenshot, xticks values are shifted to
 right (by 1).

 Seems strange, but perhaps something to do with Python 0-start.
 So why plot starts at beginning of x-axis and xticks start shifted by 1?
 How does regular matplotlib users handle similar code?

 Thanks



 --
 BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
 http://p.sf.net/sfu/rim-devcon-copy2



 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Benjamin Root
On Saturday, September 17, 2011, Klonuo Umom klo...@gmail.com wrote:
 Hi,
 please consider this snippet:
 import matplotlib.pyplot as plt
 d={}
 for i in range(1,21):
   d[i] = i**2
 plt.plot(d.values())
 plt.xticks(d.keys())
 plt.show()

 As it can be seen from attached screenshot, xticks values are shifted to
right (by 1).
 Seems strange, but perhaps something to do with Python 0-start.
 So why plot starts at beginning of x-axis and xticks start shifted by 1?
 How does regular matplotlib users handle similar code?
 Thanks

When you called plot() with only the y values, mpl will assume x values as
range(len(y)).  Just call plot with both x and y values.

Ben Root
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Klonuo Umom
Thanks for your fast replies.

One more thing if possible: How can I tell xticks() to start at 0 (at x-axis
start)
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Benjamin Root
On Sat, Sep 17, 2011 at 3:22 PM, Klonuo Umom klo...@gmail.com wrote:

 Thanks for your fast replies.

 One more thing if possible: How can I tell xticks() to start at 0 (at
 x-axis start)


Maybe what you want is xtick_labels()?  xticks() merely tells mpl where on
the x-axis you want ticks to show up.  xtick_labels() will tell mpl what to
label each tick (but won't change how many there are and where they are
placed).

Ben Root
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Klonuo Umom
Hm.. it not within matplotlib.pyplot module... needs more digging
OK, thanks

On Sat, Sep 17, 2011 at 10:27 PM, Benjamin Root ben.r...@ou.edu wrote:

 On Sat, Sep 17, 2011 at 3:22 PM, Klonuo Umom klo...@gmail.com wrote:

 Thanks for your fast replies.
 One more thing if possible: How can I tell xticks() to start at 0 (at x-axis 
 start)

 Maybe what you want is xtick_labels()?  xticks() merely tells mpl where on 
 the x-axis you want ticks to show up.  xtick_labels() will tell mpl what to 
 label each tick (but won't change how many there are and where they are 
 placed).

 Ben Root


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread John Hunter
On Sat, Sep 17, 2011 at 3:09 PM, Eric Firing efir...@hawaii.edu wrote:
 On 09/17/2011 09:57 AM, Klonuo Umom wrote:
 Hi,
 please consider this snippet:

 import matplotlib.pyplot as plt

 d={}
 for i in range(1,21):
    d[i] = i**2

 plt.plot(d.values())

 This is plotting values against the zero-based index.  What you want is

 plt.plot(d.keys(), d.values())

While this is safe because calls to keys and values will return lists
in congruent order of no intervening dict modifications are made

http://stackoverflow.com/questions/835092/python-dictionary-are-keys-and-values-always-the-same-order

it is a bit fragile because there is no guarantee the dict keys will
be ordered, right, which is probably not what the OP wants.  Maybe

  x = sorted(d.keys())
  y = [d[k] for k in x]
  plot(x, y)

JDH

--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Klonuo Umom
Yes, I noticed the same and indeed I used sorted values in original problem
I forgot to add it in my simplified snippet

On Sat, Sep 17, 2011 at 10:34 PM, John Hunter jdh2...@gmail.com wrote:

 While this is safe because calls to keys and values will return lists
 in congruent order of no intervening dict modifications are made

 http://stackoverflow.com/questions/835092/python-dictionary-are-keys-and-values-always-the-same-order

 it is a bit fragile because there is no guarantee the dict keys will
 be ordered, right, which is probably not what the OP wants.  Maybe

  x = sorted(d.keys())
  y = [d[k] for k in x]
  plot(x, y)


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Benjamin Root
On Sat, Sep 17, 2011 at 3:33 PM, Klonuo Umom klo...@gmail.com wrote:

 Hm.. it not within matplotlib.pyplot module... needs more digging
 OK, thanks

 On Sat, Sep 17, 2011 at 10:27 PM, Benjamin Root ben.r...@ou.edu wrote:
 
  On Sat, Sep 17, 2011 at 3:22 PM, Klonuo Umom klo...@gmail.com wrote:
 
  Thanks for your fast replies.
  One more thing if possible: How can I tell xticks() to start at 0 (at
 x-axis start)
 
  Maybe what you want is xtick_labels()?  xticks() merely tells mpl where
 on the x-axis you want ticks to show up.  xtick_labels() will tell mpl what
 to label each tick (but won't change how many there are and where they are
 placed).
 
  Ben Root
 



Sorry, I am used to working from the axes objects, not from the pyplot
interface.  Most of the axes methods are available to pyplot, but it looks
like Axes.set_xticklabels() is not available to pyplot.

But honestly, I think you are making this harder than it is.  The line being
drawn starts at (0, 0) coordinates.  The plot is correct, and I am not sure
what you are trying to acheive.

Ben Root
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Klonuo Umom
I want to plot multiple plot lines, and would prefer lines to start at
x-axis beginning (so they source vertically from y-axis)
If I use suggested method from current replies lines would not start
from x-axis beginning, but I guess I'll need to look in Axes module
and make my preferences.
Thanks

On Sat, Sep 17, 2011 at 10:42 PM, Benjamin Root ben.r...@ou.edu wrote:

 Sorry, I am used to working from the axes objects, not from the pyplot
 interface.  Most of the axes methods are available to pyplot, but it looks
 like Axes.set_xticklabels() is not available to pyplot.

 But honestly, I think you are making this harder than it is.  The line being
 drawn starts at (0, 0) coordinates.  The plot is correct, and I am not sure
 what you are trying to acheive.

 Ben Root



--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Benjamin Root
On Sat, Sep 17, 2011 at 3:51 PM, Klonuo Umom klo...@gmail.com wrote:

 I want to plot multiple plot lines, and would prefer lines to start at
 x-axis beginning (so they source vertically from y-axis)
 If I use suggested method from current replies lines would not start
 from x-axis beginning, but I guess I'll need to look in Axes module
 and make my preferences.
 Thanks


Or you could set the x-axis limits...

Ben Root
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticks() shifted by 1

2011-09-17 Thread Klonuo Umom
Yes, that seems the right way
I used it before but forgot it in the mean time

On Sat, Sep 17, 2011 at 10:56 PM, Benjamin Root ben.r...@ou.edu wrote:
 On Sat, Sep 17, 2011 at 3:51 PM, Klonuo Umom klo...@gmail.com wrote:

 I want to plot multiple plot lines, and would prefer lines to start at
 x-axis beginning (so they source vertically from y-axis)
 If I use suggested method from current replies lines would not start
 from x-axis beginning, but I guess I'll need to look in Axes module
 and make my preferences.
 Thanks


 Or you could set the x-axis limits...

 Ben Root



--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [ANN] glumpy 0.2.0

2011-09-17 Thread Nicolas Rougier

Hi folks,

I am pleased to announce a new release of glumpy, a small python library for 
the (very) fast vizualization of numpy arrays, (mainly two dimensional) that 
has been designed with efficiency in mind. If you want to draw nice figures for 
inclusion in a scientific article, you’d better use matplotlib but if you want 
to have a sense of what’s going on in your simulation while it is running, then 
maybe glumpy can help you.


Download and screenshots at: http://code.google.com/p/glumpy/

Nicolas--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Drawing on a figure, not a subplot

2011-09-17 Thread John Ladasky
Hi, JJ,

Thanks for the reply.

On Sat, 2011-09-17 at 23:04 +0900, Jae-Joon Lee wrote:

 Adding a patch to an axes does not mean it cannot be drawn outside of
 axes. As far as you set (or unset) proper clip box, artists can be
 drawn anywhere in the canvas regardless of the axes it belongs to.
 Here is an example,

 ax = subplot(111)

 from matplotlib.patches import FancyArrow
 p = FancyArrow(0.05, 0.5, 0.2, 0.0, width=0.01,
length_includes_head=False,
head_width=None, head_length=None,
shape='full', overhang=0,
head_starts_at_zero=False,
transform=ax.figure.transFigure,
clip_on=False)
 
 ax.add_patch(p)
 
OK, clip boxes are new to me, I will read more.  Your suggestion seems a
bit kludgy for a multi-panel plot like mine, but it looks like it might
get the job done.

 On Sat, Sep 17, 2011 at 6:10 AM, John Ladasky
 john_lada...@sbcglobal.net wrote:
  But that isn't my goal here.  I want to add lines to the FIGURE,
outside
  of any Axes.  Does anyone know how to accomplish this?  Thanks!
 
 Not sure what you mean here.

I'm still fairly new to the Matplotlib code, but I have some experience
with wxPython and its sizers.  Making objects work correctly when they
are resized often depends on choosing the right coordinate system for
scaling.  

In matplotlib, each Artist has its own coordinate space. It seemed most
logical that, for an object that is connected to the whole figure rather
than just one of its subplots, it should use the figure's coordinate
space.  It appears that the transform keyword in your sample code
accomplishes that, though in a roundabout way.

Also, if I understand the structure of a Matplotlib.Artist object
correctly, each has a list of Artist children which gets called
recursively when one issues a draw command for the parent.  Suppose
that, after defining my plot, I should delete the one subplot that
contains my FancyArrows, which happened to be drawn outside of that
subplot's normal clip box?  The FancyArrows would be deleted along with
the subplot.

If defining the object hierarchy correctly is a sample matter of adding
an Artist object of the desired type into the object's list of children,
I would try this.  Given that there are very specific methods like
Figure.text(), Figure.add_subplot(), etc., I suspected that it might be
more involved than that.  These might just be convenience methods.


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Drawing on a figure, not a subplot

2011-09-17 Thread John Hunter
On Fri, Sep 16, 2011 at 4:10 PM, John Ladasky
john_lada...@sbcglobal.net wrote:

 Now I would like to add the axis lines and arrows.  In fact, I would
 prefer a FancyArrow object.

 I can see how to add non-text objects to an Axes, e.g.:

 ax = fig.add_subplot(111)
 ax.add_patch(my_arrow)

 But that isn't my goal here.  I want to add lines to the FIGURE, outside
 of any Axes.  Does anyone know how to accomplish this?  Thanks!

The artist tutorial covers drawing directly to a figure

http://matplotlib.sourceforge.net/users/artists.html#figure-container

I believe you could adapt the patches.FancyArrow to the same approach.

JDH

--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Drawing on a figure, not a subplot

2011-09-17 Thread John Ladasky
On Sat, 2011-09-17 at 19:19 -0500, John Hunter wrote:

 The artist tutorial covers drawing directly to a figure
 
 http://matplotlib.sourceforge.net/users/artists.html#figure-container
 
 I believe you could adapt the patches.FancyArrow to the same approach.

Thanks, John!  I got JJ's approach to work, but I also tried it your way
and it seems to me to generate tidier code.  You don't have to deal with
clip boxes either.

Example:

[code]
aspect = 23.0 / 8.0 # (These are my figure dimensions, X / Y) 
tr = fig.transFigure
w, h = 0.008, 0.02
ha = FancyArrow(0.0175, 0.03, 0.645, 0.0, width=w, head_length=h, \
transform=tr)
va = FancyArrow(0.0125, 0.045, 0.0, 0.845, width=w/aspect, \
head_length=h*aspect, transform=tr)
fig.patches.extend([ha, va])
[/code]

So it would appear that the special methods add_axes and add_subplot
exist only so that the stateful Matlab-like interface can be informed
as to which Axes object is current.  For any other object type, you
just add it to the list of the appropriate type in the Figure object.


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users