[Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Andreas H.
Good morning,

I'm creating the attached plot using pcolormesh(). What I would like to
do now is draw contour lines at +/- 2.5%, which follow the grid edges.

The problem is that when I use contour(), the lines drawn do not follow
the grid edges but seem to be interpolated somehow.

Do you have an idea how to draw the contour lines following the grid edges?

Your insight is very much appreciated :)

Cheers,
Andreas.
<>--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Benjamin Root
On Tuesday, February 28, 2012, Andreas H. wrote:

> Good morning,
>
> I'm creating the attached plot using pcolormesh(). What I would like to
> do now is draw contour lines at +/- 2.5%, which follow the grid edges.
>
> The problem is that when I use contour(), the lines drawn do not follow
> the grid edges but seem to be interpolated somehow.
>
> Do you have an idea how to draw the contour lines following the grid edges?
>
> Your insight is very much appreciated :)
>
> Cheers,
> Andreas.
>

This is because of a subtle difference in how pcolor-like functions and
contour-like functions work.  I always forget which is which, but one
assumes that the z value lies on the vertices of the grid while the other
assumes that it lies in the middle of each grid point.  This is why you see
them slightly offset from each other.

I hope that clarifies everything for you.

Ben Root
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Ryan May
On Tue, Feb 28, 2012 at 9:10 AM, Benjamin Root  wrote:
> On Tuesday, February 28, 2012, Andreas H. wrote:
>>
>> Good morning,
>>
>> I'm creating the attached plot using pcolormesh(). What I would like to
>> do now is draw contour lines at +/- 2.5%, which follow the grid edges.
>>
>> The problem is that when I use contour(), the lines drawn do not follow
>> the grid edges but seem to be interpolated somehow.
>>
>> Do you have an idea how to draw the contour lines following the grid
>> edges?
>>
>> Your insight is very much appreciated :)
>>
>> Cheers,
>> Andreas.
>
>
> This is because of a subtle difference in how pcolor-like functions and
> contour-like functions work.  I always forget which is which, but one
> assumes that the z value lies on the vertices of the grid while the other
> assumes that it lies in the middle of each grid point.  This is why you see
> them slightly offset from each other.

By definitition, with pcolormesh you're giving it the edges of the
grid cells. In fact, for an NxN grid of data, you should have N+1xN+1
grids of x,y values. Contour is given the actual grid and values.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Andreas H.
>> On Tuesday, February 28, 2012, Andreas H. wrote:
>>
>>> Good morning,
>>>
>>> I'm creating the attached plot using pcolormesh(). What I would like to
>>> do now is draw contour lines at +/- 2.5%, which follow the grid edges.
>>>
>>> The problem is that when I use contour(), the lines drawn do not follow
>>> the grid edges but seem to be interpolated somehow.
>>>
>>> Do you have an idea how to draw the contour lines following the grid
>>> edges?
>>>
>>> Your insight is very much appreciated :)
>>>
>>> Cheers,
>>> Andreas.
>>>
>>
>> This is because of a subtle difference in how pcolor-like functions and
>> contour-like functions work.  I always forget which is which, but one
>> assumes that the z value lies on the vertices of the grid while the
>> other
>> assumes that it lies in the middle of each grid point.  This is why you
>> see
>> them slightly offset from each other.
>
> Thanks, Ben!
>
> To `pcolormesh`, I pass the *edges* of the grid:
>
> xbin = linspace(0, 12, nxbin + 1)
> ybin = np.linspace(-90, 90, nybin + 1)
>
> pl = spl.pcolormesh(xbin, ybin, pdata.T, cmap=cmap, edgecolors='None',
> vmin=-5, vmax=20)
>
> `contour`, however, wants the coordinates themselves. So I do
>
> spl.contour((xbin[:-1]+xbin[1:])/2., (ybin[:-1]+ybin[1:])/2, pdata.T,
> [-2.5, 2.5])
>
> Still, the outcome is, well, unexpected to me. Actually, no matter if
> contour wants centres or edges, the actual behaviour seems strange. There
> is some interpolation going on, apparently. The input `pdata` has shape
> (12, 72) (or 72,12), and I definitely wouldn't expect this sub-grid
> movement in the x-direction.
>
> Any ideas?

Okay, after some diving into matplotlib sources, I guess the interpolation
comes within the function `QuadContourSet._get_allsegs_and_allkinds`. So
there seems to be no way to accomplish what I actually want with the
current matplotlib API. Correct?

