[Matplotlib-users] Docs mention "two classes", but actually has three

2014-10-15 Thread mrvelle
On this documentation page: http://matplotlib.org/api/figure_api.html. 

It says: 
The following classes are definedSubplotParams
control the default spacing of the subplots
Figure
top level container for all plot elements 

But actually there are three. The third one is: AxesStack. Or did I
misunderstand smth?



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Docs-mention-two-classes-but-actually-has-three-tp44115.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Get contourf image as array

2014-10-15 Thread David Hoese
I've been searching and reading through source code and google searches 
to see if this is possible, but no luck so far. I'm basically trying to 
map some data using Basemap, use contourf to map it to an image, and 
then put that image in a geotiff (or other format) for use in other GIS 
programs. I have other tools for remapping data and creating geotiffs, 
but the contour image looks better. All I would need to get this to work 
would be an array representing the image inside the axes of a contourf 
plot. I found a lot of geotiff -> Basemap png results, but I would like 
the reverse.

Since the plots are made using paths/patches I'm guessing I would have 
to have a backend render the image and then extract the image somehow. 
Does anyone have some tips or tricks to do something like this? Or am I 
thinking about this completely wrong?

Thanks for any help and if you could CC me in any replies it would be 
much appreciated.

-Dave

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Get contourf image as array

2014-10-15 Thread Joy merwin monteiro
pardon the query if it seems dumb, but why don't you do a savefig()
after plotting the data and then convert it to any format you like?

alternatively, contour() and contourf() both create paths that can
be accessed:

cf = contourf(.)

output = cf.collections.pop()
paths = output.get_paths()[i] # for the various contours

the x,y coordinates can then be accessed as

xcoords = paths.vertices.transpose()[0]
ycoords = paths.vertices.transpose()[1]

you can then do whatever you wish with them.

Joy


On Wed, Oct 15, 2014 at 9:11 PM, David Hoese  wrote:

> I've been searching and reading through source code and google searches
> to see if this is possible, but no luck so far. I'm basically trying to
> map some data using Basemap, use contourf to map it to an image, and
> then put that image in a geotiff (or other format) for use in other GIS
> programs. I have other tools for remapping data and creating geotiffs,
> but the contour image looks better. All I would need to get this to work
> would be an array representing the image inside the axes of a contourf
> plot. I found a lot of geotiff -> Basemap png results, but I would like
> the reverse.
>
> Since the plots are made using paths/patches I'm guessing I would have
> to have a backend render the image and then extract the image somehow.
> Does anyone have some tips or tricks to do something like this? Or am I
> thinking about this completely wrong?
>
> Thanks for any help and if you could CC me in any replies it would be
> much appreciated.
>
> -Dave
>
>
> --
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://p.sf.net/sfu/Zoho
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>



-- 
The best ruler, when he finishes his
tasks and completes his affairs,
the people say
“It all happened naturally”

 - Te Tao Ch'ing
--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Get contourf image as array

2014-10-15 Thread David Hoese
For the first question, if I save the figure (as a PNG I'm guessing, 
unless you can save into a more array-like format), I'd have to make 
sure that there were no labels or ticks and that the axes fit the whole 
figure. I'd also have to get the dpi and size information correct, but I 
suppose it would be possible that way. I was hoping for something a 
little easier and in-memory. This might be the simplest answer the more 
I think about it.

If I'm starting from the paths, I'd still have to write them to the 
"grid" array. I thought maybe the backend could do that and I magically 
get the image.

I'll look in to using savefig and getting the data out.

-Dave

On 10/15/14, 12:42 PM, Joy merwin monteiro wrote:
> pardon the query if it seems dumb, but why don't you do a savefig()
> after plotting the data and then convert it to any format you like?
>
> alternatively, contour() and contourf() both create paths that can
> be accessed:
>
> cf = contourf(.)
>
> output = cf.collections.pop()
> paths = output.get_paths()[i] # for the various contours
>
> the x,y coordinates can then be accessed as
>
> xcoords = paths.vertices.transpose()[0]
> ycoords = paths.vertices.transpose()[1]
>
> you can then do whatever you wish with them.
>
> Joy
>
>
> On Wed, Oct 15, 2014 at 9:11 PM, David Hoese  > wrote:
>
> I've been searching and reading through source code and google searches
> to see if this is possible, but no luck so far. I'm basically trying to
> map some data using Basemap, use contourf to map it to an image, and
> then put that image in a geotiff (or other format) for use in other GIS
> programs. I have other tools for remapping data and creating geotiffs,
> but the contour image looks better. All I would need to get this to work
> would be an array representing the image inside the axes of a contourf
> plot. I found a lot of geotiff -> Basemap png results, but I would like
> the reverse.
>
> Since the plots are made using paths/patches I'm guessing I would have
> to have a backend render the image and then extract the image somehow.
> Does anyone have some tips or tricks to do something like this? Or am I
> thinking about this completely wrong?
>
> Thanks for any help and if you could CC me in any replies it would be
> much appreciated.
>
> -Dave
>
> 
> --
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push
> notifications.
> Take corrective actions from your mobile device.
> http://p.sf.net/sfu/Zoho
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> The best ruler, when he finishes his
> tasks and completes his affairs,
> the people say
> “It all happened naturally”
>
>   - Te Tao Ch'ing

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] FW: traceback when import matplotlib.pyplot twice