If I wanted to do something about this, I would need to

* implement a class `GriddedContourSet`, derived from `ContourSet`, where
I implement the `_get_allsegs_and_allkinds` method appropriately.
* add an additional keyword argument to `contour()` to make this gridded
contourset an option when calling `contour()`.

Is this all correct? If yes, I might start working on this if I get the
time ...

Cheers,
Andreas.




--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Eric Firing
On 02/28/2012 06:28 AM, Andreas H. wrote:
>>> On Tuesday, February 28, 2012, Andreas H. wrote:
>>>
 Good morning,

 I'm creating the attached plot using pcolormesh(). What I would like to
 do now is draw contour lines at +/- 2.5%, which follow the grid edges.

 The problem is that when I use contour(), the lines drawn do not follow
 the grid edges but seem to be interpolated somehow.

 Do you have an idea how to draw the contour lines following the grid
 edges?

 Your insight is very much appreciated :)

 Cheers,
 Andreas.

>>>
>>> This is because of a subtle difference in how pcolor-like functions and
>>> contour-like functions work.  I always forget which is which, but one
>>> assumes that the z value lies on the vertices of the grid while the
>>> other
>>> assumes that it lies in the middle of each grid point.  This is why you
>>> see
>>> them slightly offset from each other.
>>
>> Thanks, Ben!
>>
>> To `pcolormesh`, I pass the *edges* of the grid:
>>
>>  xbin = linspace(0, 12, nxbin + 1)
>>  ybin = np.linspace(-90, 90, nybin + 1)
>>
>>  pl = spl.pcolormesh(xbin, ybin, pdata.T, cmap=cmap, edgecolors='None',
>>  vmin=-5, vmax=20)
>>
>> `contour`, however, wants the coordinates themselves. So I do
>>
>>  spl.contour((xbin[:-1]+xbin[1:])/2., (ybin[:-1]+ybin[1:])/2, pdata.T,
>> [-2.5, 2.5])
>>
>> Still, the outcome is, well, unexpected to me. Actually, no matter if
>> contour wants centres or edges, the actual behaviour seems strange. There
>> is some interpolation going on, apparently. The input `pdata` has shape
>> (12, 72) (or 72,12), and I definitely wouldn't expect this sub-grid
>> movement in the x-direction.
>>
>> Any ideas?
>
> Okay, after some diving into matplotlib sources, I guess the interpolation
> comes within the function `QuadContourSet._get_allsegs_and_allkinds`. So
> there seems to be no way to accomplish what I actually want with the
> current matplotlib API. Correct?
>
> If I wanted to do something about this, I would need to
>
> * implement a class `GriddedContourSet`, derived from `ContourSet`, where
> I implement the `_get_allsegs_and_allkinds` method appropriately.
> * add an additional keyword argument to `contour()` to make this gridded
> contourset an option when calling `contour()`.
>
> Is this all correct? If yes, I might start working on this if I get the
> time ...

It is not at all clear to me what you want to do, as compared to what 
contour does.  Can you illustrate with an extremely simple example? 
Maybe even a scanned sketch, if necessary? Do you want the contour lines 
to be stepped, like the rectilinear boundaries of the pcolormesh 
cells--that is, composed entirely of horizontal and vertical line segments?

Eric

>
> Cheers,
> Andreas.
>
>
>
>
> --
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Andreas H.
Am 28.02.2012 18:56, schrieb Eric Firing:
> On 02/28/2012 06:28 AM, Andreas H. wrote:
 On Tuesday, February 28, 2012, Andreas H. wrote:

> Good morning,
>
> I'm creating the attached plot using pcolormesh(). What I would like to
> do now is draw contour lines at +/- 2.5%, which follow the grid edges.
>
> The problem is that when I use contour(), the lines drawn do not follow
> the grid edges but seem to be interpolated somehow.
>
> Do you have an idea how to draw the contour lines following the grid
> edges?
>
> Your insight is very much appreciated :)
>
> Cheers,
> Andreas.
>

 This is because of a subtle difference in how pcolor-like functions and
 contour-like functions work.  I always forget which is which, but one
 assumes that the z value lies on the vertices of the grid while the
 other
 assumes that it lies in the middle of each grid point.  This is why you
 see
 them slightly offset from each other.
>>>
>>> Thanks, Ben!
>>>
>>> To `pcolormesh`, I pass the *edges* of the grid:
>>>
>>>  xbin = linspace(0, 12, nxbin + 1)
>>>  ybin = np.linspace(-90, 90, nybin + 1)
>>>
>>>  pl = spl.pcolormesh(xbin, ybin, pdata.T, cmap=cmap, edgecolors='None',
>>>  vmin=-5, vmax=20)
>>>
>>> `contour`, however, wants the coordinates themselves. So I do
>>>
>>>  spl.contour((xbin[:-1]+xbin[1:])/2., (ybin[:-1]+ybin[1:])/2, pdata.T,
>>> [-2.5, 2.5])
>>>
>>> Still, the outcome is, well, unexpected to me. Actually, no matter if
>>> contour wants centres or edges, the actual behaviour seems strange. There
>>> is some interpolation going on, apparently. The input `pdata` has shape
>>> (12, 72) (or 72,12), and I definitely wouldn't expect this sub-grid
>>> movement in the x-direction.
>>>
>>> Any ideas?
>>
>> Okay, after some diving into matplotlib sources, I guess the interpolation
>> comes within the function `QuadContourSet._get_allsegs_and_allkinds`. So
>> there seems to be no way to accomplish what I actually want with the
>> current matplotlib API. Correct?
>>
>> If I wanted to do something about this, I would need to
>>
>> * implement a class `GriddedContourSet`, derived from `ContourSet`, where
>> I implement the `_get_allsegs_and_allkinds` method appropriately.
>> * add an additional keyword argument to `contour()` to make this gridded
>> contourset an option when calling `contour()`.
>>
>> Is this all correct? If yes, I might start working on this if I get the
>> time ...
> 
> It is not at all clear to me what you want to do, as compared to what 
> contour does.  Can you illustrate with an extremely simple example? 
> Maybe even a scanned sketch, if necessary? Do you want the contour lines 
> to be stepped, like the rectilinear boundaries of the pcolormesh 
> cells--that is, composed entirely of horizontal and vertical line segments?

Yes, Eric, that's exactly what I want. Since my case was simple enough,
I did it completely manually, with loads of calls to `plot` (I'm sure
there would've been a simpler solution ... -- which one?). I attached
the plot so you get an idea of what I want to do.

Thanks for your help!
Andreas.


example.pdf
Description: Adobe PDF document
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Eric Firing
On 02/28/2012 08:08 AM, Andreas H. wrote:
> Am 28.02.2012 18:56, schrieb Eric Firing:
>> On 02/28/2012 06:28 AM, Andreas H. wrote:
> On Tuesday, February 28, 2012, Andreas H. wrote:
>
>> Good morning,
>>
>> I'm creating the attached plot using pcolormesh(). What I would like to
>> do now is draw contour lines at +/- 2.5%, which follow the grid edges.
>>
>> The problem is that when I use contour(), the lines drawn do not follow
>> the grid edges but seem to be interpolated somehow.
>>
>> Do you have an idea how to draw the contour lines following the grid
>> edges?
>>
>> Your insight is very much appreciated :)
>>
>> Cheers,
>> Andreas.
>>
>
> This is because of a subtle difference in how pcolor-like functions and
> contour-like functions work.  I always forget which is which, but one
> assumes that the z value lies on the vertices of the grid while the
> other
> assumes that it lies in the middle of each grid point.  This is why you
> see
> them slightly offset from each other.

 Thanks, Ben!

 To `pcolormesh`, I pass the *edges* of the grid:

   xbin = linspace(0, 12, nxbin + 1)
   ybin = np.linspace(-90, 90, nybin + 1)

   pl = spl.pcolormesh(xbin, ybin, pdata.T, cmap=cmap, 
 edgecolors='None',
   vmin=-5, vmax=20)

 `contour`, however, wants the coordinates themselves. So I do

   spl.contour((xbin[:-1]+xbin[1:])/2., (ybin[:-1]+ybin[1:])/2, pdata.T,
 [-2.5, 2.5])

 Still, the outcome is, well, unexpected to me. Actually, no matter if
 contour wants centres or edges, the actual behaviour seems strange. There
 is some interpolation going on, apparently. The input `pdata` has shape
 (12, 72) (or 72,12), and I definitely wouldn't expect this sub-grid
 movement in the x-direction.

 Any ideas?