2014-10-15 Thread Mark Janikas
When I replaced the file I got the 1st error below.   As you had pointed out 
earlier… this is strange.  It only occurs when you run it more than once… 
strange indeed… it is like a manager is being created and deleted but perhaps 
the reference hasn’t… so you get a no-op on the subsequent import.. but are 
then left with a manager that is None….?? Thanks for the tip BTW… I replaced 
all my None comparisons to “is” and “is not”.   I went ahead and added the 
comparisons to your changes and it works… but now you need to assure that you 
do not gc.collect unless you had at least one Non-None manager or else you get 
the 2nd traceback.  The code that works on my end is the last image… not sure 
if it passes your regression tests..??..??



Thanks so much for all of your help… please let me know if there is anything 
else I can do to help.



MJ





[cid:image001.png@01CFE881.FB6CCAF0]



[cid:image002.png@01CFE888.2A514840]



[cid:image003.png@01CFE888.2A514840]

-Original Message-

From: Thomas Caswell [mailto:tcasw...@gmail.com]

Sent: Saturday, October 11, 2014 2:18 PM

To: Phil Elson

Cc: Mark Janikas; Benjamin Root; Matplotlib Users

Subject: Re: [Matplotlib-users] FW: traceback when import matplotlib.pyplot 
twice



See https://github.com/matplotlib/matplotlib/pull/3638



That might help to make sure that things tear them selves down in the right 
order.



Tom



On Sat, Oct 11, 2014 at 10:12 AM, Phil Elson  wrote:

>

> On 10 October 2014 19:10, Thomas Caswell  wrote:

>>

>> I suspect a better fix is to change all of the staticmethods ->

>> classmethods

>

>

>

> +1







--

Thomas Caswell

tcasw...@gmail.com


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] TkAgg problem: blank plot on MacOS

2014-10-15 Thread Russell Owen
I have a polar graph that works fine on linux but is blank on MacOS 
10.9. Here is a minimal working example (using the API because it is 
part of a larger Tkinter application):

#!/usr/bin/env python2
import Tkinter
import matplotlib
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg

root = Tkinter.Tk()
root["bg"] = "green" # the green should be hidden by the plot

plotFig = matplotlib.figure.Figure(figsize=(5, 5), frameon=False)
figCanvas = FigureCanvasTkAgg(plotFig, root)
figCanvas.get_tk_widget().pack()
axis = plotFig.add_subplot(1, 1, 1, polar=True, autoscale_on=True)

r = (0.1, 0.4, 0.6, 0.8)
theta = (0, 1.5, 3.0, 4.5) # radians, 0 to right. pi/2 up
axis.plot(theta, r, marker="o", markeredgecolor="black", markersize=3)
figCanvas.draw()

root.mainloop()


On MacOS 10.9 when I run this from Terminal I see a green window (rather 
than the plot I expect). When I click on the plot window to bring it to 
the front, the window turns white with a thin black border (presumably 
the plot, but with no content).

Details:
- matplotlib 1.3.1
- Tcl/Tk 8.5.11 (for good reasons, unfortunately)
- python.org python 2.7.6, running in 32-bit mode (due to a known issue 
with MacOS 10.9 and this old version of Tcl/Tk)

Any ideas how to get the plot to show?

-- Russell


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] FW: traceback when import matplotlib.pyplot twice

2014-10-15 Thread Matthew Brett
Hi,

On Wed, Oct 15, 2014 at 2:56 PM, Mark Janikas  wrote:
>
> When I replaced the file I got the 1st error below.   As you had pointed out 
> earlier… this is strange.  It only occurs when you run it more than once… 
> strange indeed… it is like a manager is being created and deleted but perhaps 
> the reference hasn’t

Just to echo what Tom said, the error suggests that ``gc.collect()``
is being called after the gc module is most of the way through being
torn down, so that the ``collect`` function has already been
deleted...

Cheers,

Matthew

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] FW: traceback when import matplotlib.pyplot twice

2014-10-15 Thread Mark Janikas
Thanks for the reiteration/clarification...  Do you see any reason why a 
fail-safe check similar to what I proposed would be ill advised?

MJ

-Original Message-
From: Matthew Brett [mailto:matthew.br...@gmail.com] 
Sent: Wednesday, October 15, 2014 3:44 PM
To: Mark Janikas
Cc: Thomas Caswell; Phil Elson; Benjamin Root; Matplotlib Users
Subject: Re: [Matplotlib-users] FW: traceback when import matplotlib.pyplot 
twice

Hi,

On Wed, Oct 15, 2014 at 2:56 PM, Mark Janikas  wrote:
>
> When I replaced the file I got the 1st error below.   As you had pointed out 
> earlier… this is strange.  It only occurs when you run it more than once… 
> strange indeed… it is like a manager is being created and deleted but perhaps 
> the reference hasn’t

Just to echo what Tom said, the error suggests that ``gc.collect()`` is being 
called after the gc module is most of the way through being torn down, so that 
the ``collect`` function has already been deleted...

Cheers,

Matthew

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users