>>>
>>> Okay, after some diving into matplotlib sources, I guess the interpolation
>>> comes within the function `QuadContourSet._get_allsegs_and_allkinds`. So
>>> there seems to be no way to accomplish what I actually want with the
>>> current matplotlib API. Correct?
>>>
>>> If I wanted to do something about this, I would need to
>>>
>>> * implement a class `GriddedContourSet`, derived from `ContourSet`, where
>>> I implement the `_get_allsegs_and_allkinds` method appropriately.
>>> * add an additional keyword argument to `contour()` to make this gridded
>>> contourset an option when calling `contour()`.
>>>
>>> Is this all correct? If yes, I might start working on this if I get the
>>> time ...
>>
>> It is not at all clear to me what you want to do, as compared to what
>> contour does.  Can you illustrate with an extremely simple example?
>> Maybe even a scanned sketch, if necessary? Do you want the contour lines
>> to be stepped, like the rectilinear boundaries of the pcolormesh
>> cells--that is, composed entirely of horizontal and vertical line segments?
>
> Yes, Eric, that's exactly what I want. Since my case was simple enough,
> I did it completely manually, with loads of calls to `plot` (I'm sure
> there would've been a simpler solution ... -- which one?). I attached
> the plot so you get an idea of what I want to do.

Andreas,

I have never seen a contour algorithm with an option to do that, but I 
understand the motivation.  I don't think it would be easy to implement; 
contouring algorithms generally are not.

You might get an adequate approximation by using nearest-neighbor 
interpolation to interpolate your data to a very fine grid, and then 
contour that.

Eric

>
> Thanks for your help!
> Andreas.
>
>
>
> --
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] get parent or child from twinx() or twiny()

2012-02-28 Thread Federico Ariza
Hello everybody

This is my first post to the list.

To the point.
I want to access the all the axes located  where a mouse event occurred.

My first try is with button_release_event
The event will include inaxes, so I know the axes where the mouse event
occurred.
This is fine if at that location I have only one axes.

If I have a twinx or twiny I only get the axes with the biggest zorder.

The example:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(100),range(100))
ax1 = ax.twinx()
plt.show()

The question
Having either ax or ax1 is it possible to find the other?
In other words, from a given axes instance, is it possible to know which
other axes
"share" the same xaxis or yaxis?


Thanks
Federico


-- 
Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?

-- Antonio Alducin --
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Andreas H.
Am Di 28 Feb 2012 19:23:14 CET schrieb Eric Firing:
> On 02/28/2012 08:08 AM, Andreas H. wrote:
>> Am 28.02.2012 18:56, schrieb Eric Firing:
>>> On 02/28/2012 06:28 AM, Andreas H. wrote:
>> On Tuesday, February 28, 2012, Andreas H. wrote:
>>
>>> Good morning,
>>>
>>> I'm creating the attached plot using pcolormesh(). What I would like to
>>> do now is draw contour lines at +/- 2.5%, which follow the grid edges.
>>>
>>> The problem is that when I use contour(), the lines drawn do not follow
>>> the grid edges but seem to be interpolated somehow.
>>>
>>> Do you have an idea how to draw the contour lines following the grid
>>> edges?
>>>
>>> Your insight is very much appreciated :)
>>>
>>> Cheers,
>>> Andreas.
>>>
>>
>> This is because of a subtle difference in how pcolor-like functions and
>> contour-like functions work.  I always forget which is which, but one
>> assumes that the z value lies on the vertices of the grid while the
>> other
>> assumes that it lies in the middle of each grid point.  This is why you
>> see
>> them slightly offset from each other.
>
> Thanks, Ben!
>
> To `pcolormesh`, I pass the *edges* of the grid:
>
>   xbin = linspace(0, 12, nxbin + 1)
>   ybin = np.linspace(-90, 90, nybin + 1)
>
>   pl = spl.pcolormesh(xbin, ybin, pdata.T, cmap=cmap, 
> edgecolors='None',
>   vmin=-5, vmax=20)
>
> `contour`, however, wants the coordinates themselves. So I do
>
>   spl.contour((xbin[:-1]+xbin[1:])/2., (ybin[:-1]+ybin[1:])/2, 
> pdata.T,
> [-2.5, 2.5])
>
> Still, the outcome is, well, unexpected to me. Actually, no matter if
> contour wants centres or edges, the actual behaviour seems strange. There
> is some interpolation going on, apparently. The input `pdata` has shape
> (12, 72) (or 72,12), and I definitely wouldn't expect this sub-grid
> movement in the x-direction.
>
> Any ideas?

 Okay, after some diving into matplotlib sources, I guess the interpolation
 comes within the function `QuadContourSet._get_allsegs_and_allkinds`. So
 there seems to be no way to accomplish what I actually want with the
 current matplotlib API. Correct?

 If I wanted to do something about this, I would need to

 * implement a class `GriddedContourSet`, derived from `ContourSet`, where
 I implement the `_get_allsegs_and_allkinds` method appropriately.
 * add an additional keyword argument to `contour()` to make this gridded
 contourset an option when calling `contour()`.

 Is this all correct? If yes, I might start working on this if I get the
 time ...
>>>
>>> It is not at all clear to me what you want to do, as compared to what
>>> contour does.  Can you illustrate with an extremely simple example?
>>> Maybe even a scanned sketch, if necessary? Do you want the contour lines
>>> to be stepped, like the rectilinear boundaries of the pcolormesh
>>> cells--that is, composed entirely of horizontal and vertical line segments?
>>
>> Yes, Eric, that's exactly what I want. Since my case was simple enough,
>> I did it completely manually, with loads of calls to `plot` (I'm sure
>> there would've been a simpler solution ... -- which one?). I attached
>> the plot so you get an idea of what I want to do.
>
> Andreas,
>
> I have never seen a contour algorithm with an option to do that, but I 
> understand the motivation.  I don't think it would be easy to implement; 
> contouring algorithms generally are not.
>
> You might get an adequate approximation by using nearest-neighbor 
> interpolation to interpolate your data to a very fine grid, and then 
> contour that.

Eric,

thanks, that's a good hint. I took a look into the C source of the 
contour algorithm and decided not to bother right now. But your 
suggestion should do it.

Cheers,
Andreas.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question(s) for new MAC 10.7 User

2012-02-28 Thread Russell E. Owen
In article 
,
 William Jennings  
 wrote:

>  Hello mat plot lib users!
> I feel quite embarrassed that I've gone through 2 days of trying to get to
> get numpy, scipy and matplotlib all to work nice with each other. I've
> scraped through forums, stackoverflow and all the links that can bide me
> some type of logic. Yet, alas I still fail wildly with this set of errors:
> 
> *my current status is: just did a fresh install of my lion os and haven't
> installed Xcode yet. I'm a little lost and have found only macports,
> homebrew guides online only to be a slower failure. I really need to use
> this software but I'm finding it difficult keeping straight what order and
> what I need to install. 

I recommend:
- Install python.org 64-bit Python 2.7 (the one labelled as being for 
MacOS X 10.6 and later)
- Install numpy, scipy and matplotlib Mac binary with "macosx10.6" in 
their names. These are available from the web sites maintained by those 
projects.

Or if you want better backward compatibility (e.g. if you plan to 
distribute applications) then instead you should use the 32-bit 
python.org python (marked as for MacOS X 10.3 and later) and the numpy, 
scipy and matplotlib Mac binary installers with "macosx10.3" in their 
names.

-- Russell


--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] get parent or child from twinx() or twiny()

2012-02-28 Thread John Hunter
On Tue, Feb 28, 2012 at 12:45 PM, Federico Ariza
wrote:

> Hello everybody
>
> This is my first post to the list.
>

Welcome.

>
> To the point.
> I want to access the all the axes located  where a mouse event occurred.
>
> My first try is with button_release_event
> The event will include inaxes, so I know the axes where the mouse event
> occurred.
> This is fine if at that location I have only one axes.
>
> If I have a twinx or twiny I only get the axes with the biggest zorder.
>
> The example:
>
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.plot(range(100),range(100))
> ax1 = ax.twinx()
> plt.show()
>


You can get all the x-axes shares with "ax1" (not including ax1) with the
following:

sharedx = [ax for ax in ax1.get_shared_x_axes().get_siblings(ax1) if ax
is not ax1]

sharedx is a list of axes who share the x-axis with ax1



>
> The question
> Having either ax or ax1 is it possible to find the other?
> In other words, from a given axes instance, is it possible to know which
> other axes
> "share" the same xaxis or yaxis?
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] draw_event

2012-02-28 Thread Antoine Sirinelli
Hi,

I have been using the event "draw_event" for a while with the old matplotlib 
0.8. I have tested my program with newer versions but it seems the function 
connected to "draw_event" is never called.

You can find an example of this there: https://gist.github.com/1901504

With an old version the image color scale is rescaled when you zoom in. With 
matplotlib 1.x, no change is made on on the color scale.

Have I missed something?

Thanks in advance for your help.

Antoine

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Set width before saving

2012-02-28 Thread Mario Fuest
Hi there,

Currently i use these commands to layout and save my figures:

 > figure
 > ...
 > gca.set_aspect('equal')
 > gca.autoscale(tight=True)
 > ...
 > plt.savefig('fpp.png', bbox_inches='tight', pad_inches=0)

I would like to set the width of this png file, how to do that? If
savefig() does not support setting the width, maybe I can set the width
of my xaxis?

Thanks in advance, Keba

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fixed width - axis equal *and* tight

2012-02-28 Thread Mario Fuest
Hi,

Sorry for the late reply.

Tony Yu  schrieb am Tue, 03. Jan 17:07:
> You can try
> 
> >>> ax.set_aspect('equal')
> >>> ax.autoscale(tight=True)
> 
> The order doesn't seem to matter.

That works well, thank you! :)

Kind regars, Keba.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Set width before saving

2012-02-28 Thread Benjamin Root
On Tue, Feb 28, 2012 at 3:48 PM, Mario Fuest  wrote:

> Hi there,
>
> Currently i use these commands to layout and save my figures:
>
>  > figure
>  > ...
>  > gca.set_aspect('equal')
>  > gca.autoscale(tight=True)
>  > ...
>  > plt.savefig('fpp.png', bbox_inches='tight', pad_inches=0)
>
> I would like to set the width of this png file, how to do that? If
> savefig() does not support setting the width, maybe I can set the width
> of my xaxis?
>
> Thanks in advance, Keba
>
>
The size of the PNG will be based on the size of your figure object.  When
you create your figure, you can pass a figsize kwarg which takes a tuple of
width, height in inches (defaults to 8 x 6, I think).

fig = plt.figure(figsize=(10.0, 6.0))

I hope that helps!
Ben Root
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Moore, Eric (NIH/NIDDK) [F]
I think that what you want can be achieved more simply than contouring.  I've 
attached a quick example of how I would do this.  I'm assuming that the data 
has the same form as pcolormesh, i.e, the z values are measured at grid centers 
but we have coordinate of the edges.  This means that we can easily check if a 
given pixel is above or below the contour level and then we simply draw the 
appropriate gridlines.  I'm not coalescing neighboring lines, but that's also 
possible. 

If you're looking for something more complex than this simple in-or-out 
partitioning, this approach might still work but I'm not sure, in that case, 
that I understand what you're actually trying to do. 

-Eric

p.s. two loops aren't necessary, really.
<>

lattice_cntr_demo.py
Description: lattice_cntr_demo.py
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] draw_event

2012-02-28 Thread Tony Yu
On Tue, Feb 28, 2012 at 4:05 PM, Antoine Sirinelli  wrote:

> Hi,
>
> I have been using the event "draw_event" for a while with the old
> matplotlib 0.8. I have tested my program with newer versions but it seems
> the function connected to "draw_event" is never called.
>
> You can find an example of this there: https://gist.github.com/1901504
>
> With an old version the image color scale is rescaled when you zoom in.
> With matplotlib 1.x, no change is made on on the color scale.
>
> Have I missed something?
>
> Thanks in advance for your help.
>
> Antoine
>

Hey Antoine,

I'm not sure what changed in the mean time, but the problem is that the
instances of `az_imshow` aren't saved to anything (e.g. you should write
`implot2 = az_imshow(data, aspect='auto')`). I *think* what happens is that
you don't have any references to the object so it gets garbage-collected
and the events you create disappear. That's my made-up explanation.

-Tony
--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Combining pcolormesh and contour

2012-02-28 Thread Andreas H.
> I think that what you want can be achieved more simply than contouring.
> I've attached a quick example of how I would do this.  I'm assuming that
> the data has the same form as pcolormesh, i.e, the z values are measured
> at grid centers but we have coordinate of the edges.  This means that we
> can easily check if a given pixel is above or below the contour level and
> then we simply draw the appropriate gridlines.  I'm not coalescing
> neighboring lines, but that's also possible.
>
> If you're looking for something more complex than this simple in-or-out
> partitioning, this approach might still work but I'm not sure, in that
> case, that I understand what you're actually trying to do.

Eric, I'm amazed -- thanks a lot :)
Andreas.


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users