Re: [Matplotlib-users] cbook.report_memory IOError

2013-07-17 Thread Benjamin Root
I have a vague recollection of a similar problem faced by @dopplershift
when he was updating the animation module to pipe a stream to a
mencoder/ffmpeg process on certain Macs.  Maybe this is the same problem?


On Wed, Jul 17, 2013 at 9:18 AM, Michael Droettboom  wrote:

> To debug, it might be helpful to try
>
> ps -p PID -o rss,vsz
>
> (where PID is the process id of an interesting process)
>
> and see what happens.
>
> Mike
>
> On 07/17/2013 02:05 AM, Eric Firing wrote:
> > On 2013/07/16 5:50 PM, K.-Michael Aye wrote:
> >> Hi!
> >>
> >> I have just run an old code that I believe was working before on OSX.
> >> I am trying this with matplotlib 1.2.1 on an OSX EPD running Python
> 2.7.3
> > It works for me with OSX  Mountain Lion and mpl 1.2.1 compiled from
> > source.  I don't think this is fundamentally a problem with
> > cbook.report_memory.
> >
> > Eric
> >
> >>
> >> In [1]: from matplotlib.pylab import *
> >>
> >> In [2]: import matplotlib.cbook as cbook
> >>
> >> In [3]: data = ones((1500,1500,3))
> >>
> >> In [4]: imshow(data)
> >> Out[4]: 
> >>
> >> In [5]: ax = gca()
> >>
> >> In [6]: print cbook.report_memory()
> >>
> ---
> >> IOError   Traceback (most recent call
> last)
> >>  in ()
> >> > 1 print cbook.report_memory()
> >>
> >>
> /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/cbook.py
> >> in report_memory(i)
> >>  1210 elif sys.platform.startswith('darwin'):
> >>  1211 a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
> >> -> 1212stdout=PIPE).stdout.readlines()
> >>  1213 mem = int(a2[1].split()[0])
> >>  1214 elif sys.platform.startswith('win'):
> >>
> >> IOError: [Errno 4] Interrupted system call
> >>
> >> First I thought, maybe this doesn't run in IPython for a reason, but
> >> trying it as a script also fails:
> >>
> >> (general_dev+)[maye@lunatic ~/Dropbox/src/pymars]$ python
> imshow_test.py
> >> Traceback (most recent call last):
> >> File "imshow_test.py", line 7, in 
> >>   print cbook.report_memory()
> >> File
> >>
> "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/cbook.py",
> >> line 1212, in report_memory
> >>   stdout=PIPE).stdout.readlines()
> >> IOError: [Errno 4] Interrupted system call
> >>
> >>
> >> Is this cbook recipe maybe broken?
> >>
> >> Best,
> >> Michael
> >>
> >>
> >>
> >>
> >>
> --
> >> See everything from the browser to the database with AppDynamics
> >> Get end-to-end visibility with application monitoring from AppDynamics
> >> Isolate bottlenecks and diagnose root cause in seconds.
> >> Start your free trial of AppDynamics Pro today!
> >>
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> >> ___
> >> Matplotlib-users mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>
> >
> >
> --
> > See everything from the browser to the database with AppDynamics
> > Get end-to-end visibility with application monitoring from AppDynamics
> > Isolate bottlenecks and diagnose root cause in seconds.
> > Start your free trial of AppDynamics Pro today!
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> > ___
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3d have improved handling of label placement yet

2013-07-18 Thread Benjamin Root
Jeffrey,

Sorry if the documentation is a bit vague on the _axinfo front.  It was
intentionally done that way to keep the number of people dependent upon
that kludge down.  It was created as an improvement upon the previous
hard-coded constants that completely prevented anybody from making any
customizations at all.

The spacing of tick labels for an axis can be modified like so:

ax.xaxis._axinfo['ticklabel']['space_factor'] = 0.7   # This is the default
value. Make it less to bring it closer to the axis

and for the axis label:

ax.xaxis._axinfo['label']['space_factor'] = 1.6  # Again, this is the
default value. Make it larger to move it away from the axis

I hope that helps!
Ben Root



On Thu, Jul 18, 2013 at 3:18 AM, Jeffrey Spencer wrote:

> I have a problem with labels overlapping the tickmark labels. No matter
> changing the fontsize or plot_size or other things. I can't find something
> that works properly. I found somethwhere setting linespacing should work
> but this seems to do nothing in my case.
>
> Any good suggestions or updates on this??
>
> I'm using 1.2.x matplotlib version. I put a plot here showing how the
> label overlaps but I know this has been a problem in the past.
>
> Also, I couldn't figure out how to get access to the _axinfo like stated
> in the documentation for a possible fix. Where is this located?? How do I
> acess or modify it as a temporary fix??
>
>
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: Matplotlib backend issue

2013-07-19 Thread Benjamin Root
What does "print matplotlib.get_backend()" say?
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animations with python and gtk3

2013-07-24 Thread Benjamin Root
On Wed, Jul 24, 2013 at 3:09 AM, Gurinder Singh Gill wrote:

> I am using python 2.7 and matplotlib animations example .
> when i am using gtk2 as a reference the plots works fine
> but when i change the backend to gtk3 i start getting errors .
> can someone help with that
> how to work with animations / blit in gtk3
>
>
It would be helpful to know which version of matplotlib you are using,
which example you are referring to (I can guess, but I would rather know
for sure) and/or a minimal self-contained example that demonstrates the
problem you are having.

Cheers!
Ben Root
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Outputting to eps with Mplot3d one of the walls loses its lines.

2013-08-02 Thread Benjamin Root
On Fri, Jul 26, 2013 at 4:41 PM, Jeffrey Spencer wrote:

> I have version 1.2.x of matplotlib. The minimal example shows the case
> below. The back wall will lose its lines. Is there a reason for this? Is
> there a transparent layer there so eps has to put it as a solid wall? If
> so, is there a way to remove that transparent layer?
>
> Pdf and the other backends have no problem exporting correctly.
>
> import matplotlib.pyplot as plt
> from mpl_toolkits.mplot3d import Axes3D
> fig = plt.figure()
> ax = fig.add_subplot(111, projection='3d')
> plt.savefig('testing.eps')
>
>
Finally had some time to investigate this a bit...

Diving into the eps output, I can tell that the grid lines are being output
to the file, but it seems like the color of the gridline matches that
particular wall's color, which is why we can't see it.  The odd thing is
that the line colors are correct, but for some reason, the face colors are
wrong for eps.  Looking at the output for pdf and png, the walls are not
shaded nearly as much as it is in eps.  There is probably something messed
up in our PS backend that is misinterpreting the grayscale color
information it is getting.

Will have to dive in some more...

Cheers!
Ben Root
--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Splitting arrays into chunks that satisfy a condition?

2013-08-02 Thread Benjamin Root
On Fri, Aug 2, 2013 at 1:36 PM, Drain, Theodore R (392P) <
[email protected]> wrote:

> I have three arrays (x,y,z).  I want plot x vs y and draw the line
> segments differently depending on whether or not z is positive or negative.
>  So I'm trying to split the x,y arrays into chunks depending on the value
> of z.  Using numpy.where, I can find the indeces in z that satisfy a
> condition but I can't figure out an efficient way (other than brute force)
> to split the array up into continuous chunks.  Does anyone know of a numpy
> trick that would help with this?
>
> Here's a simple example:
>
> # index:0  1  2  3   4  5  6  7 8 9
> z=numpy.array([-1,-1,-1, 1, -1,-1,-1, 1,1,1] )
> x=numpy.array([-2,-3,-4, 2, -5,-6,-7, 3,4,5] )
>
> # Want: xneg = [ x[0:3], x[4:7] ], xpos = [ x[3:4], x[7:10] ]
> xneg = [ [-2,-3,-4], [-5,-6,-7] ]
> xpos = [ [ 2 ], [ 3, 4, 5 ] ]
>
> idxneg = numpy.where( z < 0 )[0]
> # == [ 0,1,2, 4,5,6 ]
> idxpos = numpy.where( z >= 0 )[0]
> # == [ 3, 7,8,9 ]
>
> Thanks,
> Ted
>

One way I would go about it is to do this:

z1 = numpy.where(z < 0, z, numpy.nan)
z2 = numpy.where(z >= 0, z, numpy.nan)

And then plot those against x.  matplotlib ignores nans and would break up
the line where-ever a nan shows up (assuming that is the effect you want).

Cheers!
Ben Root
--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3d have improved handling of label placement yet

2013-08-02 Thread Benjamin Root
On Sun, Jul 28, 2013 at 7:14 AM, Jeffrey Spencer wrote:

> Ben,
>
> Thanks that works great and also one more question. If you look at the
> previous example. I have noticed that at the angle the figure is at the
> ticklabels look like they are at the center of the grid boxes. This is not
> the case because if you turn it to the side as the example below image.pdf.
> The 0.00, 0.05 on the I_lw axis are supposed to be at the actual tick marks.
>
>
>
Thus, can the axis be manually moved too? This isn't a huge deal but I was
> just wondering if it was possible to offset the ticklabels. I looked in the
> _axinfo but looks like for ticklabel their is only a space_factor parameter.
>
> Cheers,
> Jeff
>
>
The effect you are seeing is that the tick labels are set to be below and
in front of the tick marks. More specifically, what happens is that the
ticklabels (and the axis label) are offsetted away from the center of the
domain. The space_factor value you found is just some empirical value that
I have found to work fairly well.  Effectively, there is only a
"radial"-like control over the spacing, not a finer-grained control.

That being said, you can modify the "va" value of the _axinfo to control
the vertical allignment of the labels. I would wonder if messing around
with that might have some desired impact.  Another possibility is to use
'\n' characters before or after the main text for the label to make an
apparent shift.  Just some ideas to play around with.

Cheers!
Ben Root
--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Update legend when lines change color?

2013-08-02 Thread Benjamin Root
On Fri, Aug 2, 2013 at 3:32 PM, Eric Firing  wrote:

> On 2013/08/02 8:55 AM, Drain, Theodore R (392P) wrote:
> > Thanks - we'll look into that.  We might also see how hard it would
> > be to implement an update or refresh method on the legend that could
> > be called when the lines change to keep the legend in sync.  Seems
> > like the legend should own that functionality since it set up the
> > mapping between the lines and what it's displaying...
>
> I agree entirely.  It would be logical for the legend to either have a
> manual refresh method, or perhaps to be coupled to its targets the way a
> colorbar is coupled to its mappable, tracking it automatically.  The
> Legend is a very complex beast, however, so I suspect this is a real
> project.
>
>
Mike and I discussed this at the recent conference. What makes
ScalarMappable different from other artists is that it has attribute
caching and it has callback mechanisms for changes to certain attributes.
This is why colorbar can change with its image. These features needs to be
better generalized and cleaned up, and then applied to *all* attributes.

Another issue is that the artist objects contained in the legend are
created from the artist objects that it represents -- at the time of legend
creation. All color, linestyle marker, etc. attributes are copied rather
than referenced in the artists in the legend. Therefore, any changes to
either doesn't impact the other, unfortunately.

So, there are two approaches to solve this. 1) implement a generic,
efficient callback mechanism for attributes (and proper caching to reduce
unneeded dispatches) and have the legend object register callbacks for any
changes in the legend entries. 2) have a mechanism for some sort of shared
attributes.

Just thinking out loud... wishing I had the time to actually implement my
ideas...

Cheers!
Ben Root
--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug in Custom Dash List

2013-08-05 Thread Benjamin Root
@mdboom, from git blame, this looks to be specifically introduced by you
via 
7e7b5320on
May 15th, and you even added some tests for handling path clipping.
Perhaps the choice of "<=" should have been just "<"?
--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] cannot understand http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.show

2013-08-07 Thread Benjamin Root
On Wed, Aug 7, 2013 at 11:45 AM,  wrote:

> The last line of text below seems to say that setting block to either True
> or False causes an override of the blocking behavior.  I don't think this
> is as intended.   Which way round is it (in fact I find it has no effect)?
>
> The problem I have is that using pyplot.show at the top level of a python
> script works correctly, but as soon as I out the same code inside a
> function, I see no plot.
>
> How do I fix this?
>
> Keith
>
> http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.show
>
> matplotlib.pyplot.show(*args, **kw)
>
> In non-interactive mode, display all figures and block until the figures
> have been closed; in interactive mode it has no effect unless figures were
> created prior to a change from non-interactive to interactive mode (not
> recommended). In that case it displays the figures but does not block.
>
> A single experimental keyword argument, block, may be set to True or False
> to override the blocking behavior described above.
>

Which version of matplotlib are you using, and which backend?

import matplotlib
print matplotlib.__version__, matplotlib.get_backend()

Cheers!
Ben Root
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Turn off shading in ax.bar3d

2013-08-09 Thread Benjamin Root
On Fri, Aug 9, 2013 at 6:57 AM, SquirrelSeq
wrote:

> Hello everybody,
>
> I created 3D-Plots with 3D bars in matplotlib. The bars are colored
> according to a colormap.
>
> Unfortunately, only vertical faces have the desired bright colors, whereas
> the top sides of the bars are shaded darker to make it look more 3D.
>
> This makes the colors a lot more difficult to see, depending on the
> perspective.
>
> What can I do in order to switch of shading or to add an ambivalent light
> source?
>
> Best regards
> SquirrelSeq
>
> 
>
>
The one way to do it is to patch the source code in the following way.

in mpl_toolkits/mplot3d/axes3d.py, at around line 2355, replace the line:

sfacecolors = self._shade_colors(facecolors, normals)

with

sfacecolors = facecolors

Could you file a github issue requesting a keyword argument to turn this
on/off?

Cheers!
Ben Root
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] mpl-1.2.1: Speedup code by removing .startswith() calls and some for loops

2013-08-09 Thread Benjamin Root
On Fri, Aug 9, 2013 at 9:04 AM, Martin Mokrejs
wrote:

> Hi Phil,
>
> Phil Elson wrote:
> > Hi Martin,
> >
> > Thanks for this - we are really interested in speeding up the scatter
> and barchart plotting with large data sets. In fact, we've done some work (
> https://github.com/matplotlib/matplotlib/pull/2156) recently to make the
> situation better.
> >
> > I'd really like to review these changes (against matplotlib master), and
> the best possible solution to doing this is if you were to submit a pull
> request. If the changes you have made are logically seperable, then I'd
> encourage you to make a few PRs, but otherwise, a single PR with all of
> these changes would be great.
>
> I went through the changes there and they just cope with other pieces of
> matplotlib.
> My changes are general python improvements moving away from
> str.startswith()
> and using generators instead of for loops. Just apply the patches yourself
> and see.
> ;)
>
> >
> > Would you mind turning these patches into PR(s)? (
> https://github.com/matplotlib/matplotlib/compare/)
>
> Um, I don't know what to do on that page, sorry. I don't see how to upload
> my patch file or patched file
> to be compared with master. :(
>
> >
> > Thanks!
>
> I am sorry but I just don't have time to fiddle with github. It is just
> awkward. I even failed to download
> diffs of the changes from
> https://github.com/matplotlib/matplotlib/pull/2156/commits.
>
> I rather continue studying runsnake output. ;-)
>
> Martin
>
>
A snippet from one of you patches:

 dsu = []

-for a in self.patches:
-dsu.append( (a.get_zorder(), a, a.draw, [renderer]))
+[ dsu.append( (x.get_zorder(), x, x.draw, [renderer])) for x in
self.patches ]

Yes, we certainly should use list-comprehensions here, but you are using it
incorrectly.  It should be:

dsu = [(x.get_zorder(), x, x.draw, [renderer])) for x in self.patches ]

And then, further down, do the following:

dsu.extend((x.get_zorder(), x, x.draw, [renderer])) for x in self.lines)

Note the generator form of the comprehension as opposed to the list
comprehension form. List comprehensions should *always* be assigned to
something. List comprehensions should only be for replacing the for-append
idiom in python.

Thank you though for pointing out parts of the code that can benefit from
revisions. I certainly hope you can get this put together as a pull request
on github so we can work to make this patch better!

Ben Root

P.S. - I <3 runsnakerun!
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] mpl-1.2.1: Speedup code by removing .startswith() calls and some for loops

2013-08-09 Thread Benjamin Root
On Fri, Aug 9, 2013 at 11:15 AM, Martin Mokrejs  wrote:

> Hi Ben,
>   thank your for your comments. OK, here are revised patches. I see a hot
> spot
> in artist.py where the getattr() calls are too expensive. Actually, those
> under
> the callable() path.
>
>
Ah, yes... one of the biggest warts in our codebase. Does get_aliases()
really get called that often?  If so, I doubt changes with regards to
startwith() is the best use of our time.  I would imagine that a refactor
that caches possible aliases. Hell, I would just as soon like to see the
entire aliases framework ripped out and redone more correctly in the first
place.

As for the other startswith() changes, there are some subtle differences in
the change that has to be considered. First, is there a guarantee that the
string being indexed is not empty? startswith() would handle that
correctly, while indexing would throw an exception (and setting up code to
try...catch those exceptions would reduce readability and probably reduce
performance back to where we started).

I think that the *biggest* improvement we are going to get is from your
patch to figure.py because it touches on some very deep code that is
executed very frequently, and we were doing in probably the most
inefficient manner.

Again, I really stress the importance of setting up a github account and
submitting a PR. Once you do that, you are all set to go for contributing
to many other great projects (numpy, scipy, ipython, etc.).

Cheers!
Ben Root
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] quiver plots on top of each other? [solved]

2013-08-15 Thread Benjamin Root
On Aug 15, 2013 1:31 PM, "vwf"  wrote:
>
> Got it working!

It would be nice to post your solution here in case others are interested.

>
> (new problems in the making...)
>
>

Good, can't wait to hear them!

Cheers!
Ben Root
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] quiver linewidht problem

2013-08-15 Thread Benjamin Root
On Aug 15, 2013 3:07 PM, "vwf"  wrote:
>
> After some struggling I got my first plots with quiver working.
> A simple plot is very simple, but a complicated one is very different.
> Right now I have a 80x80 grid with multiple plots and I plan to go up.
> For this I need full control of the arrow dimensions.
>
> The only way I can get narrow arrow is by setting width:
> plt.quiver(x,y,u,v, width=0.001, headwidth=3, scale=0.07,...
> works fine for me. But I would like to set the linewidth per arrow.
>
> On stackoverflow I found:
> widths = np.linspace(0, 2, X.size)
> plt.quiver(X, Y, cos(deg), sin(deg), linewidths=widths)
>
> This did not work for me: the minimum width was too large.
> I there a way to create narrow arrows with varying width?
>

The point of the example was to show that one can assign an array of widths
to a quiver plot. The array can have whatever values you want. Note that
there is likely a subtle difference between "width" and "linewidth" as
keyword arguments that you might want to experiment with.

Cheers!
Ben Root
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plot Scatter plot with hist() method output

2013-08-19 Thread Benjamin Root
Perhaps hexbin() is what you are looking for?

Cheers!
Ben Root
 On Aug 19, 2013 7:29 PM, "dilpreet singh"  wrote:

> Hi
>
> i want to plot a scatter plot similar to the one attached with email . I
> can plot a histogram but the hist method can't plot a scatter plot . Is
> there a way to use the output of the hist() method and use it as an input
> to the scatter plot ?
>
> The part of the code i am using to plot histogram is as follows :
>
> data = get_data()
> plt.figure(figsize=(7,4))
> ax = plt.subplots()
> plt.hist(data,histtype='bar',bins = 100,log=True)
> plt.show()
>
> Thanks
> Dilpreet
>
>
>
> --
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib V1.3 suptitle

2013-08-23 Thread Benjamin Root
On Fri, Aug 23, 2013 at 9:57 AM, Peter Bloomfield <
[email protected]> wrote:

>  Good morning,
>
> I am running openSuSE 12.2, and this morning I upgraded matplotlib to
> v1.3, and now I am having a problem with suptitle.
> I use the following lines to put a title and legend onto a plot figure
>
>  import matplotlib.pyplot as plt
> plt.figure(1)
>
> plt.suptitle( "Study# : " + os.path.basename( inImage_IO.IO_FileName ) + \
>
> "\n" + "{ Acquired : " + \
>
> AcqDateTime.strftime( "%b %d, %Y - $T_o$ @ %H:%M:%S" ) + " }", \
>
> y=0.98, weight="roman", size="large" )
>
> plt.suptitle( "{Creation Date : " + AnalysisTOD + "}",
>
> x=0.86, y=0.03, weight="roman", size="x-small" )
>
>
>  Under v1.3, I only get the 'Creation Date : ...' text at the bottom of
> the figure the 'Study# ...' string is not present at the top. If I change
> it to
>
>  import matplotlib.pyplot as plt
> plt.figure(1)
>
> plt.suptitle( "Study# : ", y=0.98, weight="roman", size="large" )
>
> plt.suptitle( "{Creation Date : " + AnalysisTOD + "}",
>
> x=0.86, y=0.03, weight="roman", size="x-small" )
>
>  the 'Creation Date : ...' text at the bottom of the figure the 'Study# :
> ' string is at the top.
>
>
> So the problem is in the string construct in the first example. Does
> anybody know of a way to get around this?
>
>
> Thanks in advance
>
>
> Peter
>
>
Oh, wow... we didn't think anybody was using that "misfeature".  This was a
bug we fixed for 1.3, in that users complained that calling plt.title()
would update an existing title, but plt.suptitle() would not (multiple
calls would just result in text overlaid on top of each other).  We fixed
this for 1.3 so that there is a single text object that is kept and is
revised in subsequent calls to suptitle().  To get what you want, you will
have to consolidate those strings into one.

Cheers!
Ben
--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib V1.3 suptitle

2013-08-23 Thread Benjamin Root
On Fri, Aug 23, 2013 at 11:21 AM, Peter Bloomfield <
[email protected]> wrote:

>
> On 08/23/2013 10:43 AM, Benjamin Root wrote:
>
>
>
> On Fri, Aug 23, 2013 at 9:57 AM, Peter Bloomfield <
> [email protected]> wrote:
>
>>  Good morning,
>>
>> I am running openSuSE 12.2, and this morning I upgraded matplotlib to
>> v1.3, and now I am having a problem with suptitle.
>> I use the following lines to put a title and legend onto a plot figure
>>
>>  import matplotlib.pyplot as plt
>> plt.figure(1)
>>
>> plt.suptitle( "Study# : " + os.path.basename( inImage_IO.IO_FileName ) + \
>>
>> "\n" + "{ Acquired : " + \
>>
>> AcqDateTime.strftime( "%b %d, %Y - $T_o$ @ %H:%M:%S" ) + " }", \
>>
>> y=0.98, weight="roman", size="large" )
>>
>> plt.suptitle( "{Creation Date : " + AnalysisTOD + "}",
>>
>> x=0.86, y=0.03, weight="roman", size="x-small" )
>>
>>
>>  Under v1.3, I only get the 'Creation Date : ...' text at the bottom of
>> the figure the 'Study# ...' string is not present at the top. If I change
>> it to
>>
>>  import matplotlib.pyplot as plt
>> plt.figure(1)
>>
>> plt.suptitle( "Study# : ", y=0.98, weight="roman", size="large" )
>>
>> plt.suptitle( "{Creation Date : " + AnalysisTOD + "}",
>>
>> x=0.86, y=0.03, weight="roman", size="x-small" )
>>
>>  the 'Creation Date : ...' text at the bottom of the figure the 'Study#
>> : ' string is at the top.
>>
>>
>> So the problem is in the string construct in the first example. Does
>> anybody know of a way to get around this?
>>
>>
>> Thanks in advance
>>
>>
>> Peter
>>
>>
> Oh, wow... we didn't think anybody was using that "misfeature".  This was
> a bug we fixed for 1.3, in that users complained that calling plt.title()
> would update an existing title, but plt.suptitle() would not (multiple
> calls would just result in text overlaid on top of each other).  We fixed
> this for 1.3 so that there is a single text object that is kept and is
> revised in subsequent calls to suptitle().  To get what you want, you will
> have to consolidate those strings into one.
>
>  Cheers!
> Ben
>
>Thanks for getting back to me, but I have tried to do as you suggest,
> but to no avail, and here I apologise for my lack of knowledge of
> python/matplotlib.
> I consolidated the strings into one, titleStr
>
> titleStr = "Study# : " + os.path.basename( inImage_IO.IO_FileName ) + \
>
>"\n" + "{ Acquired : " + \
> AcqDateTime.strftime( "%b %d, %Y - $T_o$ @ %H:%M:%S" ) + "
> }"
> plt.suptitle( titleStr, y=0.98, weight="roman", size="large" )
>
> which should write the string
> 'Study# : Pos9.img\n{ Acquired : Feb 18, 2003 - $T_o$ @ 14:55:02 }'
> at the top of the figure,  but it did not, so I thought it is the "\n",
> and tried
>
> titleStr = "Study# : " + os.path.basename( inImage_IO.IO_FileName )
> plt.suptitle( titleStr, y=0.98, weight="roman", size="large" )
>
> which should write the string
> 'Study# : Pos9.img'
> and this again failed to write the suptitle in the figure.
>
> Am I being dumb (rhetorical)? What is the best way to consolidate the
> strings to work with suptitle, many thanks in advance.
>
> Cheers
>
> Peter
>
>
No issues here.  Let's try simplifying it further and further.  Try the
following script.

import matplotlib.pyplot as plt
plt.suptitle("Study# : Pos9.img")
plt.show()

Does that work for you? If it does, iterate on that code example, adding
pieces back into it and see when it breaks.

Ben Root
--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Explicitly clearing Matplotlib/Pylab figure buffers

2013-08-23 Thread Benjamin Root
On Fri, Aug 23, 2013 at 9:55 AM, Kari Aliranta <
[email protected]> wrote:

> Hello, fellow Matplotlib users,
>
>
> I'm embedding some Matplotlib figures into GUI (PyQt4) windows or widget
> canvases using qt4agg as the backend. I'm having problems with these
> figures popping up any time when some other part of the program calls
> pyplot.show().
>
> How do you avoid this showing of previous figures? Is there some hidden
> buffer where the figures go? If there is, what is the way to clear this
> buffer, or preferably avoid putting figures in this buffer altogether?
> I'd be happy to handle these figures as simple individual objects.
>
> (I'm aware that this "hidden buffer" may be the pylab/pyplot buffer. I
> tried deepcopying the figure and then clearing the pylab buffer with
> pylab.clf() , but figures don't seem to be deepcopyable.)
>
>
> A  typical situation is the following:
>
> - There is a window with a widget. The widget (widgetMpl in the code
> below) has a slightly customized FigureCanvas in it. The drawing code is
> activated by clicking a button in the window. The code goes as follows.
>
>  # The plot method returns a complicated instance of Figure with
> several axes, constructed with Pylab.
>  previewFigure =
> self.parent.experiment.file_to_plot.plot(show=False, n_channels=10)
>
>  self.ui.widgetMpl.canvas.figure = previewFigure
>  self.ui.widgetMpl.canvas.draw()
>
>
> - I draw the figure in the window once, or several times with different
> file_to_plot, by pressing the button. I may or may not close the window
> with the aforementioned widget.
>
> - Elsewhere in the program there is another window with very simple
> drawing code using pyplot. When this code calls pyplot.show(), all the
> figures drawn in the first window will show up.
>
>
>
It is called the "pyplot state environment".  When code uses pylab or
pyplot, the pyplot state implicitly keeps track of all the axes and figures
that are generated. The way to avoid the pyplot state environment is to
completely avoid any and all usage of pyplot. Don't even import it. Work
strictly down in the OO layer. Of course, this is difficult to do for a
variety of reasons, but it should be achievable.  There are other people on
this mailing list that are much more experienced than I with the pure
OO-approach and embedding, and hopefully they can chime in with pointers
and tips.

Cheers!
Ben Root
--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Explicitly clearing Matplotlib/Pylab figure buffers

2013-08-23 Thread Benjamin Root
On Fri, Aug 23, 2013 at 1:57 PM, Eric Firing  wrote:

> On 2013/08/23 3:55 AM, Kari Aliranta wrote:
> > Hello, fellow Matplotlib users,
> >
> >
> > I'm embedding some Matplotlib figures into GUI (PyQt4) windows or widget
> > canvases using qt4agg as the backend. I'm having problems with these
> > figures popping up any time when some other part of the program calls
> > pyplot.show().
>
> Generally, when embedding, one simply does not use the pyplot interface
> at all, so this sort of problem does not arise.  Is there any reason why
> you can't use this approach?
> >
> > How do you avoid this showing of previous figures? Is there some hidden
> > buffer where the figures go? If there is, what is the way to clear this
> > buffer, or preferably avoid putting figures in this buffer altogether?
> > I'd be happy to handle these figures as simple individual objects.
>
> To remove a figure created by pyplot, use pyplot.close(fig); but still,
> trying to use the pyplot interface for anything more complicated than
> direct interactive use and simple non-interactive scripts is likely to
> cause more problems than it solves. It's just not what pyplot is
> designed for.
>
> Eric
>

I am wondering if the problem being described here is one where someone
creates a module to do some particular thing using matplotlib, and someone
else has the script that is using pyplot and that module. I am fairly
certain that the pure OO approach should still work for the code in the
module without interference from the script's usage of pyplot, though, but
I am not 100% certain.

Cheers!
Ben Root
--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Explicitly clearing Matplotlib/Pylab figure buffers

2013-08-23 Thread Benjamin Root
On Fri, Aug 23, 2013 at 4:08 PM, Kari Aliranta <
[email protected]> wrote:

> 23.08.2013 20:57, Eric Firing kirjoitti:
> > On 2013/08/23 3:55 AM, Kari Aliranta wrote:
> >> Hello, fellow Matplotlib users,
> >>
> >>
> >> I'm embedding some Matplotlib figures into GUI (PyQt4) windows or widget
> >> canvases using qt4agg as the backend. I'm having problems with these
> >> figures popping up any time when some other part of the program calls
> >> pyplot.show().
> >
> > Generally, when embedding, one simply does not use the pyplot interface
> > at all, so this sort of problem does not arise.  Is there any reason why
> > you can't use this approach?
>
> Thank you. I'd like to stick to pure OO, but I'm using some
> third party open source code that uses pylab extensively for
> rather large and interactive (as in "includes scrollbars,
> buttons and several types of events") figures. The code
> works nicely in itself, and has an option to return the
> figure object without actually showing the plot.
>
> I was hoping to take the returned figure as an object and
> reset the related state environment information, effectively
> "smuggling" the created figure out of the state environment.
> If there is a simple way to do this in Matplotlib, that
> would be quite useful.
>
>
There is one quick-n-dirty way of doing it. And it ain't pretty.

Using the third-party code in a subprocess that creates a pickle of the
figure. Then load up the pickle and extract the figure object in your
parent process. Your instance of matplotlib will never be touched.

Told you it wasn't pretty...

Ben Root
--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] event.ind in point picking gives wrong number

2013-09-16 Thread Benjamin Root
On Sun, Sep 15, 2013 at 11:59 PM, C M  wrote:

> Just a follow-up on this problem...
>
> I've found now that the index is only off if the plot is zoomed, and in
> the following way.  When I zoom, the first point that is visible in the
> plot window will have index = 0, the next point will have index = 1, and so
> forth.  If I zoom another section of the points, the indices are "reset" in
> this same way.
>
> What's really bizarre is that this is only occurring on one plot.  When I
> try to reproduce the problem on other plots (so far at least), I can't.
>
> Any suggestions for how to chase this down would be very welcome.
>
> Thanks.
>
>
That is a very useful observation. I am not very familiar with the artist
picking code, but if I have to guess, I would wonder if indices are being
determined from a path created *after* clip_to_rect() is used internally.
Given that you are having difficulties in reproducing this issue in other
plots, I would suggest trying to pare down your badly behaving code as much
as you can and post it here.  Furthermore, it would also be useful to
determine if the issue still occurs in v1.3 or in the master branch.

Cheers!
Ben Root
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] text color in matplotlib Table

2013-09-16 Thread Benjamin Root
On Sat, Sep 14, 2013 at 2:45 PM, Alexandre Voitenok <
[email protected]> wrote:

>  Hi
> I am trying to figure out how to change font color (as opposed to the fill
> color) in select cells in Table. Is there a way to do this?
> Below is an example:
>
> import matplotlib.pyplot as plt
> import numpy as np
> import pandas as pd
> from matplotlib.table import Table
> def main():
> data = pd.DataFrame(np.random.random((12,8)),
> columns=['A','B','C','D','E','F','G','H'])
> returnsTable(data)
> plt.show()
>
> def returnsTable(data, fmt='{:.2f}/{:.1f}'):
> fig=plt.figure(figsize=(8,5))
> ax=plt.subplot(111)
> ax.set_axis_off()
> tb = Table(ax, bbox=[0,0,1,1])
> tb.auto_set_font_size(False)
>
> colorDict={-3:"#D0",-2:"#FF5050",-1:"#FFBFBF",0:"#FF",1:"#D0FFD0",2:"#40FF40",3:"#00C000"}
>
> nrows, ncols = data.shape
> width, height = 1.0 / ncols, 1.0 / nrows
>
> dArray=data.values.reshape(np.product(data.shape))
> # mean&sigma..
> mean=np.average(dArray)
> sigma=np.std(dArray)
>
> # Add cells
> for (i,j), val in np.ndenumerate(data):
> z=(val-mean)/sigma
> idx = 0 if int(z)==0 else (max((int(z),-3)) if z<0 else
> min((int(z),3)))
> color = colorDict[idx]
>
> ##
> ## IS THERE  A WAY TO ALSO CHANGE FONT COLOR?
> tb.add_cell(i+1, j+1, width, height, text=fmt.format(val,z),
> loc='center', facecolor=color)
>
>
> # Row labels in cells themselves
> # use -1 with edgecolor='none' for outside the grid
> for i, label in enumerate(data.index):
> tb.add_cell(i+1, 0, width*2, height, text=label, loc='right',
> facecolor='none')
>
>
> # Column Labels...
> for j, label in enumerate(data.columns):
> tb.add_cell(0, j+1, width, height/2, text=label, loc='center',
> facecolor='none')
> tb.set_fontsize(8)
> ax.add_table(tb)
> return fig
>
> main()
>
>
>
Hmm, it doesn't look like you can do it from the add_cell() function. It
creates a Cell object, which in turn creates a Text object, but provides no
means of passing much down to that Text object. The Table object has a
dictionary of Cell objects: self._cells[(row, col)] = cell, keyed by the
tuple of row and column numbers. You could do something like this:

tb._cells[(i+1, j+1)]._text.set_color('yellow')

Note, I did not test the above line, but I suspect that should work.

Cheers!
Ben Root
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] mplot3d

2013-09-17 Thread Benjamin Root
On Tue, Sep 17, 2013 at 4:25 AM, Nils Wagner  wrote:

> Hi all,
>
> How can I modify the grid linewidth and grid line color of an Axes3D
> object ?
> is it possible to use white instead of gray for the background color ?
>
> The following snippet doesn't show the desired effect.
>
> from mpl_toolkits.mplot3d import Axes3D
> import matplotlib.pyplot as plt
> fig = plt.figure(figsize=(10,8))
> ax = fig.gca(projection='3d')
> ax.grid(color='r',linestyle='-',linewdith=2)
>
>
A (somewhat) undocumented feature (and is not guaranteed to work in the
future!) is the axis's _axinfo dictionary.

# This is a temporary member variable.
# Do not depend on this existing in future releases!
self._axinfo = self._AXINFO[adir].copy()
self._axinfo.update({'label' : {'space_factor': 1.6,
'va': 'center',
'ha': 'center'},
 'tick' : {'inward_factor': 0.2,
   'outward_factor': 0.1},
 'ticklabel': {'space_factor': 0.7},
 'axisline': {'linewidth': 0.75,
  'color': (0, 0, 0, 1)},
 'grid' : {'color': (0.9, 0.9, 0.9, 1),
   'linewidth': 1.0},
})

where _AXINFO is a class-level attribute defined as:
# Some properties for the axes
_AXINFO = {
'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
'color': (0.95, 0.95, 0.95, 0.5)},
'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
'color': (0.90, 0.90, 0.90, 0.5)},
'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
'color': (0.925, 0.925, 0.925, 0.5)},
}

This information used to be hard-coded throughout the axis3d.py module. I
consolidated it all into this dictionary for each Axis3D instance. So, you
should be able to create your Axes3D object, and then do something like the
following:

ax = fig.gca(projection='3d')
ax.xaxis._axinfo['grid'].update({'color': 'r', 'linewidth': 2})
ax.xaxis._axinfo['color'] = 'white'

(Note: untested code!) I don't think the linestyle can be specified,
though. At some point, I probably should get the Axes3D.grid() function
defined to mess around with this _axinfo modify the _axinfo dictionary.

I hope that helps!
Ben Root
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Qt4 Example timing out

2013-09-17 Thread Benjamin Root
On Tue, Sep 17, 2013 at 11:55 AM, Chad Kidder  wrote:

> I'm following the MPL Qt4 example given at
> http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html and
> it looks like I am timing out somewhere in the setup.  The error I am
> getting is:
>
> RuntimeError: super-class __init__() of type MyDynamicMplCanvas was never
> called
>
> It's timing out on a function that goes and talks to a piece of test
> equipment to get some data to plot.  That function takes on the order of a
> second to complete and is located in compute_initial_figure(self): for the
> previously mentioned class.  I will need to make these calls whenever I go
> into the update routine and they may take a few seconds to update.
>
> First, where is the "timeout" that I am violating?  Second, how do I fix
> this?  Thanks for your help.
>
>
> --Chad Kidder
>
>
Hi Chad,

I think the timeout is right over here:

class MyDynamicMplCanvas(MyMplCanvas):
"""A canvas that updates itself every second with a new plot."""
def __init__(self, *args, **kwargs):
MyMplCanvas.__init__(self, *args, **kwargs)
timer = QtCore.QTimer(self)
QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"),
self.update_figure)
timer.start(1000)

My suspicion would be to either bump up that timer to take more than a
second, or come up with a different signal function to more intelligently
handle refreshes.

Cheers!
Ben Root
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] change the EPS font type ... afterwards!

2013-09-24 Thread Benjamin Root
On Mon, Sep 23, 2013 at 6:13 PM, Grigoris Maravelias <
[email protected]> wrote:

> Hello to all!
>
> I have been using Matplotlib to create a series of plots and now the
> time to submit the paper has come! But I experience problems now with
> the font types of the eps images. The Type-3 fonts are not supported,
> and they accept only Type-1. Is there an easy way to do this ?(and of
> course not go through the reprocessing of all data to produce again the
> same plots).
>
> best
> Grigoris
>
>
A word of advice with regards to your hesitation to redo the graphs. Almost
always you will need to do so anyway when reviews come back. Either because
one of the reviewers wanted a change in the graph, or some other fault in
the process was discovered and needed to be corrected (and so new graphs
have to be made anyway). Also, you may be asked to produce the data for
others to use some time in the future. One thing I try to do with my
projects is to separate the graph production from the data processing. I
would have the data processing save the relevant data, and then have
separate scripts that would generate graphs from that data.  For bonus
points, I usually tie everything together with Makefiles so that I don't
have to remember the exact set of commands I used when the reviewer
comments come back 6 months later.

Cheers!
Ben Root
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] x axis non-uniform labeling (KURT PETERS)

2013-10-01 Thread Benjamin Root
On Tue, Oct 1, 2013 at 1:55 PM, KURT PETERS  wrote:

>
>
> > Date: Tue, 1 Oct 2013 19:35:39 +0200
>
> > Subject: Re: [Matplotlib-users] x axis non-uniform labeling (KURT PETERS)
> > From: [email protected]
> > To: [email protected]
> > CC: [email protected]; [email protected]
>
> >
> > 2013/10/1 KURT PETERS :
> > > here's what SHOULD be happening
> > >
> > > | 0 1 5 9 13 18 21 24 25 28
> > > 3 | x
> > > | x x
> > > | x x
> > > | x x
> > > -1|_x__x_
> > > 1 2 3 4 5 6 7 8 9 10
> > >
> > > How can I make that happen? Instead, MPL is autoranging the top axis. I
> > > don't want that I just want the actual labels to occur up there.
> >
> > Then just set the ticks and the tick labels of the axis:
> >
> > import numpy as np
> > import matplotlib.pyplot as plt
> > xdat=np.arange(1,11)
> > simtimedata = np.array([0, 1, 5, 9, 13, 18, 21, 24, 25, 28])
> > idatanp = np.array([-1,0, 1, 2, 3, 2, 1, 0, -1, -2])
> > ax1 = plt.subplot(111)
> > ax1.plot(xdat,idatanp)
> > ax2 = ax1.twiny()
> > ax2.set_xticks(range(len(xdat)))
> > ax2.set_xticklabels(simtimedata)
> > plt.show()
> >
> > Goyo
>
> Goyo,
>   Thanks, the code below seems to work.  The problem is that with
> "REAL/actual" data, I have SO many data points that each point is now
> labeled and it takes forever to render.  And when it does render, I cannot
> read the axis because there are too many there.  Is there a way to
> judiciously have it only display a certain number of values?  Such as every
> 100th value?
> Kurt
> xdat=np.arange(1,11)
> simtimedata = np.array([0, 1, 5, 9, 13, 18, 21, 24, 25, 28])
> idatanp = np.array([-1,0, 1, 2, 3, 2, 1, 0, -1, -2])
> print idatanp.shape
> print simtimedata.shape
> print xdat.shape
> fig = plt.figure()
>
> ax1 = fig.add_subplot(211)
> ax1.plot(xdat,idatanp)
> ax1.grid(True)
> ax2 = fig.add_subplot(212)
> ax2.plot(xdat, idatanp.real,'k-o')
> ax2.set_xticks(xdat)
> ax2.set_xticklabels(simtimedata)
> #ax2.set_title("time domain")
> ax2.grid(True)
> plt.show()
>

The philosophy of matplotlib is to have smart defaults, but always allow
the user to override.  Perhaps you are looking for a particular "ticker"?

http://matplotlib.org/api/ticker_api.html

I hope this helps!
Ben Root
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib installation with Python(x,y)

2013-10-03 Thread Benjamin Root
On Thu, Oct 3, 2013 at 6:35 AM, ajdcds  wrote:

> Sorry, of course it does not work, the import is incorrect!
>
> It should be
>
> import matplotlib as plt
> plt.rcParams['backend'] = 'TkAgg'
>
> or simply
> import matplotlib
> matplotlib.rcParams['backend'] = 'TkAgg'
>
>
Errr... no, don't do "import matplotlib as plt". That is just confusing.

To change backends, do the following:

import matplotlib
matplotlib.use("TkAgg")

Because backends are loaded upon import of matplotlib, changing the rcParam
after importing matplotlib is too late. You force a switch of the backend
via the "use()" function.
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib installation with Python(x,y)

2013-10-03 Thread Benjamin Root
On Thu, Oct 3, 2013 at 9:22 AM, ajdcds  wrote:

> Benjamin, thank you very much for the tip!
>
> If I do
>
> import matplotlib
> matplotlib.use("TkAgg")
>
> This is only valid for the current script that is running, the matplotlibrc
> remains the same, right?
>
>
Yes, that is correct.
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting y limits in a log scale scatter plot

2013-10-08 Thread Benjamin Root
On Thu, Oct 3, 2013 at 1:05 PM, dilpreet singh  wrote:

> Hi
>
> I am plotting a scatter plot where y axis has a log scale but in the graph
> the y axis always starts from 10 to the power -1 . I tried setting the
> limit with set_ylim() but i am not sure what value to give within this
> method since its a log scale . Is there a way i can start y axis from 10 to
> the power -0.25  .
>
>
> Thanks
> Dilpreet
>
>
The values for set_ylim() and set_xlim() are the raw data values. So, if
you want to start from 10**-0.25, you do:

ax.set_ylim(bottom=10**-0.25)

Do note that once you set the limits, the auto-detection of the limits turn
off. So, it is best to issue these sorts of commands after you finish
plotting all the data.
I hope that helps!
Ben Root



>
> --
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
> from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib eating memory

2013-10-10 Thread Benjamin Root
On Thu, Oct 10, 2013 at 9:05 AM, Martin MOKREJŠ  wrote:

> Hi,
>   rendering some of my charts takes almost 50GB of RAM. I believe below is
> a stracktrace
> of one such situation when it already took 15GB. Would somebody comments
> on what is
> matplotlib doing at the very moment? Why the recursion?
>
>   The charts had to have 262422 data points in a 2D scatter plot, each
> point has assigned
> its own color. They are in batches so that there are 153 distinct colors
> but nevertheless,
> I assigned to each data point a color value. There are 153 legend items
> also (one color
> won't be used).
>
> ^CTraceback (most recent call last):
> ...
> _figure.savefig(filename, dpi=100)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line
> 1421, in savefig
> self.canvas.print_figure(*args, **kwargs)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py",
> line 2220, in print_figure
> **kwargs)
>   File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> line 505, in print_png
> FigureCanvasAgg.draw(self)
>   File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> line 451, in draw
> self.figure.draw(self.renderer)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 54,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line
> 1034, in draw
> func(*args)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 54,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 2086,
> in draw
> a.draw(renderer)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 54,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/collections.py",
> line 718, in draw
> return Collection.draw(self, renderer)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 54,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/collections.py",
> line 276, in draw
> offsets, transOffset, self.get_facecolor(), self.get_edgecolor(),
>   File "/usr/lib64/python2.7/site-packages/matplotlib/collections.py",
> line 551, in get_edgecolor
> return self._edgecolors
> KeyboardInterrupt
> ^CError in atexit._run_exitfuncs:
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
> func(*targs, **kargs)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/_pylab_helpers.py",
> line 90, in destroy_all
> gc.collect()
> KeyboardInterrupt
> Error in sys.exitfunc:
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
> func(*targs, **kargs)
>   File "/usr/lib64/python2.7/site-packages/matplotlib/_pylab_helpers.py",
> line 90, in destroy_all
> gc.collect()
> KeyboardInterrupt
>
> ^C
>
>
> Clues what is the code doing? I use mpl-1.3.0.
> Thank you,
> Martin
>
>
Unfortunately, that stacktrace isn't very useful. There is no recursion
there, but rather the perfectly normal drawing of the figure object that
has a child axes, which has child collections which have child artist
objects.

Without the accompanying code, it would be difficult to determine where the
memory hog is.

Ben Root
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib eating memory

2013-10-10 Thread Benjamin Root
On Thu, Oct 10, 2013 at 9:47 AM, Martin MOKREJŠ  wrote:

> Benjamin Root wrote:
> >
> >
> >
> > On Thu, Oct 10, 2013 at 9:05 AM, Martin MOKREJŠ  [email protected]>> wrote:
> >
> > Hi,
> >   rendering some of my charts takes almost 50GB of RAM. I believe
> below is a stracktrace
> > of one such situation when it already took 15GB. Would somebody
> comments on what is
> > matplotlib doing at the very moment? Why the recursion?
> >
> >   The charts had to have 262422 data points in a 2D scatter plot,
> each point has assigned
> > its own color. They are in batches so that there are 153 distinct
> colors but nevertheless,
> > I assigned to each data point a color value. There are 153 legend
> items also (one color
> > won't be used).
> >
> > ^CTraceback (most recent call last):
> > ...
> > _figure.savefig(filename, dpi=100)
> >   File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py",
> line 1421, in savefig
> > self.canvas.print_figure(*args, **kwargs)
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line
> 2220, in print_figure
> > **kwargs)
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> line 505, in print_png
> > FigureCanvasAgg.draw(self)
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> line 451, in draw
> > self.figure.draw(self.renderer)
> >   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py",
> line 54, in draw_wrapper
> > draw(artist, renderer, *args, **kwargs)
> >   File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py",
> line 1034, in draw
> > func(*args)
> >   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py",
> line 54, in draw_wrapper
> > draw(artist, renderer, *args, **kwargs)
> >   File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line
> 2086, in draw
> > a.draw(renderer)
> >   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py",
> line 54, in draw_wrapper
> > draw(artist, renderer, *args, **kwargs)
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/collections.py", line 718,
> in draw
> > return Collection.draw(self, renderer)
> >   File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py",
> line 54, in draw_wrapper
> > draw(artist, renderer, *args, **kwargs)
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/collections.py", line 276,
> in draw
> > offsets, transOffset, self.get_facecolor(), self.get_edgecolor(),
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/collections.py", line 551,
> in get_edgecolor
> > return self._edgecolors
> > KeyboardInterrupt
> > ^CError in atexit._run_exitfuncs:
> > Traceback (most recent call last):
> >   File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
> > func(*targs, **kargs)
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/_pylab_helpers.py", line 90,
> in destroy_all
> > gc.collect()
> > KeyboardInterrupt
> > Error in sys.exitfunc:
> > Traceback (most recent call last):
> >   File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
> > func(*targs, **kargs)
> >   File
> "/usr/lib64/python2.7/site-packages/matplotlib/_pylab_helpers.py", line 90,
> in destroy_all
> > gc.collect()
> > KeyboardInterrupt
> >
> > ^C
> >
> >
> > Clues what is the code doing? I use mpl-1.3.0.
> > Thank you,
> > Martin
> >
> >
> > Unfortunately, that stacktrace isn't very useful. There is no recursion
> there, but rather the perfectly normal drawing of the figure object that
> has a child axes, which has child collections which have child artist
> objects.
> >
> > Without the accompanying code, it would be difficult to determine where
> the memory hog is.
>
> Could there be places where gc.collect() could be introduced? Are there
> places where matplotlib
> could del() unnecessary objects right away? I think the problem is with
> huge lists or pythonic
> dicts. I could save 10GB of RAM when I converted one python dict to a
> bs

Re: [Matplotlib-users] Matplotlib eating memory

2013-10-10 Thread Benjamin Root
On Thu, Oct 10, 2013 at 10:21 AM, Michael Droettboom wrote:

>  Thanks.  This is much more helpful.
>
> What we need, however, is a "self contained, standalone example".  The
> code below calls functions that are not present.  See http://sscce.org/for 
> why this is so important.  Again, I would have to guess what those
> functions do -- it may be relevant, it may not.  If I have something that I
> can *just run* then I can use various introspection tools to see what is
> going wrong.
>
> Mike
>
>
That being said, I do see a number of anti-patterns here that could be
significant. For example:

for _x, _y, _c in izip(mydata_x, mydata_y, colors):
# _Line2D = _ax1.plot(_x, _y) # returns Line2D object
_my_PathCollection = _ax1.scatter(_x, _y, color=_c, s=objsize)
# , label=_l) # returns PathCollection object
_series.append(_my_PathCollection)

Could be more concisely written as:

_series = [_ax1.scatter(_x, _y, color=_c, s=objsize) for _x, _y, _c
in izip(mydata_x, mydata_y, colors)]

Python can then more intelligently handle memory management by
intelligently allocating the memory for _series. You can then use
_series.extend() for when you are doing the scatter plots for _ax2 with a
similar list comprehension (or even a generator statement).

I would also question the need to store _series in the first place. You use
it for the call to legend, but you could have simply passed a label to each
call of scatter as well.

Some other things of note:

1) The clear() call here is completely useless as the figure is already
clear.
_figure = pylab.figure()
_figure.clear()

2) When limits are set on an axis, autoscaling for that axis is
automatically turned off anyway, so no need to turn if off yourself (also
not sure why you are calling out to an external function here):
_ax1.set_autoscale_on(False)
set_limits(_ax1, xmin, xmax, ymin, ymax)

3) Finally, some discussion on the end of your function here:
if legends:
_figure.savefig(filename, dpi=100) #, bbox_inches='tight')
del(_my_PathCollection)
del(_ax2)
else:
_figure.savefig(filename, dpi=100)

del(_series)
del(_ax1)
_figure.clear()
del(_figure)
pylab.clf()
pylab.close()
first, as discussed, you can easily eliminate the need for
_my_PathCollection and possibly even _series. Second, when calling
_figure.clear(), all of its axes objects are deleted for you, so you don't
need to delete them yourself. Third, you delete the _figure object, but
then call "pylab.clf()". I haven't double-checked exactly what would
happen, but I think you might run the risk of accidentially clearing some
other existing figure by doing that. Lastly, you then call pylab.close(),
which I point out the same caveat as before. Really, all you needed was
pylab.close() and you can eliminate the 5 preceding lines and the other two
del()'s. All del() really does is remove the variable out of scope. Once
that object is out of everybody's scope, then the gc can clean it up. Since
the function was ending anyway, there is no point in deleting the variable.

I don't know if this would fix your problem, and there are a bunch of other
style issues here (particularly, pylab really shouldn't be used this way),
but hopefully this gives some food for thought.

Cheers!
Ben Root
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Maidir le: Memory leak when using pyplot.ion() ?

2013-10-14 Thread Benjamin Root
I see you are using matplotlib 1.0.1. There have been several memory leak
bugs fixed since then, so I would suggest upgrading. I also notice you are
using the "emf" backend for saving figures. If I remember correctly, that
backend has been deprecated (or maybe even removed) in the latest release
(v1.3.x).  So, i would suggest trying v1.2.1. It does contain many bugfixes
and should still be compatible with your existing code.

I should also warn that the behavior with pyplot.ion() was "odd" back in
the 1.0.1 days and prior. If you are just simply running the script as-is
with a more recent matplotlib, or with a different backend in v1.0.1, the
script might behave a little differently than you'd expect. We would
welcome feedback on your usage of pyplot.ion().

Cheers!
Ben Root
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Choosing optimal figure width/height automatically

2013-10-17 Thread Benjamin Root
On Thu, Oct 17, 2013 at 8:20 AM, Christoph Groth  wrote:

> Hello,
>
> I'm stuck trying to find a solution to the following problem.
>
> I'd like to show an array using imshow preserving the 1:1 aspect ratio
> of its pixels.  At the same time, I would like the axes to fit around
> the image tightly.
>
> Is there some way to, for example, choose a certain figure width, and
> have the height chosen automatically to the optimal value?
>
> Thanks,
> Christoph
>
>
I particularly like using the figaspect() function:

http://matplotlib.org/api/figure_api.html?highlight=figaspect#matplotlib.figure.figaspect

The example usage there needs to be updated (it assumes the pylab mode
which imports everything in pyplot into the global namespace). But it
should be accessible like so:

import matplotlib.pyplot as plt

w, h = plt.figaspect(2)

It isn't perfect, but for its simplicity, it gets it mostly right.

Cheers!
Ben Root
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] viewing 3d plots with orthographic projection?

2013-10-19 Thread Benjamin Root
This has been requested before, and it probably wouldn't be that difficult
to implement. If you want to take a crack at it, try making orthographic
versions of the functions in mpl_toolkits/mplot3d/proj3d.py. The tricky
part will be getting the right projection hooked up, but for now, you could
just override the existing functions.

Cheers!
Ben Root
On Oct 18, 2013 6:20 PM, "Jason Sachs"  wrote:

> I want to create a 3d plot with matplotlib. I've gotten it to work, and
> can control the view (camera) angles, but I don't want any foreshortening /
> perspective. Is there a way to just have a plain orthographic projection
> instead?
>
>
> --
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
> from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reset original view button and mplot3d

2013-10-30 Thread Benjamin Root
Good point. The underlying mechanism for recording the changes to the
limits assume just x and y limits, and wouldn't record the z limits.
Furthermore, it certainly doesn't take into account any changes with
respect to the viewing angle.  I am not familiar enough with the mechanisms
to figure out how to make that work here, but feel free to file a feature
request. But, let's be honest here, I have *zero* time in the foreseeable
future to handle even the bug requests, let alone feature requests for
mplot3d. Perhaps it is time to find someone else who is willing to pick up
the mantle here?
--
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplot3d: add_collection3d: Turn off baseline?

2013-10-31 Thread Benjamin Root
On Thu, Oct 31, 2013 at 9:43 AM, Guido Avvisati wrote:

> Benjamin Root  writes:
>
> >
> >
> > On Tue, Nov 20, 2012 at 8:12 PM, Stephen Gibson  [email protected]> wrote:
> >
> > Ok. Adding an NaN as the last data point did not help.
> > However, I notice that the return path is two segments that go through
> (0,0).
> > i.e. the baseline (or return) path may actually start/finish at (0,0)
> > The attached image shows my data offset in y-direction by +1. The end
> points
> > have been set to y=0.5.  The baseline (or return path) is the line
> segment
> that
> > starts at the first data point, passes through (x=0,y=0), and ends at the
> last
> > data point.
> > Steve.
> >
> >
> > Actually, this might be related to a bug that was pointed out to me a
> while back that I just could not figure out.  Having this example might
> help
> in narrowing down the cause.  Essentially, the (0,0) vertex was being added
> even when it shouldn't have been.  The key difference in this example is
> that zdir='y' is used, which causes the (0,0) vertex to refer to the x,z
> coordinate.  Interesting...I will have to investigate further.Ben Root
> >
> >
> >
> >
> >
> --
> 
> > Monitor your physical, virtual and cloud infrastructure from a single
> > web console. Get in-depth insight into apps, servers, databases, vmware,
> > SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> > Pricing starts from $795 for 25 servers or applications!
> > http://p.sf.net/sfu/zoho_dev2dev_nov
> >
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
> Hi,
>
> I have exactly the same problem described here. Is there any solution to
> turn off the baseline in the polycollection?
>
> Cheers,
> Guido
>
>
>
There was a pull request that was put together about 6 months ago that I
think fixed the problem, IIRC, but it broke the API and the submitter
eventually retracted the PR because it didn't seem like the right solution.
The problem is extremely nuanced and there is no clear solution,
unfortunately. The general idea is that the path codes are not being stored
with the vertices because the underlying object holding that data is a Path
(so the 3D vertices are stored separately, and as such, the list of
vertices diverges from the list of path codes). Perhaps, if there was a way
to make Path objects be able to hold 3D vertices, we might be able to solve
this issue once and for all?

Ben Root
--
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] wrong numpy version

2013-11-12 Thread Benjamin Root
On Tue, Nov 12, 2013 at 7:37 AM, Nemanja Savic  wrote:

> Hi all guys,
>
> I am using RHEL6 and I am ploting figures throughout my project, so I
> wanted some workaroung blocking show() function call. I have found few
> solutions that use multiprocessing, so finally i finished with this:
>
> pool.map(plot_graph, c)
>
> and
>
> def plot_graph(*args):
> plt.figure(args[0][2])
> plt.bar(args[0][1][:-1], args[0][0], width=1)
> plt.show()
>
> But when I have more than one figure the following error occures:
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py:621:
> DeprecationWarning: Use the new widget gtk.Tooltip
>   self.tooltips = gtk.Tooltips()
> /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py:621:
> DeprecationWarning: Use the new widget gtk.Tooltip
>   self.tooltips = gtk.Tooltips()
> [xcb] Unknown sequence number while processing queue
> [xcb] Most likely this is a multi-threaded client and XInitThreads has not
> been called
> [xcb] Aborting, sorry about that.
> python: xcb_io.c:273: poll_for_event: Assertion
> `!xcb_xlib_threads_sequence_lost' failed.
> runner.py: Fatal IO error 0 (Success) on X server :0.0.
>
> Since my version of matplolib doesnt support blocking = false solution, I
> wanted to install new version. For that I installed new version of numpy
> but when i run python setup.py build in matplolib foldet i get following:
>
> Edit setup.cfg to change the build options
>
> BUILDING MATPLOTLIB
> matplotlib: yes [1.3.1]
> python: yes [2.6.6 (r266:84292, May 27 2013, 05:35:12)
> [GCC
> 4.4.7 20120313 (Red Hat 4.4.7-3)]]
>   platform: yes [linux2]
>
> REQUIRED DEPENDENCIES AND EXTENSIONS
>  numpy: yes [version 1.8.0]
>   dateutil: yes [using dateutil version 1.4.1]
>tornado: yes [tornado was not found. It is required for the
> WebAgg backend. pip/easy_install may attempt to
> install it after matplotlib.]
>  pyparsing: yes [pyparsing was not found. It is required for
> mathtext support. pip/easy_install may attempt to
> install it after matplotlib.]
>  pycxx: yes [Couldn't import.  Using local copy.]
> libagg: yes [pkg-config information for 'libagg' could not
> be found. Using local copy.]
>   freetype: yes [version 9.22.3]
>png: yes [version 1.2.49]
>
> OPTIONAL SUBPACKAGES
>sample_data: yes [installing]
>   toolkits: yes [installing]
>  tests: yes [nose 0.11.1 or later is required to run the
> matplotlib test suite]
>
> OPTIONAL BACKEND EXTENSIONS
> macosx: no  [Mac OS-X only]
> qt4agg: yes [installing, Qt: 4.6.2, PyQt4: 4.6.2]
>gtk3agg: no  [Requires pygobject to be installed.]
>  gtk3cairo: no  [Requires pygobject to be installed.]
> gtkagg: yes [installing, Gtk: 2.18.9 pygtk: 2.16.0]
>  tkagg: yes [installing, version 73770]
>  wxagg: yes [installing, version 2.8.12.0]
>gtk: yes [installing, Gtk: 2.18.9 pygtk: 2.16.0]
>agg: yes [installing]
>  cairo: yes [installing, version 1.8.6]
>  windowing: no  [Microsoft Windows only]
>
> OPTIONAL LATEX DEPENDENCIES
> dvipng: yes [version 1.14]
>ghostscript: yes [version 8.70]
>  latex: yes [version 3.1415926]
>pdftops: no
>
> Traceback (most recent call last):
>   File "setup.py", line 268, in 
> **extra_args
>   File "/usr/lib64/python2.6/distutils/core.py", line 113, in setup
> _setup_distribution = dist = klass(attrs)
>   File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 221, in
> __init__
>   File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 245, in
> fetch_build_eggs
>   File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 592, in
> resolve
> plugin_projects.sort()  # scan project names in alphabetic order
> pkg_resources.VersionConflict: (numpy 1.4.1
> (/usr/lib64/python2.6/site-packages), Requirement.parse('numpy>=1.5'))
>
> When I run python and check numpy version it is indeed 1.8.0, but
> matplotlib buils script somehow founded older one.
>
>
> I would be really happy if somebody can help me overcome problem with many
> figures.
>
> Best and cheers
>
>
The issue is rather complex, and it is a very difficult one to solve on our
end. What is happening is that in order to build matplotlib from source,
you need to compile against the numpy headers at build-time. Unfortunately,
python packaging being what it is, there is difficulty in making sure that
the version of numpy that will be installed is the version used for the
build. You seem to have numpy insta

Re: [Matplotlib-users] Outline for histogram bars

2013-11-12 Thread Benjamin Root
On Tue, Nov 12, 2013 at 4:26 PM, Ted To  wrote:

> Hi,
>
> Is there an option to change the line style for the outline of histogram
> bars?  What I am looking for some something like the attached kernel
> density plot.  I can set different colors (attached) but this is not
> very useful when printing in black and white.
>
> Thanks,
> Ted To
>
>
You should be able to specify linestyle='dashed' (or 'dashdot', or
'dotted') when you call hist().

I hope that helps!
Ben Root
--
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Outline for histogram bars

2013-11-13 Thread Benjamin Root
On Tue, Nov 12, 2013 at 8:01 PM, Ted To  wrote:

> Perfect!  Many thanks!  Seems to be an undocumented feature...
>
>
Not undocumented. In the docs for hist(), it says that it accepts any
parameter that is used for Patch artists. This is also generally true for
many of the other plotting functions. They usually take any additional
keyword arguments that could be passed on to whatever the artist is that is
returned. This isn't a hard-and-fast rule, but it is true more often than
not.



> Out of curiosity, what is the rationale behind using 'dashed' and
> 'dashdot' instead of '--' and '-.'?
>
>
This is an inadvertent oversight. I noted this in
https://github.com/matplotlib/matplotlib/issues/2136

Cheers!
Ben Root
--
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Outline for histogram bars

2013-11-15 Thread Benjamin Root
On Wed, Nov 13, 2013 at 8:16 PM, Ted To  wrote:

> Thanks Ben!
>
> I was wondering if you can help me with a related question.  How does
> one change the artist for the legend?  Since I have a "step" histogram,
> it would be nice to have the legend display lines rather than outlined
> rectangles.
>
> Thanks,
> Ted
>
>
I am not really an expert on that topic, but this question (or one very
similar) has come up before. I think the answer is to use "Proxy Artists".
If you search for proxy artists in the documentation, you should find stuff
about that.

Cheers!
Ben Root
--
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question about basic_example_writer.py

2013-12-05 Thread Benjamin Root
Hmmm, sounds like a bug of some sort. Perhaps a pixel size is not being
specified when creating the movie. Could you file an issue detailing
exactly which version of mpl you are using and which movie writer you are
using?

Cheers!
Ben Root


On Wed, Nov 27, 2013 at 11:57 AM, Andreas Hilboll  wrote:

> Hi,
>
> when running basic_example_writer.py, I get *.mp4 files with a canvas
> size of 800x600 pixels (at least that's what mplayer tells me). However,
> I have trouble understanding where this canvas size comes from. The
> example does not explicitly set the dpi or the figure size, and I don't
> have a matplotlibrc which changes these settings. So figure.dpi is 80,
> and the fig.size_inches is (8, 6). So how come this translates to a
> 800x600 pixel movie?
>
> Thanks for you insight :)
>
> -- Andreas.
>
>
> --
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matching shading on surfaces

2013-12-06 Thread Benjamin Root
Shading is a bit complicated in plot_surface(). In your particular case, it
is simply shading based on the results of calculating the normal vector of
each facet on the surface. It then normalizes the shading it has to do
based on what it has to get the full dynamic. This is why your image looks
the way it does (plus, there might be an issue where the normals for one of
your pieces is pointed inward instead of outward, probably due to the order
of the datapoints for the surface).

You can turn off shading altogether by simply passing shade=False as a
keyword argument to plot_surface().

I hope that helps!
Ben Root



On Fri, Dec 6, 2013 at 12:43 PM, Derek Thomas wrote:

> I have a surface that is defined in four distinct sections.  The sections
> are continuous and at least C^1 smooth at the interface.  When I plot this
> in 3D with matplotlib, each section is shaded differently.  Is it possible
> to make the shading uniform?  I have attached a figure.  The main goal is
> to make this look like one continuous surface.  Thanks,
>
> Derek
>
>
> --
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] axes.text() plotting text outside of axes bounds

2014-01-22 Thread Benjamin Root
On Wed, Jan 22, 2014 at 9:21 AM, Daryl Herzmann  wrote:

> Hello,
>
> I'm wondering why stuff plotted with ax.text() does not get "clipped" by
> the axes bounds on the plot.  Here's a simple example, run with 1.3.1:
>
> import matplotlib.pyplot as plt
>
> (fig, ax) = plt.subplots(1,1)
>
> for i in range(5):
>   for j in range(5):
> ax.text(i,j, "%sx%s" % (i,j), ha='center', va='center')
> ax.plot([0,8],[0,8])
> ax.set_xlim(0,2.8)
> ax.set_ylim(0,2.8)
> fig.savefig('test.png')
>
> and attached output.  This causes me lots of grief with basemap as well.
>  Is there a non-brute-force trick to get these values plotted outside the
> axes bounds removed?
>
> daryl
>
>
I can't quite remember what the original issue was, but I do seem to recall
that this behavior was made intentional for some reason. I honestly can't
remember why, though, and I can't fathom what circumstances that this would
be desirable...

Ben Root
--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] savefig - legend only

2014-01-31 Thread Benjamin Root
I would also like to point out that you can specify "auto" for a location,
and matplotlib will attempt to find a good location for you (within the
plot area). It isn't perfect, but it can be useful.

Cheers!
Ben Root


On Fri, Jan 31, 2014 at 7:02 AM, Skip Montanaro  wrote:

> > 1. PNG file of figure without legend.
> > 2. PNG file of legend only.
> >
> > The end user would import both images into another tool (e.g. microsoft
> > power point) and arrange figure and legend interactively for the final
> > product.
>
> As someone pointed out to me not long ago, you can call
>
> my_legend.draggable(True)
>
> then drag the legend where you want (in normal pointer mode). Then you
> just need to save the figure and not worry about fiddling with it
> later.
>
> Skip Montanaro
>
>
> --
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting a series of 3d quadrilaterals as a wireframe

2014-02-06 Thread Benjamin Root
I am not sure, but it sounds like you are talking about plot_wireframe()?

Ben Root
--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Happy Valentine's Day

2014-02-14 Thread Benjamin Root
I rolled a 20 today for necromancer, so I am going to do a thread
resurrection.  Given recent improvements in matplotlib, we should
definitely make this web-enabled. That way, we can share our nerdiness with
our non-nerdy significant others.

Happy Valentine's day!
Ben

On Mon, Feb 14, 2011 at 8:25 PM, Paul Ivanov  wrote:

> jules hummon, on 2011-02-14 07:23,  wrote:
> > Feel free to 'save and run', pass along, or ignore.
> > This was my valentine's day present today.
>
> Thank you for sharing! I took the liberty of livening it up for
> my sweetheart.
>
> #---
> # hohumheartbeat.py - a more lively hohumheart.py ;)
>
> import numpy as np
> import matplotlib as mpl
> import matplotlib.pyplot as plt
> from matplotlib.patches import Polygon
>
> # force square figure and square axes looks better for polar, IMO
> width, height = mpl.rcParams['figure.figsize']
> size = min(width, height)
> # make a square figure
> fig = plt.figure(figsize=(size, size))
> ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#ff')
> ax2 = fig.add_axes([0.45, .9, 0.1, 0.1], polar=True, axisbg='#ff')
>
> ax.set_rmax(2.0)
> ax2.set_rmax(4.0)
> ax2.spines['polar'].set_visible(False)
> ax2.patch.set_alpha(.3)
> for a in ax,ax2:
>   a.set_xticks([])
>   a.set_yticks([])
>   ax.grid(False)
>
> theta = np.linspace(0,1,100)*np.pi*2
> r = 1*(1-np.cos(theta))
>
> ncards = 5
> step = 2*np.pi/ncards
> pdict = dict(fc='r',ec='k', alpha=.5)
> for ii in range(ncards):
> tr = np.column_stack((theta+ii*step, r))
> ax.add_patch(Polygon(tr, **pdict))
>
> # from WolframMath "Heart Curve"
> r2 = 2 - 2*np.sin(theta)
> r2 += np.sin(theta) * np.sqrt(np.abs(np.cos(theta))) / (np.sin(theta)+1.4)
>
> tr2 = np.column_stack((theta, r2))
> ax2.add_patch(Polygon(tr2,**pdict)) # heart
>
> kwargs = dict(transform=ax2.transAxes, va='center', fontsize=20)
> ax2.text(0,.45,"I",ha='right',**kwargs)
> ax2.text(1,.4,"you",ha='left',**kwargs)
>
> beat =  np.tan(np.linspace(0, np.pi*2, 100))
> beat[0:20] = beat[60:80]
> beat[-20:] = beat[20:40]
> beat -= beat.min()
> beat /= beat.max()
>
> i=0; beatlen = len(beat)-1;
> def heartbeat(e):
> global i;
> i = (i+1) % (beatlen)
> y = beat[i]
> ax2.set_rmax(y*4. + 4.)
> ax2.draw(ax.figure.canvas.get_renderer())
> ax2.figure.canvas.blit(ax2.bbox)
> #plt.draw()  #use if the last two lines cause trouble
>
> # even your mouse movements make my heart skip a bit!
> cid = ax.figure.canvas.mpl_connect('idle_event', heartbeat)
>
> print "ax.figure.canvas.mpl_disconnect(%d)" %cid
> print "#run the line above to 'flatline' (stop heartbeat)"
> plt.show()
>
> best,
> --
> Paul Ivanov
> 314 address only used for lists,  off-list direct email at:
> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk1Z1gcACgkQe+cmRQ8+KPccQACgiCFswsMAqJObseb8yn2dHLR3
> UuwAn0xb2MeaQJffHt70/u8T1j6lmuCJ
> =0hq/
> -END PGP SIGNATURE-
>
>
> --
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Can't plot NCEP reanalysis data

2014-03-05 Thread Benjamin Root
The issue I see is one of ensuring that your inputs into contourf() are of
the expected shapes. If you want a generalized script, then you will need
to do various steps that can prepare 3d data into a 2d by assuming a
particular level. The fun part of all of this is that different data
sources organize their data differently. You might have data defined as
(time, lat, lon, z), or you might have (lon, lat, time), or maybe (z, lat,
lon). If your data sources are CF-compliant, then you might be able to take
advantage of tools such as ncview that tries to be very intelligent about
all of these fun issues.

Cheers!
Ben Root



On Tue, Mar 4, 2014 at 10:22 PM, Fadzil Mnor  wrote:

> Hi all,
> I've been looking for solution on this for days, and seems like nothing
> works.
> I wrote this code to read TRMM data and it works, but somehow not working
> when I use the same script to read NCEP reanalysis data...which later I
> found out it worked for netCDF files with only 1 'level'  (Zsize=1), not
> multiple 'levels' (Zsize more than 1).
> I'm stuck at where went wrong, and I tried everything and lost of track
> what the error massages were.
> This is what I wrote to read and plot NCEP reanalysis data. (this omega
> data has Xsize=144, Ysize=73, Zsize=12, Tsize=792, Esize=1)
>
> ---
> *import netCDF4 as nc*
> *import matplotlib.pyplot as plt*
> *from mpl_toolkits.basemap import Basemap*
> *import numpy as np*
>
> *f = nc.Dataset('D:/data/omega.mon.mean.nc
> ','r')*
> *omg = f.variables['omega'][0]*
> *lon = f.variables['lon'][:]*
> *lat = f.variables['lat'][:]*
> *times = f.variables['time'][:]*
>
> *# Set up a map *
> *map =
> Basemap(projection='cyl',llcrnrlat=0.,urcrnrlat=10.,llcrnrlon=97.,urcrnrlon=110.,resolution='i')*
> *x,y=map(*np.meshgrid(lon,lat))*
> *map.drawcoastlines()*
> *map.drawcountries()*
> *map.drawparallels(np.arange(-90.,90.,3),labels=[1,0,0,0],fontsize=10)*
> *map.drawmeridians(np.arange(-180.,180.,3),labels=[0,0,0,1],fontsize=10)*
>
> *#contour data*
> *clevs=np.arange(0.,1.,0.1) # contour interval*
> *cs = map.contourf(x,y,pcpr,clevs,extent='both')*
> *cb = map.colorbar(cs,'bottom',size='2%',pad="5%") #plot the colorbar *
>
> *cb.set_label('m/s')*
> *plt.title('Omega-test')*
>
> *plt.show()*
>
> *f.close()*
>
> -
>
> Above code gave error: Input z must be a 2D array
> (that's at *cs = map.contourf(x,y,pcpr,clevs,extent='both')*...)
>
> Hopefully anyone can help.
> Thanks for your time reading this.
>
> Fadzil
>
>
>
>
> --
> Subversion Kills Productivity. Get off Subversion & Make the Move to
> Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works.
> Faster operations. Version large binaries.  Built-in WAN optimization and
> the
> freedom to use Git, Perforce or both. Make the move to Perforce.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] video without black bands

2014-03-12 Thread Benjamin Root
In your options to mencoder, you are specifying the width/height as:

>>> 'type=png:w=9800:h=600:fps=0.6',

But your PNGs have size of 704x538 pixels. That's why you have black bars
on either side of your animation.

Cheers!
Ben Root



On Wed, Mar 12, 2014 at 7:16 AM, diedro  wrote:

> sorry for that,
> I supposed that I was not more in the the first mailing list. When I post
> the second one, I realized that I was still in the mailing list
>
> Regarding the post:
> Image Type: png (The PNG image format)
> Width: 704 pixels
> Height: 538 pixels
>
> Thanks a lot
>
> Diego
>
>
>
> On 12 March 2014 12:10, Oliver [via matplotlib] <[hidden 
> email]
> > wrote:
>
>> Please don't double post. Also, this post is much more informative than
>> the first, it's much clearer now where the problem is, and it is not
>> related to matplotlib at all, but with the options you're passing to
>> *mencoder*.
>>
>> What's the size of your orginal pngs?
>>
>>
>>
>> 2014-03-12 11:58 GMT+01:00 diedro <[hidden 
>> email]
>> >:
>>
>>> Dear all,
>>> I have created a video from *.png files. The problem is that my video has
>>> black bands on the left and on the right. I have used the following
>>> commands:
>>>
>>> command = ('mencoder',
>>>'mf://*.png',
>>>'-mf',
>>>'type=png:w=9800:h=600:fps=0.6',
>>>'-ovc',
>>>'lavc',
>>>'-lavcopts',
>>>'vcodec=mpeg4',
>>>'-oac',
>>>'copy',
>>>'-o',
>>>'output.avi')
>>>
>>> How could I create a video without the black bands.
>>>
>>> Thank you all,
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://matplotlib.1069221.n5.nabble.com/video-without-black-bands-tp43045.html
>>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>>
>>>
>>> --
>>> Learn Graph Databases - Download FREE O'Reilly Book
>>> "Graph Databases" is the definitive new guide to graph databases and
>>> their
>>> applications. Written by three acclaimed leaders in the field,
>>> this first edition is now available. Download your free book today!
>>> http://p.sf.net/sfu/13534_NeoTech
>>> ___
>>> Matplotlib-users mailing list
>>> [hidden email] 
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>>
>> --
>>
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their
>> applications. Written by three acclaimed leaders in the field,
>> this first edition is now available. Download your free book today!
>> http://p.sf.net/sfu/13534_NeoTech
>> ___
>> Matplotlib-users mailing list
>> [hidden email] 
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> --
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://matplotlib.1069221.n5.nabble.com/video-without-black-bands-tp43045p43046.html
>>  To unsubscribe from video without black bands, click here.
>> NAML
>>
>
>
> --
> View this message in context: Re: video without black 
> bands
>
> Sent from the matplotlib - users mailing list 
> archiveat 
> Nabble.com.
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three ac

Re: [Matplotlib-users] Matplotlib - Drawing a Trapezoid Isosceles with Poly3DCollection

2014-03-26 Thread Benjamin Root
Not that I am aware of. We kind of brute-force it in the plot_surface()
function:

polys = []
# Only need these vectors to shade if there is no cmap
if cmap is None and shade :
totpts = int(np.ceil(float(rows - 1) / rstride) *
 np.ceil(float(cols - 1) / cstride))
v1 = np.empty((totpts, 3))
v2 = np.empty((totpts, 3))
# This indexes the vertex points
which_pt = 0


#colset contains the data for coloring: either average z or the
facecolor
colset = []
for rs in xrange(0, rows-1, rstride):
for cs in xrange(0, cols-1, cstride):
ps = []
for a in (X, Y, Z) :
ztop = a[rs,cs:min(cols, cs+cstride+1)]
zleft = a[rs+1:min(rows, rs+rstride+1),
  min(cols-1, cs+cstride)]
zbase = a[min(rows-1, rs+rstride), cs:min(cols,
cs+cstride+1):][::-1]
zright = a[rs:min(rows-1, rs+rstride):, cs][::-1]
z = np.concatenate((ztop, zleft, zbase, zright))
ps.append(z)

# The construction leaves the array with duplicate points,
which
# are removed here.
ps = zip(*ps)
lastp = np.array([])
ps2 = [ps[0]] + [ps[i] for i in xrange(1, len(ps)) if ps[i]
!= ps[i-1]]
avgzsum = sum(p[2] for p in ps2)
polys.append(ps2)

if fcolors is not None:
colset.append(fcolors[rs][cs])
else:
colset.append(avgzsum / len(ps2))

# Only need vectors to shade if no cmap
if cmap is None and shade:
i1, i2, i3 = 0, int(len(ps2)/3), int(2*len(ps2)/3)
v1[which_pt] = np.array(ps2[i1]) - np.array(ps2[i2])
v2[which_pt] = np.array(ps2[i2]) - np.array(ps2[i3])
which_pt += 1
if cmap is None and shade:
normals = np.cross(v1, v2)
else :
normals = []


If you find a better way to do this, I will owe you some beers.

Cheers!
Ben Root



On Wed, Mar 26, 2014 at 7:17 AM,  wrote:

> Dear colleagues,
>
>  Exploring the 3D support for plotting a simple trapezoid isosceles based
> on eight locations with x,y,z (imagine a water tank). When doing a manual
> selection of the collections that defines each surface plane, the drawing
> works well (see a sample below). Watching for a more automated process that
> could work with a complex surface based on any Polygons.
>
> My question: Is there an algorithm, or function in Numpy or Matplotlib
> that identifies the quartet of each plane in the sample below?  I've tried
> to apply Numpy function "combinations", but it generates too many
> collections.
>
> Thanks in advance for your hint to optimize this drawing with the
> Matplotlib with Poly3DCollection
>
> Sample Code
> ---
> from mpl_toolkits.mplot3d import Axes3D
> from mpl_toolkits.mplot3d.art3d import Poly3DCollection
> from mpl_toolkits.mplot3d.art3d import Line3DCollection
> import matplotlib.pyplot as plt
> from matplotlib import cm
> import matplotlib.colors as colors
> from numpy import random
> fig = plt.figure()
> ax = Axes3D(fig)
> # for random color settings
> color = colors.rgb2hex(random.rand(3))
> # blue color
> color = 'b'
> #mypoly = [[2, 0, -1], [2, 0, 1], [4, 0, 1], [4, 0, -1],  [0, 4, -2], [0,
> 4, 2], [6, 4, 2], [6, 4, -2]]
> #   A   B  C  DE
> F  G  H
> # Colections for drawing 3D plot with polygon  (each plane defined
> separately)
> #plane a: A,E,H,D
> #plane b: A,E,F,B
> #plane c: B,F,G,C
> #plane d: C,G,H,D
> #plane e: E,F,G,H
> #plane f: A,B,C,D
> #plane collection
> xa = [2,0,6,4]
> ya = [0,4,4,0]
> za = [-1,-2,-2,-1]
> #second collection
> xb = [2,0,0,2]
> yb = [0,4,4,0]
> zb = [-1,-2,2,1]
> #third collection
> xc = [2,0,6,4]
> yc = [0,4,4,0]
> zc = [1,2,2,1]
> #fourth collection
> xd = [4,6,6,4]
> yd = [0,4,4,0]
> zd = [1,2,-2,-1]
> #fifth collection (kept open, to watch the plot result)
> xe = [0,0,6,6]
> ye = [4,4,4,4]
> ze = [-2,2,2,-2]
> #sixth collection
> xf = [2,2,4,4]
> yf = [0,0,0,0]
> zf = [-1,1,1,-1]
> # to do
> verts = [zip(xa, ya,za),zip(xb, yb,zb),zip(xc, yc,zc),zip(xd,
> yd,zd),zip(xf, yf,zf)]
> ax.add_collection3d(Poly3DCollection(verts, facecolors=color,
> linewidths=1, alpha=0.5))
> ax.add_collection3d(Line3DCollection(verts, colors='k', linewidths=0.2,
> linestyles=':'))
> # set axis view
> # add grid
> ax.grid(True)
> # view
> ax.set_xlim(-1,6)
> ax.set_ylim(-1,6)
> ax.set_zlim(-5,5)
> ax.view_init(elev=10., azim=110.)
> ax.get_xaxis().set_visible(True)
> ax.get_yaxis().set_visible(True)
> ax.set_autoscale_on(True)
> plt.show()
>
> Thanks for support.
>
> Regards,
> Claude
>
>
>
>
>
>
>
>
>
> * Claude Falbriard Certified IT Spec

Re: [Matplotlib-users] ipython --pylab interactive mode problem.

2014-03-27 Thread Benjamin Root
0.12.1 is a "very" old version of ipython. I know there have been some
changes to matplotlib to deal with changes that ipython has made over the
past two years, but I did think that they were all backwards compatible.

@mdboom, do you think this could be related to that "fix" we made on
detecting whether we were at the REPL or not?
--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] RedHat and Release Upgrade to Numpy 1.8.1 and Matplotlib 1.3.1 / Install from Source

2014-03-27 Thread Benjamin Root
How long did you wait? Do allow approximately one minute for the first
execution to allow for the font.cache to be built. It can appear that the
process has "hung" because it is waiting for "fc-list" subprocess to
complete.

Cheers!
Ben Root
--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] RedHat and Release Upgrade to Numpy 1.8.1 and Matplotlib 1.3.1 / Install from Source

2014-03-27 Thread Benjamin Root
Claude, it would be helpful to know exactly what code you executed. Some
example code assumes interactive modes, while others simply save files
without ever showing them to the screen.

Also, please include a copy of your matplotlibrc file.

Ben Root



On Thu, Mar 27, 2014 at 1:47 PM,  wrote:

> Dear Ben,
>
> The execution of any of the Matplotlib sample code start quickly and and
> exits immediately with no error message displayed  at the screen. The
> process runs instantly, so there is no wait in the process.
> Looks more like a missing setup option, matplotlib does not find a valid
> graphical screen display environment. What do you think is causing this
> error in RedHat Linux?
>
> Regards,
> Claude
>
>
>
>
>
>
>
> * Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortolândia
> / SP - Brazil phone:+55 13 9 9760 0453 <%2B55%2013%209%209760%200453>
> cell: +55 13 9 8117 3316 <%2B55%2013%209%208117%203316> e-mail:
>  [email protected]  *
>
>
> From:Benjamin Root 
> To:falbriard ,
> Cc:Matplotlib Users 
> Date:27/03/2014 14:32
> Subject:Re: [Matplotlib-users] RedHat and Release Upgrade to
> Numpy 1.8.1 and Matplotlib 1.3.1 / Install from Source
> Sent by:[email protected]
> --
>
>
>
> How long did you wait? Do allow approximately one minute for the first
> execution to allow for the font.cache to be built. It can appear that the
> process has "hung" because it is waiting for "fc-list" subprocess to
> complete.
>
> Cheers!
> Ben Root
>
--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Set X,Y,and Z data for a pcolormesh

2014-04-03 Thread Benjamin Root
So, you would like to plot a surface, and then have some slices through it?
Perhaps you are looking for something like this?
http://matplotlib.org/examples/mplot3d/contourf3d_demo2.html

In your case, I would use the contourf()'s "zdir" argument to set the
direction of the slice's normal vector, and the "offset" argument to set
the location of the slice. In this particular example, the three
contourf()'s were purposely placed on the edges of the axes, but they can
be placed anywhere you want them to be. You will need to supply contourf()
with the appropriate surface data to contour.

A word of caution. mplot3d's rendering is very crude. When you start to
intersect planes together, you will very likely get visual artifacts that I
tend to refer to as "Escher-like" in that they are physically impossible.
If you want true 3d volume rendering, then you may want to take a look at
glumpy or vis3d or mayavi2.

I hope that helps!
Ben Root



On Thu, Apr 3, 2014 at 12:50 AM, james  wrote:

> Hi All,
>
> I wish to make a 3d volume with a series of slices through it. I have X-Z
> data at 15 different Y planes. In MATLAB, I would make a pcolor plot, then
> set the Z data to the original ydata, and the Y data to a constant. This
> works fine.
>
> I would like to achieve a similar result in matplotlib, but I cannot figure
> out anyway to do it.
>
> Any help would be appreciated.
>
> James
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Set-X-Y-and-Z-data-for-a-pcolormesh-tp43187.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot a sphere and two more curves, and the aspect ratio to be preserved

2014-04-08 Thread Benjamin Root
Which version of matplotlib are you using? There used to be some issues
with this, but I could have sworn I resolved this a while back.


Ben Root


On Mon, Apr 7, 2014 at 2:40 PM, Emilia Petrisor
wrote:

> Dear all,
>
>
> I want to visualize the image through the stereographic projection (that
> maps
> the extended complex plane to the unit sphere), of a circle and a line
> from the plane.
>
> I imported:
>
> import numpy as np
> import matplotlib.pyplot as plt
> from mpl_toolkits.mplot3d import Axes3D
>
> fig = plt.figure()
> ax = fig.add_subplot(111,  projection='3d')
>
> If I plot only the  the sphere and  a circle in the plane xoy and set:
>
> ax.set_aspect('equal')
>
> all is OK, but inserting one more plot for the image of the circle onto
> the sphere,
> the aspect is changed and the sphere is displayed as an ellipsoid.
>
> My question is:  how could I lock the aspect in order to keep the geometry
> of the sphere?
>
> Thanks,
>
> Em
>
>
>
>
>
>
> --
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting oriented (two sided) surfaces

2014-04-14 Thread Benjamin Root
I think the closest you are going to get is with using the "shade=True"
kwarg in plot_surface(). This is the only way that mplot3d utilizes normal
vectors, and that really only makes one side look "duller" than the other.

Since you mentioned wanting to eventually display self-intersecting
surfaces, I would probably suggest trying out Mayavi2 or glumpy instead as
those are more geared towards 3d visualization than mplot3d is. mplot3d has
significant issues with rendering intersecting polygons because it isn't a
true 3d plotting system (it just computes projections of whole polygons and
uses a single z value to represent where in the layering the polygon should
go).

Cheers!
Ben Root



On Mon, Apr 14, 2014 at 9:34 AM, László Oroszlány wrote:

> well I sort of wanted to avoid doing two spheres..  later on I wanted to
> do more complicated surfaces.. and it can get a bit messy.. It is not
> straight forward to generate the two parallel surfaces in general..  to be
> honest the problematic case would be when i want to display
> selfintersecting but still orientable surfaces (NOT Klein bottles or
> Moebius strips)
> cheers anyway for the quick response
>
> laszlo
>
>
>
> On 14 April 2014 15:21, Shahar Shani Kadmiel wrote:
>
>> Hi, I am not aware of such an option (AFAIK) but my suggestion would be
>> to make two spheres with very small radii difference, paint the slightly
>> smaller one (inside) blue and the other one red.
>> Just a quick fix for the problem at hand. I'm sure the experts here will
>> have plenty of very in depth solutions.
>>
>> Shahar
>> —
>> Sent from Mailbox  for iPhone
>>
>>
>> On Mon, Apr 14, 2014 at 1:48 PM, László Oroszlány 
>> wrote:
>>
>>> Dear matplotlib users,
>>>
>>> I recently started using matplotlib to make a couple of educational
>>> presentations.
>>> For most of my problems I found the manual and the examples on the web
>>> enough,
>>> however I ran into a bit of an issue regarding plotting some surfaces.
>>> My main problem has to do with plotting orientable (or two sided
>>> surfaces).
>>> Simply put I want to plot a sphere cut in half and make the inside red
>>> and the outside blue.
>>> I was wondering if there exist some flag or option in the already
>>> available  plotting functions to do this?
>>>
>>> Cheers
>>>
>>> laszlo
>>>
>>>
>>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] testing issue involving matplotlib

2014-04-16 Thread Benjamin Root
Hmmm, it isn't the same, but I wonder if it is related to the oddities
around https://github.com/matplotlib/matplotlib/pull/2925 . What I mean is
that in that case, none of our unit tests caught the problem, even though
it should have. In your case, your unit tests is catching a similar
problem, but there is no obvious reason why there should be a problem.

Now, technically speaking, in your case, there is a bug in the unittest
package (values() is an iterator in py3k rather than a list), but I
wouldn't know why that dictionary would change in the first place.



On Mon, Apr 14, 2014 at 2:54 PM, John Evans wrote:

> Helllo, I'm seeing a strange issue when running unittests on python3.3 and
> python3.4 that somehow involves matplotlib.  My code has a somewhat
> complicated setup, but I think I've boiled the issue down to the following
> reproduction steps
>
>
> import unittest
> import warnings
>
> import matplotlib.pyplot
>
> class TestMe(unittest.TestCase):
> def test_warn(self):
> with self.assertWarns(UserWarning):
> warnings.warn("a warning", UserWarning)
>
> if __name__ == "__main__":
> unittest.main()
>
>
> It looks like it should pass, but it errors as follows
>
> E
> ==
> ERROR: test_warn (__main__.TestMe)
> --
> Traceback (most recent call last):
>   File "/homes/5/jevans/Downloads/testit.py", line 8, in test_warn
> with self.assertWarns(UserWarning):
>   File
> "/space/getafix/1/users/jevans/anaconda/envs/py3k/lib/python3.3/unittest/case.py",
> line 177, in __enter__
> for v in sys.modules.values():
> RuntimeError: dictionary changed size during iteration
>
> --
> Ran 1 test in 0.002
>
>
> If the matplotlib import is changed to just
>
> import matlotlib
>
> or if the matplotlib import is commented out altogether, it then passes.
>  I'm seeing the behavior on Anaconda with python 3.3 and matplotlib 1.3.1
> on both mac and linux, but also with MacPorts with pythons 3.3 and 3.4,
> matplotlib 1.3.1.  All seems fine with a  Fedora 20 laptop with python 3.3
> and also matplotlib 1.3.1.
>
>
> --
> John Evans
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?

2014-04-21 Thread Benjamin Root
While SVG isn't supported, EPS is... sort of.  Be very careful going
between windows and mac versions of Powerpoint. While they both support
EPS, they seem to do it differently and I have had to make emergency fixes
to presentations while at conferences because they were using Windows and I
only had access to Linux and Macs at home.

Cheers!
Ben Root


On Mon, Apr 21, 2014 at 7:34 AM, Juergen Hasch  wrote:

>
> No Powerpoint version I know supports SVG (or any vector graphics format
> useful in this case) and Matplotlib does not
> export WMF graphics anymore. So the easiest way is to use PNGs, if you can
> live with raster graphics.
>
> Alternatively, if you need vector graphics, you can export the Matplotlib
> plot as SVG and convert it to WMF or EMF using
> Inkscape. This can be done in the command line like this:
>
> "c:\Program Files\Inkscape-0.48\inkscape.exe" --without-gui
> --export-emf="output.emf" "input.svg"
>
>
>   Juergen
>
>
> Am 21.04.2014 13:06, schrieb Neal Becker:
> > Make sure to save into a vector graphic format so it can be resized.
>  Try pdf or
> > svg (don't know if M$ supports svg though)
> >
> > Paul Hobson wrote:
> >
> >> Sorry hit send by accident?
> >>
> >> What parameters are you passing to `savefig`?
> >>
> >> For a presentation, I would save as a .png file, a higher resolution
> and a
> >> transparent background. e.g.:
> >>
> >> fig.savefig('myfig.png', dpi=600, bbox_inches='ticht', transparent=True)
> >>
> >>
> >> On Sun, Apr 20, 2014 at 10:24 PM, Paul Hobson
> >>  wrote:
> >>
> >>> What parameters are you passing to `savefig`?
> >>>
> >>>
> >>> On Sat, Apr 19, 2014 at 1:13 PM, Chao YUE
> >>>  wrote:
> >>>
>  Dear all,
> 
>  Did anyone try to make plots using matplotlib, and then put the
> figure in
>  the powerpoint for presentation? Currently I am using the ipython
> notebook
>  --pylab mode to make the plots, and then save them to *jpg format.
> But when
>  I put it into the powerpoint, it does not look nice as I see on the
> screen
>  (a little bit blurred). You can really not notice it if you don't
> examine
>  carefully. But I really want to make high quality slides. So does
> anyone
>  have the same problem? could it be related with the figure format or
>  backend (GTKAgg) currently I am uisng? thanks a lot in advance.
> 
>  Cheers,
> 
>  Chao
> 
>  --
>  please visit:
>  http://www.globalcarbonatlas.org/
> 
> 
> >
> ***
>  Chao YUE
>  Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
>  UMR 1572 CEA-CNRS-UVSQ
>  Batiment 712 - Pe 119
>  91191 GIF Sur YVETTE Cedex
>  Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> 
> 
> >
> 
> 
> 
> 
> >
> --
>  Learn Graph Databases - Download FREE O'Reilly Book
>  "Graph Databases" is the definitive new guide to graph databases and
> their
>  applications. Written by three acclaimed leaders in the field,
>  this first edition is now available. Download your free book today!
>  http://p.sf.net/sfu/NeoTech
>  ___
>  Matplotlib-users mailing list
>  [email protected]
>  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> >>>
> >
> >
> >
> >
> --
> > Start Your Social Network Today - Download eXo Platform
> > Build your Enterprise Intranet with eXo Platform Software
> > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > Get Started Now And Turn Your Intranet Into A Collaboration Platform
> > http://p.sf.net/sfu/ExoPlatform
> > ___
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now 

Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?

2014-04-21 Thread Benjamin Root
JPGs will *always* have "bit blur" as it is a lossy image format. PNGs
would be a better bet.

Ben Root


On Mon, Apr 21, 2014 at 3:33 PM, ChaoYue  wrote:

> Hi all,
>
> Thank you all for your kind response. I am sorry, but none of these
> solutions significantly improved the visual quality on microsoft powerpiont
> 2007. Thought I didn't try eps. So probably l have to go with the current
> quality.
> here is a best case I have now:
> https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx
> You can still see the "a bit blur" everywhere (currently with jpg being
> inserted directly). I didn't have better quality than this one by trying
> the method as suggested by you. Let me know if I am raising too much high
> demand for this.
>
> Cheers,
>
> Chao
>
>
> On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] <[hidden
> email] > wrote:
>
>> ​Another alternative, if a vector graphics format doesn't work, is to
>> make your png figure large.  Then when you shrink it down to fit in your
>> slide, it should still have good resolution.
>>
>> Jon​
>>
>> On Mon, Apr 21, 2014 at 10:13 AM, <[hidden 
>> email]
>> > wrote:
>>
>>> No Powerpoint version I know supports SVG (or any vector graphics format
>>> useful in this case) and Matplotlib does not
>>> export WMF graphics anymore. So the easiest way is to use PNGs, if you
>>> can live with raster graphics.
>>>
>>> Alternatively, if you need vector graphics, you can export the
>>> Matplotlib plot as SVG and convert it to WMF or EMF using
>>> Inkscape. This can be done in the command line like this:
>>>
>>> "c:\Program Files\Inkscape-0.48\inkscape.exe" --without-gui
>>> --export-emf="output.emf" "input.svg"
>>>
>>>
>>>   Juergen
>>>
>>
>>
>> --
>> 
>> Jonathan D. Slavin Harvard-Smithsonian CfA
>> [hidden email] 
>>60 Garden Street, MS 83
>> phone: (617) 496-7981   Cambridge, MA 02138-1516
>> fax: (617) 496-7577USA
>> 
>>
>>
>> --
>>
>> Start Your Social Network Today - Download eXo Platform
>> Build your Enterprise Intranet with eXo Platform Software
>> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
>> Get Started Now And Turn Your Intranet Into A Collaboration Platform
>> http://p.sf.net/sfu/ExoPlatform
>> ___
>> Matplotlib-users mailing list
>> [hidden email] 
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> --
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://matplotlib.1069221.n5.nabble.com/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43262.html
>>  To start a new topic under matplotlib - users, email [hidden 
>> email]
>> To unsubscribe from matplotlib, click here.
>> NAML
>>
>
>
>
> --
> please visit:
> http://www.globalcarbonatlas.org/
>
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>
> 
>
> --
> View this message in context: Re: Make clear figure used in the
> powerpoint 
> slides?
> Sent from the matplotlib - users mailing list 
> archiveat 
> Nabble.com.
>
>
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/m

Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?

2014-04-22 Thread Benjamin Root
Yes, there is a difference if you use the button versus explicitly stating
the dpi in a savefig call. When you use the button, matplotlib has to use
the default dpi since there is no other way to specify it.

Cheers!
Ben Root


On Mon, Apr 21, 2014 at 5:03 PM, Chao YUE  wrote:

> Yes, in fact I set dpi as 1000, which is already very high. In fact I have
> another question, will there be any difference if I use the save button on
> the interactive plotting toolbar and use the command line
> figure.savefig('xx.png',dpi=1000)?
>
> Chao
>
>
> On Mon, Apr 21, 2014 at 10:59 PM, Jody Klymak  wrote:
>
>> Did you set the dpi of the png?
>>
>> Cheers,  Jody
>>
>>
>> On Apr 21, 2014, at  13:50 PM, ChaoYue  wrote:
>>
>> OK, I tried but I don't really see the difference between jpg and png by
>> my eyes in the attached case, maybe for other more complicated plots there
>> will be real difference. Anyway, thanks to all for your nice discussions.
>> And, BTW, I tried >2 hours trying to find a way to convert svg to emf, but
>> now I konw :p
>>
>> Cheers,
>>
>> Chao
>>
>>
>> On Mon, Apr 21, 2014 at 9:49 PM, Benjamin Root-2 [via matplotlib] <[hidden
>> email]> wrote:
>>
>>> JPGs will *always* have "bit blur" as it is a lossy image format. PNGs
>>> would be a better bet.
>>>
>>> Ben Root
>>>
>>>
>>>  On Mon, Apr 21, 2014 at 3:33 PM, ChaoYue <[hidden 
>>> email]<http://user/SendEmail.jtp?type=node&node=43265&i=0>
>>> > wrote:
>>>
>>>> Hi all,
>>>>
>>>> Thank you all for your kind response. I am sorry, but none of these
>>>> solutions significantly improved the visual quality on microsoft powerpiont
>>>> 2007. Thought I didn't try eps. So probably l have to go with the current
>>>> quality.
>>>> here is a best case I have now:
>>>> https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx
>>>> You can still see the "a bit blur" everywhere (currently with jpg being
>>>> inserted directly). I didn't have better quality than this one by trying
>>>> the method as suggested by you. Let me know if I am raising too much high
>>>> demand for this.
>>>>
>>>> Cheers,
>>>>
>>>> Chao
>>>>
>>>>
>>>> On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] <[hidden
>>>> email] <http://user/SendEmail.jtp?type=node&node=43264&i=0>> wrote:
>>>>
>>>>> ​Another alternative, if a vector graphics format doesn't work, is to
>>>>> make your png figure large.  Then when you shrink it down to fit in your
>>>>> slide, it should still have good resolution.
>>>>>
>>>>> Jon​
>>>>>
>>>>> On Mon, Apr 21, 2014 at 10:13 AM, <[hidden 
>>>>> email]<http://user/SendEmail.jtp?type=node&node=43262&i=0>
>>>>> > wrote:
>>>>>
>>>>>> No Powerpoint version I know supports SVG (or any vector graphics
>>>>>> format useful in this case) and Matplotlib does not
>>>>>> export WMF graphics anymore. So the easiest way is to use PNGs, if
>>>>>> you can live with raster graphics.
>>>>>>
>>>>>> Alternatively, if you need vector graphics, you can export the
>>>>>> Matplotlib plot as SVG and convert it to WMF or EMF using
>>>>>> Inkscape. This can be done in the command line like this:
>>>>>>
>>>>>> "c:\Program Files\Inkscape-0.48\inkscape.exe" --without-gui
>>>>>> --export-emf="output.emf" "input.svg"
>>>>>>
>>>>>>
>>>>>>   Juergen
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 
>>>>> Jonathan D. Slavin Harvard-Smithsonian CfA
>>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=43262&i=1>
>>>>>60 Garden Street, MS 83
>>>>> phone: 
>>>>> +16174967981" target="_blank">(617) 496-7981   Cambridge, MA
>>>>> 02138-1516
>>>>> fax: 
>>>>> +16174967577" target="_blank">(617) 496-7577  

Re: [Matplotlib-users] checking if an artist is in the list of artists for an axes

2014-04-22 Thread Benjamin Root
In most cases, you can also query the artist object for which axes it
belongs to:

ax = a.get_axes()

Note that is can be None if it hasn't been attached anywhere.

Cheers!
Ben Root


On Tue, Apr 22, 2014 at 3:35 AM, Eric Firing  wrote:

> On 2014/04/21 8:30 PM, Michael Mossey wrote:
> > How do I check if an artist is in the list of artists attached to an
> axes?
>
> if a in ax.get_children():
>  ...
>
> Eric
> >
> > Mike
> >
> >
> >
> >
> --
> > Start Your Social Network Today - Download eXo Platform
> > Build your Enterprise Intranet with eXo Platform Software
> > Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> > Get Started Now And Turn Your Intranet Into A Collaboration Platform
> > http://p.sf.net/sfu/ExoPlatform
> >
> >
> >
> > ___
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
Working off of very faded memory, try not to return any objects in your
init function that you intend to be animated. If I remember correctly, when
blitting is True, the animator treats any object returned by the init()
function as background objects, and any objects returned by the animation
function as blittable. Since your patch is returned in both functions, I
think it is getting confused.

Again, very rusty memory here...

Ben Root



On Wed, Apr 23, 2014 at 9:34 AM, Raymond Smith  wrote:

> Hi Mark,
>
> I can't say this is the 'proper' solution or the correct interpretation,
> but it should work.
>
> I think when blitting that the init function serves as a something of a
> "background" for the rest of the animation. So try changing
>
>
> def init():
> *patch.center = (5, 5)*
> ax.add_patch(patch)
> return patch,
>
> to
>
> def init():
> *patch.center = (5, -5)*
> ax.add_patch(patch)
> return patch,
>
> Cheers,
> Ray
>
>
> On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker  wrote:
>
>> Hello list,
>>
>> I am trying to animate a patch. The animation should show a circle
>> orbiting around a point. I took the code from
>> http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html
>>
>> Problem is that when I run the code, the animation doesn't remove the
>> initial position of the circle (blit is True) while it works correctly on
>> the website referenced above.
>>
>> Does anybody else see this behavior? Here's the code:
>>
>> import numpy as np
>> from matplotlib import pyplot as plt
>> from matplotlib import animation
>>
>> fig = plt.figure()
>> fig.set_dpi(100)
>> fig.set_size_inches(7, 6.5)
>>
>> ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
>> patch = plt.Circle((5, -5), 0.75, fc='y')
>>
>> def init():
>> patch.center = (5, 5)
>> ax.add_patch(patch)
>> return patch,
>>
>> def animate(i):
>> x, y = patch.center
>> x = 5 + 3 * np.sin(np.radians(i))
>> y = 5 + 3 * np.cos(np.radians(i))
>> patch.center = (x, y)
>> return patch,
>>
>> anim = animation.FuncAnimation(fig, animate,
>>init_func=init,
>>frames=360,
>>interval=20,
>>blit=True)
>>
>> plt.show()
>>
>> Thanks, Mark
>>
>>
>> --
>> Start Your Social Network Today - Download eXo Platform
>> Build your Enterprise Intranet with eXo Platform Software
>> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
>> Get Started Now And Turn Your Intranet Into A Collaboration Platform
>> http://p.sf.net/sfu/ExoPlatform
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
I think it is because the figure may or may not have some things drawn by
the time the blitting starts. This is due to draw_idle(). So, it is trying
to capture whatever is in the figure's canvas, but drawing may or may not
have happened yet.

Try this:

def animate(i):
if not animate.patch:
animate.patch = plt.Circle((5, -5), 0.75, fc='y')
animate.ax.add_patch(animate.patch)
x, y = animate.patch.center
x = 5 + 3 * np.sin(np.radians(i))
y = 5 + 3 * np.cos(np.radians(i))
animate.patch.center = (x, y)
return animate.patch,
animate.ax = ax
animate.patch = None

If you have something more complicated, then just go full bore and use
classes to store the state.

Cheers!
Ben Root



On Wed, Apr 23, 2014 at 10:51 AM, Raymond Smith  wrote:

> This is pretty weird. If instead of Mark's original script, if I move the
> add_patch out of init and have the init simply return an empty tuple, it
> _mostly_ works as expected. But -- at least on my computer -- on some runs,
> it has the moving circle, but also leaves a circle at the "top", starting
> point, whereas on other runs it simply has the desired moving circle with
> no 'background' circle. Usually, it will happen at least once if I start
> the animation script 10 times. So still, the init function is a bit of a
> mystery to me.
>
>
> import numpy as np
> from matplotlib import pyplot as plt
> from matplotlib import animation
>
> fig = plt.figure()
> fig.set_dpi(100)
> fig.set_size_inches(7, 6.5)
>
> ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
> patch = plt.Circle((5, -5), 0.75, fc='y')
> ax.add_patch(patch)
>
> def init():
> return tuple()
>
>
> def animate(i):
> x, y = patch.center
> patch.set_facecolor('y')
> patch.set_edgecolor('k')
>
> x = 5 + 3 * np.sin(np.radians(i))
> y = 5 + 3 * np.cos(np.radians(i))
> patch.center = (x, y)
> return patch,
>
> anim = animation.FuncAnimation(fig, animate,
>init_func=init,
>    frames=360,
>interval=20,
>blit=True)
>
> plt.show()
>
>
>
>
> On Wed, Apr 23, 2014 at 10:29 AM, Benjamin Root  wrote:
>
>> Working off of very faded memory, try not to return any objects in your
>> init function that you intend to be animated. If I remember correctly, when
>> blitting is True, the animator treats any object returned by the init()
>> function as background objects, and any objects returned by the animation
>> function as blittable. Since your patch is returned in both functions, I
>> think it is getting confused.
>>
>> Again, very rusty memory here...
>>
>> Ben Root
>>
>>
>>
>> On Wed, Apr 23, 2014 at 9:34 AM, Raymond Smith  wrote:
>>
>>> Hi Mark,
>>>
>>> I can't say this is the 'proper' solution or the correct interpretation,
>>> but it should work.
>>>
>>> I think when blitting that the init function serves as a something of a
>>> "background" for the rest of the animation. So try changing
>>>
>>>
>>> def init():
>>> *patch.center = (5, 5)*
>>> ax.add_patch(patch)
>>> return patch,
>>>
>>> to
>>>
>>> def init():
>>> *patch.center = (5, -5)*
>>> ax.add_patch(patch)
>>> return patch,
>>>
>>> Cheers,
>>> Ray
>>>
>>>
>>> On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker  wrote:
>>>
>>>> Hello list,
>>>>
>>>> I am trying to animate a patch. The animation should show a circle
>>>> orbiting around a point. I took the code from
>>>> http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html
>>>>
>>>> Problem is that when I run the code, the animation doesn't remove the
>>>> initial position of the circle (blit is True) while it works correctly on
>>>> the website referenced above.
>>>>
>>>> Does anybody else see this behavior? Here's the code:
>>>>
>>>> import numpy as np
>>>> from matplotlib import pyplot as plt
>>>> from matplotlib import animation
>>>>
>>>> fig = plt.figure()
>>>> fig.set_dpi(100)
>>>> fig.set_size_inches(7, 6.5)
>>>>
>>>> ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
>>>> patch = plt.Circle((5, -5), 0.75, fc='y')
>>>>
>>>> def init():
>

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
https://github.com/WeatherGod/BRadar

in scripts/, there is radarmovie.py which I create a few subclasses of
FuncAnimation, which was to solve a modularity issue I was having (I needed
self-contained animation classes that I could use pieces of elsewhere, but
still be able to join them all together into a single animation, as is the
case with radarmovie.py). Note, I do think I have an off-by-one error
somewhere, but I never have been able to figure it out, and these
particular animations do not use blitting because I didn't need it.

Now, you don't have to go all the way to subclassing FuncAnimation. The
suggestion about using classes is to avoid the (typically) bad style of
adding attributes to functions for the purpose of storing a state (which is
what a class is all about). You can't use a Patch object because the Patch
object wouldn't exist until the animation starts.

I hope that helps!
Ben Root



On Wed, Apr 23, 2014 at 3:38 PM, Mark Bakker  wrote:

> Benjamin,
>
> I don't mind doing classes to store the state, but isn't a Patch already a
> class?
> Do you know of an example online that I can work off?
>
> Thanks for your suggestions,
>
> Mark
>
>
> On Wed, Apr 23, 2014 at 5:12 PM, Benjamin Root  wrote:
>
>> I think it is because the figure may or may not have some things drawn by
>> the time the blitting starts. This is due to draw_idle(). So, it is trying
>> to capture whatever is in the figure's canvas, but drawing may or may not
>> have happened yet.
>>
>> Try this:
>>
>> def animate(i):
>> if not animate.patch:
>> animate.patch = plt.Circle((5, -5), 0.75, fc='y')
>> animate.ax.add_patch(animate.patch)
>> x, y = animate.patch.center
>>
>> x = 5 + 3 * np.sin(np.radians(i))
>> y = 5 + 3 * np.cos(np.radians(i))
>> animate.patch.center = (x, y)
>> return animate.patch,
>> animate.ax = ax
>> animate.patch = None
>>
>> If you have something more complicated, then just go full bore and use
>> classes to store the state.
>>
>> Cheers!
>> Ben Root
>>
>>
>>
>> On Wed, Apr 23, 2014 at 10:51 AM, Raymond Smith  wrote:
>>
>>> This is pretty weird. If instead of Mark's original script, if I move
>>> the add_patch out of init and have the init simply return an empty tuple,
>>> it _mostly_ works as expected. But -- at least on my computer -- on some
>>> runs, it has the moving circle, but also leaves a circle at the "top",
>>> starting point, whereas on other runs it simply has the desired moving
>>> circle with no 'background' circle. Usually, it will happen at least once
>>> if I start the animation script 10 times. So still, the init function is a
>>> bit of a mystery to me.
>>>
>>>
>>> import numpy as np
>>> from matplotlib import pyplot as plt
>>> from matplotlib import animation
>>>
>>> fig = plt.figure()
>>> fig.set_dpi(100)
>>> fig.set_size_inches(7, 6.5)
>>>
>>> ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
>>> patch = plt.Circle((5, -5), 0.75, fc='y')
>>> ax.add_patch(patch)
>>>
>>> def init():
>>> return tuple()
>>>
>>>
>>> def animate(i):
>>> x, y = patch.center
>>> patch.set_facecolor('y')
>>> patch.set_edgecolor('k')
>>>
>>> x = 5 + 3 * np.sin(np.radians(i))
>>> y = 5 + 3 * np.cos(np.radians(i))
>>> patch.center = (x, y)
>>> return patch,
>>>
>>> anim = animation.FuncAnimation(fig, animate,
>>>init_func=init,
>>>frames=360,
>>>interval=20,
>>>blit=True)
>>>
>>> plt.show()
>>>
>>>
>>>
>>>
>>> On Wed, Apr 23, 2014 at 10:29 AM, Benjamin Root  wrote:
>>>
>>>> Working off of very faded memory, try not to return any objects in your
>>>> init function that you intend to be animated. If I remember correctly, when
>>>> blitting is True, the animator treats any object returned by the init()
>>>> function as background objects, and any objects returned by the animation
>>>> function as blittable. Since your patch is returned in both functions, I
>>>> think it is getting confused.
>>>>
>>>> Again, very rusty memory here...
>>>>
>>>> Ben Root
>>>

Re: [Matplotlib-users] Which api to learn?

2014-04-30 Thread Benjamin Root
I wrote up my answer to this question on stackoverflow once:
https://stackoverflow.com/questions/19895262/when-to-use-the-matplotlib-pyplot-class-and-when-to-use-the-plot-object-matplot/21004357#21004357

Others may have different opinions or variations on the theme, but this is
how I look at the issue. It is also the reason why I don't want to
deprecate pylab (but do want to keep it out of examples).

Cheers!
Ben Root



On Wed, Apr 30, 2014 at 7:49 AM, Neal Becker  wrote:

> I've never used matlab (and hope never to have to).  But I've been using
> pyplot
> api for mpl for quite a while.
>
> Is there any good reason to move to the "native" mpl api and drop pyplot?
>  I ask
> because as I understand, pyplot is intended as a matlab workalike, and
> since I
> never learned matlab I have no need for that crutch.  OTOH, I'm quite used
> to
> the pyplot api at this point.
>
>
>
> --
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.  Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Millions of data points saved to pdf

2014-05-01 Thread Benjamin Root
This makes me wonder if you would be better served with something like
bokeh:

http://bokeh.pydata.org/

Cheers!
Ben Root



On Thu, May 1, 2014 at 9:28 AM, nertskull  wrote:

> No we definitely aren't really interested in the gaps.  Gaps are just where
> we were unable to collect the data.
>
> I don't know if we can attach pictures to this thread or not, but I'm going
> to try.
>
> The attached is roughly what I want, but with all 750 as vectors.
>
> I want to see the 'movement' of the line, but I need the gaps to remain, so
> I know where they are.
>
> The problem with plotting a reduced data set, is I lose some of the very
> small sections of line.  I'll play around with that idea, but we want to be
> able to zoom in on a vector file, and see the tiny areas of less than
> 10points that would be lost if we plot a reduced data set.
>
> But what it sounds like, is it is unlikely this will work in vector
> graphics
> form.  Its just too much to do without reducing the dataset.
>
> 
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Millions-of-data-points-saved-to-pdf-tp43338p43344.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.  Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Which api to learn?

2014-05-01 Thread Benjamin Root
"""
The pyplot interface is generally preferred for non-interactive
plotting (i.e., scripting). The pylab interface is convenient for
interactive calculations and plotting, as it minimizes typing. Note
that this is what you get if you use the ipython shell with the -pylab
option, which imports everything from pylab and makes plotting fully
interactive.
"""

Gotta remember to update this paragraph... the -pylab option has been long
deprecated, and is supposedly about to be removed in an upcoming release of
ipython.

Ben Root



On Thu, May 1, 2014 at 10:38 AM, Yuxiang Wang  wrote:

> Hi Neal,
>
> I always followed what has been written here:
>
>
> http://matplotlib.org/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
>
> And they said,
>
> --
> Matplotlib, pylab, and pyplot: how are they related?
>
> Matplotlib is the whole package; pylab is a module in matplotlib that
> gets installed alongside matplotlib; andmatplotlib.pyplot is a module
> in matplotlib.
>
> Pyplot provides the state-machine interface to the underlying plotting
> library in matplotlib. This means that figures and axes are implicitly
> and automatically created to achieve the desired plot. For example,
> calling plot from pyplot will automatically create the necessary
> figure and axes to achieve the desired plot. Setting a title will then
> automatically set that title to the current axes object:
>
> import matplotlib.pyplot as plt
>
> plt.plot(range(10), range(10))
> plt.title("Simple Plot")
> plt.show()
>
> Pylab combines the pyplot functionality (for plotting) with the numpy
> functionality (for mathematics and for working with arrays) in a
> single namespace, making that namespace (or environment) even more
> MATLAB-like. For example, one can call the sin and cos functions just
> like you could in MATLAB, as well as having all the features of
> pyplot.
>
> The pyplot interface is generally preferred for non-interactive
> plotting (i.e., scripting). The pylab interface is convenient for
> interactive calculations and plotting, as it minimizes typing. Note
> that this is what you get if you use the ipython shell with the -pylab
> option, which imports everything from pylab and makes plotting fully
> interactive.
> --
>
>
> -Shawn
>
> On Thu, May 1, 2014 at 2:16 AM, Michiel de Hoon 
> wrote:
> > 99.9% of the time I am using pyplot, as it usually does what I want
> without me having to understand an api.
> > I don't care so much if pyplot agrees with matlab or not, but it should
> be something easy that new users can pick up quickly.
> >
> > Best,
> > -Michiel
> >
> > 
> > On Wed, 4/30/14, Neal Becker  wrote:
> >
> >  Subject: [Matplotlib-users] Which api to learn?
> >  To: [email protected]
> >  Date: Wednesday, April 30, 2014, 7:49 AM
> >
> >  I've never used matlab (and hope
> >  never to have to).  But I've been using pyplot
> >  api for mpl for quite a while.
> >
> >  Is there any good reason to move to the "native" mpl api and
> >  drop pyplot?  I ask
> >  because as I understand, pyplot is intended as a matlab
> >  workalike, and since I
> >  never learned matlab I have no need for that crutch.
> >  OTOH, I'm quite used to
> >  the pyplot api at this point.
> >
> >
> >
>  
> --
> >  "Accelerate Dev Cycles with Automated Cross-Browser Testing
> >  - For FREE
> >  Instantly run your Selenium tests across 300+ browser/OS
> >  combos.  Get
> >  unparalleled scalability from the best Selenium testing
> >  platform available.
> >  Simple to use. Nothing to install. Get started now for
> >  free."
> >  http://p.sf.net/sfu/SauceLabs
> >  ___
> >  Matplotlib-users mailing list
> >  [email protected]
> >  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> >
> --
> > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> > Instantly run your Selenium tests across 300+ browser/OS combos.  Get
> > unparalleled scalability from the best Selenium testing platform
> available.
> > Simple to use. Nothing to install. Get started now for free."
> > http://p.sf.net/sfu/SauceLabs
> > ___
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> Yuxiang "Shawn" Wang
> Gerling Research Lab
> University of Virginia
> [email protected]
> +1 (434) 284-0836
> https://sites.google.com/a/virginia.edu/yw5aj/
>
>
> --
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.  Get
> unparalleled scalabi

Re: [Matplotlib-users] One colorbar for many plot

2014-05-21 Thread Benjamin Root
In v1.3, we added the ability to provide a list of axes objects to
pyplot.colorbar() (and maybe fig.colorbar()?). All of the axes objects in
that list would then get resized similarly to make room for the colorbar.

http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.colorbar

The AxesGrid option is also very nice, and I use it a lot.

Cheers!
Ben Root



On Tue, May 20, 2014 at 10:04 PM, Alex Goodman
wrote:

> I would consider using the AxesGrid toolkit [1], which makes it very easy
> to have a single colorbar for multiple plots.
>
> [1] -
> http://matplotlib.org/1.3.1/mpl_toolkits/axes_grid/users/overview.html
>
> Thanks,
> Alex
>
>
> On Tue, May 20, 2014 at 8:04 PM, Alex Goodman 
> wrote:
>
>> I would consider using the AxesGrid toolkit [1], which makes it very easy
>> to have a single colorbar for multiple plots.
>>
>> [1] -
>> http://matplotlib.org/1.3.1/mpl_toolkits/axes_grid/users/overview.html
>>
>> Thanks,
>> Alex
>>
>>
>> On Tue, May 20, 2014 at 7:57 PM, Dyah rahayu martiningrum <
>> [email protected]> wrote:
>>
>>> I am a newbie in python and I try to plot data like below :
>>>
>>> base_dir = 'C:/DATA2013/Day_E/'
>>> nc_fnames = ['20130203.faieb3p4g.nc', 
>>> '20130203.faieb3p4g.nc','20130203.faieb3p4g.nc']
>>> # beams
>>> ibeams = [0,1,2]
>>> # Change directory
>>> os.chdir(base_dir)
>>> for i, fname in enumerate(nc_fnames):
>>>
>>># Open file
>>> fd = nc.Dataset(fname, 'r')
>>>
>>> # Read variables
>>> beam = fd.variables['beam'][:]
>>> rng = fd.variables['range'][:]
>>> tim = fd.variables['time'][:]
>>> pwr = fd.variables['pwr'][:]
>>> nfft = fd.variables['nfft'][0]
>>> pn = fd.variables['pnoise'][:]
>>>
>>> # Close netCDF file
>>> fd.close()
>>>
>>> # Specify beam
>>> ibeam = ibeams[i]
>>>
>>> # Time convertion
>>> tim = tim/3600.0
>>>
>>> #Plot
>>> p_plot = pwr[ibeam]
>>>
>>> for it in range(len(tim)):
>>> p_plot[it] = p_plot[it] - pn[ibeam][it] - 10.*np.log10(nfft)
>>>
>>> p_plot = p_plot.transpose()
>>> #Specify subplot
>>> pl.subplot(311 + i)#Contour plot
>>> pl.contourf(tim, rng, p_plot)#Plot colorbar
>>> pl.colorbar()
>>> # Set X and Y axis lower/upper limit
>>> set_xy = range(4)
>>> set_xy[0] = 18.0 # x min
>>> set_xy[1] = 30.0 # x max
>>> set_xy[2] = 90.0 # y min
>>> set_xy[3] = 170.0 # y max
>>> pl.axis(set_xy)
>>> # Set labels
>>> pl.xlabel('time (hours)')
>>> pl.ylabel('range (km)')
>>>
>>> pl.show()
>>>
>>>
>>> The result looks like three panels with different colorbar for each
>>> panel. How do I make only one colorbar for all panels? Thank you in advance.
>>>
>>>
>>> --
>>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>>> Instantly run your Selenium tests across 300+ browser/OS combos.
>>> Get unparalleled scalability from the best Selenium testing platform
>>> available
>>> Simple to use. Nothing to install. Get started now for free."
>>> http://p.sf.net/sfu/SauceLabs
>>> ___
>>> Matplotlib-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>>
>> --
>> Alex Goodman
>> Graduate Research Assistant
>> Department of Atmospheric Science
>>  Colorado State University
>>
>
>
>
> --
> Alex Goodman
> Graduate Research Assistant
> Department of Atmospheric Science
> Colorado State University
>
>
> --
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform
> available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] event.ind in point picking gives wrong number

2014-06-07 Thread Benjamin Root
Thanks for the example script. I think I have a clue now what is happening.

If one were to also print out the length of the "d" array, you will find
that it is significantly shorter than when you aren't zoomed (I am getting
a length of 7 when it should be 155). But it isn't truncated for the other
dataset (which is of length 62). This makes me suspect that there is some
threshold being triggered here (possibly around 128?). I know there is such
a threshold for Paths for path simplification, but my tests turning it off
do not seem to make a difference. So, perhaps this might be related to
clipping?

I think at this point, you should definitely file a bug report.

Cheers!
Ben Root



On Sat, Jun 7, 2014 at 3:19 PM, C M  wrote:

> Hello again. This is follow-up on this 9 month old thread (I left this
> issue for a while and am now returning to it).
>
> I upgraded to the latest stable version of Matplotlib, 1.3.1, and tested
> and I am still getting the exact same confusing problem.
>
> Now I also have a small runnable test script that demonstrates this
> problem, from IDLE using Python 2.7 and Matplotlib 1.3.1.
>
> Attached is the script.  If you run it as is, it will show a plot. Click
> on the last point (which is obviously higher than the rest) and note the
> index number that is printed in the IDLE prompt.  It should say "index is:
> [154]".  But now zoom the plot tightly around that last point, and click on
> it again.  Now it will report that the index is much smaller (depending on
> how tightly you zoomed), down to "index is:  [1]".  This is the problem.
>
> What's critical to point out is:  this only occurs with *this* data.  To
> show that, go to the script and comment out the line near the end that
> starts with "plt.plot(bad_final_dates," and comment in the one below it,
> that starts with "plt.plot(good_final_dates,".  Run the script again, and
> repeat the process above.  You'll find that zooming does not affect the
> index number--which is the correct behavior.
>
> The contains_points() function was something I got on this mailing list
> from Jae-Joon some years back, and it is above my level of understanding,
> and it's possible I goofed something up in there.
>
> I'm really puzzled why one set of data doesn't have this problem and
> another one does. Any suggestions for what's wrong greatly appreciated.
>
> Thanks,
> Che
>
>
> On Mon, Sep 16, 2013 at 9:15 AM, Benjamin Root  wrote:
>
>>
>>
>>
>> On Sun, Sep 15, 2013 at 11:59 PM, C M  wrote:
>>
>>> Just a follow-up on this problem...
>>>
>>> I've found now that the index is only off if the plot is zoomed, and in
>>> the following way.  When I zoom, the first point that is visible in the
>>> plot window will have index = 0, the next point will have index = 1, and so
>>> forth.  If I zoom another section of the points, the indices are "reset" in
>>> this same way.
>>>
>>> What's really bizarre is that this is only occurring on one plot.  When
>>> I try to reproduce the problem on other plots (so far at least), I can't.
>>>
>>> Any suggestions for how to chase this down would be very welcome.
>>>
>>> Thanks.
>>>
>>>
>> That is a very useful observation. I am not very familiar with the artist
>> picking code, but if I have to guess, I would wonder if indices are being
>> determined from a path created *after* clip_to_rect() is used internally.
>> Given that you are having difficulties in reproducing this issue in other
>> plots, I would suggest trying to pare down your badly behaving code as much
>> as you can and post it here.  Furthermore, it would also be useful to
>> determine if the issue still occurs in v1.3 or in the master branch.
>>
>> Cheers!
>> Ben Root
>>
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] testing issue involving matplotlib

2014-06-10 Thread Benjamin Root
Thanks for the update.


On Tue, Jun 10, 2014 at 6:46 AM, John Evans 
wrote:

> Just to close the loop on this, I figured out that the issue was minimally
> reproduced if the "import matplotlib.pyplot" line was replaced with just
> "import six".  It was reported to the six package developers and the
> problem was resolved with the 1.7.0 release of six.
>
>
> On Wed, Apr 16, 2014 at 12:37 PM, Benjamin Root  wrote:
>
>> Hmmm, it isn't the same, but I wonder if it is related to the oddities
>> around https://github.com/matplotlib/matplotlib/pull/2925 . What I mean
>> is that in that case, none of our unit tests caught the problem, even
>> though it should have. In your case, your unit tests is catching a similar
>> problem, but there is no obvious reason why there should be a problem.
>>
>> Now, technically speaking, in your case, there is a bug in the unittest
>> package (values() is an iterator in py3k rather than a list), but I
>> wouldn't know why that dictionary would change in the first place.
>>
>>
>>
>> On Mon, Apr 14, 2014 at 2:54 PM, John Evans 
>> wrote:
>>
>>> Helllo, I'm seeing a strange issue when running unittests on python3.3
>>> and python3.4 that somehow involves matplotlib.  My code has a somewhat
>>> complicated setup, but I think I've boiled the issue down to the following
>>> reproduction steps
>>>
>>>
>>> import unittest
>>> import warnings
>>>
>>> import matplotlib.pyplot
>>>
>>> class TestMe(unittest.TestCase):
>>> def test_warn(self):
>>> with self.assertWarns(UserWarning):
>>> warnings.warn("a warning", UserWarning)
>>>
>>> if __name__ == "__main__":
>>> unittest.main()
>>>
>>>
>>> It looks like it should pass, but it errors as follows
>>>
>>> E
>>> ==
>>> ERROR: test_warn (__main__.TestMe)
>>> --
>>> Traceback (most recent call last):
>>>   File "/homes/5/jevans/Downloads/testit.py", line 8, in test_warn
>>> with self.assertWarns(UserWarning):
>>>   File
>>> "/space/getafix/1/users/jevans/anaconda/envs/py3k/lib/python3.3/unittest/case.py",
>>> line 177, in __enter__
>>> for v in sys.modules.values():
>>> RuntimeError: dictionary changed size during iteration
>>>
>>> --
>>> Ran 1 test in 0.002
>>>
>>>
>>> If the matplotlib import is changed to just
>>>
>>> import matlotlib
>>>
>>> or if the matplotlib import is commented out altogether, it then passes.
>>>  I'm seeing the behavior on Anaconda with python 3.3 and matplotlib 1.3.1
>>> on both mac and linux, but also with MacPorts with pythons 3.3 and 3.4,
>>> matplotlib 1.3.1.  All seems fine with a  Fedora 20 laptop with python 3.3
>>> and also matplotlib 1.3.1.
>>>
>>>
>>> --
>>> John Evans
>>>
>>>
>>> --
>>> Learn Graph Databases - Download FREE O'Reilly Book
>>> "Graph Databases" is the definitive new guide to graph databases and
>>> their
>>> applications. Written by three acclaimed leaders in the field,
>>> this first edition is now available. Download your free book today!
>>> http://p.sf.net/sfu/NeoTech
>>> ___
>>> Matplotlib-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>
>
> --
> John Evans
>
--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Error in atexit._run_exitfuncs

2014-06-25 Thread Benjamin Root
What it means, specifically, is that one (or more) figure objects still in
memory at the time of exiting the python interpretor are missing the
expected canvas attribute. I see this happen in various backends from time
to time. The best I can figure is that somehow, the destructor for the
figure has already been called (as it should), which should eliminate its
"FigureManager" instance, but for some reason, that figure manager is still
around and its destructor finally tries to destroy the canvas, which is
already gone.

It is really an odd bug, and I am fairly certain my diagnostic isn't quite
right because I never was able to make a SSCE for
testing/debugging/traceback purposes. The closest I was able to get was
with a preliminary version of the animation framework Ryan May and I were
working on a few years back. His code was holding some extra references,
while destroying other objects... it was weird.

Sorry, I don't have any solutions for you. Maybe someone else will.

Ben Root


On Wed, Jun 25, 2014 at 8:29 AM,  wrote:

> I am running matplotlib 1.3.1 under Ubuntu 13 and python3.
> Everything works fine, but I get this message every time:
>
>   Error in atexit._run_exitfuncs:
>   AttributeError: 'FigureManagerGTK3Cairo' object has no attribute 'canvas'
>
> What does it mean, and how do I stop it?
>
> Keith
>
>
>
> --
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Data plotting in a wrong place

2014-06-26 Thread Benjamin Root
don't know if this would make a difference, but meshgrid here is completely
unnecessary given that the netcdf file has the lats and lons in 2
dimensions anyway.

Given that this is a polar projection, I wouldn't be surprised if there is
something wonky there. Are the longitudes and latitudes monotonic?

Cheers!
Ben Root


On Thu, Jun 26, 2014 at 4:42 AM, billyi  wrote:

> Hi all! I'm trying to plot some sea ice freeboard data (netCDF, Gridded
> total
> freeboard) on the Antarctic sea, but the data that should plot nicely
> around
> Antarctica lies at the bottom of my image. NetCDF and matplotlib are fairly
> new to me so I'm not quite sure, where the error could be and I feel like
> I've search and tried everything there is.
> 
>
> from scipy.io.netcdf import netcdf_file as Dataset
> import numpy as np
> import matplotlib.pyplot as plt
>
> FB = Dataset('./datasets/fb-0217-0320.nc', 'r')
> f = FB.variables['f'][:,:]
> lat = FB.variables['lat'][:,0]
> lon = FB.variables['lon'][0,:]
> masked_fb = np.ma.masked_where(np.isnan(f), f)
> mtx_lon, mtx_lat = np.meshgrid(lon, lat)
> m = Basemap(projection='spstere',boundinglat=-50, lon_0=180.,
> resolution='l')
> m.bluemarble()
>
> plt.figure()
> m.pcolormesh(mtx_lon, mtx_lat, masked_fb, latlon=True)
> plt.show()
>
> And ncdump gives:
> dimensions:
> x = 79 ;
> y = 83 ;
> variables:
> float lat(y, x) ;
> lat:standard_name = "latitude" ;
> lat:long_name = "latitude coordinate" ;
> lat:units = "degrees_north" ;
> float lon(y, x) ;
> lon:standard_name = "longitude" ;
> lon:long_name = "longitude coordinate" ;
> lon:units = "degrees_east" ;
> float f(y, x) ;
> f:long_name = "total_freeboard" ;
> f:units = "mm" ;
> f:coordinates = "lat lon" ;
>
> Could there be something funny with the projection or handling the data?
> (When using meshgrid, handling the coordinates like ['lat'][:,0] seems
> necessary, otherwise it turns lats and lons like (6557,6557) and gives
> error
> message for pcolormesh, since masked_fb is (83,79).)
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Data-plotting-in-a-wrong-place-tp43580.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3D surface plot with box frame

2014-06-26 Thread Benjamin Root
If you supply the code you did to get where you got, I have a rough idea
how to get what you need. Essentially, you need to set the edgecolor of the
panes, I think. I have to dig a bit in the code to see how to do that,
though.


Cheers!
Ben Root



On Thu, Jun 26, 2014 at 7:42 PM, Dawes, Andrew M. 
wrote:

>  I’m trying to plot a 3d surface with a box frame around both sides (see
> example in the following link)
>
>  comparable example:
>  http://cloud.originlab.com/www/products/images2/3DGraph_ColorSurface.png
>
>  I made the axis panes white and disabled the grid which gets me 80% of
> the way. I don’t see anything obvious for showing additional axis lines to
> make the rest of the box (if such an option exists).
>
>  Any suggestions/hacks are welcome!
>
>  Thanks, Andy
>
>
>  --
> Andrew M.C. Dawes
> Associate Professor of Physics
> Pacific University
> amcdawes.com
>
>
> --
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Data plotting in a wrong place

2014-06-27 Thread Benjamin Root
actually, that is technically incorrect. That only works for monotonically
increasing series, but not monotonically decreasing series.

diffs = np.diff(lon)
if np.all(diffs <= 0):
return True
if np.all(diffs >= 0):
return True
return False

provided that len(lon) >= 2, obviously (and it doesn't work right for 2 or
more dimensions).

Ben Root



On Fri, Jun 27, 2014 at 10:03 AM, Jason Swails 
wrote:

> On Thu, 2014-06-26 at 23:14 -0700, billyi wrote:
> > Oh my, it WAS the meshgrid! Thank you so much!
> > When reading the coordinates like:
> > lat = FB.variables['lat'][:,:]
> > lon = FB.variables['lon'][:,:]
> >
> > And plotting (without meshgrid!):
> > m.pcolormesh(lon, lat, masked_fb, latlon=True)
> >
> > it works! Now I feel stupid.
> > And I think the longitudes and latitudes are not monotonic, but I don't
> know
> > the way to check this, other than checking the array like lon[:] in
> > terminal. Is there a better way?
>
> Yes.  Consider:
>
> py> all(lon[:-1] <= lon[1:])
>
> If True, then lon is monotonically increasing.  Otherwise it's not.
>
> Description:
>
> lon[:-1] is a slice that takes every element of lon except the last one.
> lon[1:] is a slice that takes every element of lon except the first one.
> The comparison operator will create a bool numpy array whose elements
> will be True for each element "i" if the i'th element is less than or
> equal to the i+1'th element.  Applying the "all" (or numpy.all)
> functions to this bool array will return True if every element is true
> and False otherwise.
>
> Faster, easier, and less error-prone than printing out the array and
> checking it yourself.  Of course you could do something more explicit:
>
> py> monotonic = True
> py> for i in range(len(lon)-1):
> py> if lon[i] > lon[i+1]:
> py> monotonic = False
> py> break
>
> HTH,
> Jason
>
>
>
> --
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] installation problem

2014-07-04 Thread Benjamin Root
One possibility is that with v1.3, we changed how packaging was done.
Unfortunately, this did cause some transitional issues. The best bet is to
uninstall *all* versions of matplotlib, pylab, and mpl_toolkits first, then
re-install v1.3.1. Note that waiting for the v1.4 release wouldn't
necessarily solve anything as it is the transition *from* older versions of
matplotlib that is the issue rather than transitioning *to* newer versions.

Hopefully this helps,
Ben Root



On Wed, Jul 2, 2014 at 9:35 PM, jw  wrote:

> I installed using version 1.3.1 windows binary
> "matplotlib-1.3.1.win32-py2.7.exe" from mathplotlib download. Installation
> went fine, but when using the package, it says "dateutil" and "pyparsing"
> are missing, which are supposed to be bundled according to the installation
> instruction. Is this a bug or expected behavior from now on? I did not have
> this issue for earlier versions of matplotlib.
> My base python is 2.7.8.
>
> If anyone is having the issue, either download the binaries from pythonlibs
> mentioned above, or
> install from the sources, which I did as follows:
> (1) Install setuptools if you don't have it.
> Download source from https://pypi.python.org/pypi/setuptools;
> Unpack and run 'ez_setup.py install'; or 'python ez_setup.py install'
> This will install setuptools.
>
> (2) Install any other package by downloading the source, unpacking, and
> running 'setup.py install'
> e.g., "dateutil" has been installed this way.
> https://pypi.python.org/pypi/python-dateutil, same for pyparsing
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/installation-problem-tp43325p43606.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PyNio

2014-07-04 Thread Benjamin Root
Perhaps Anaconda would be best for an easy to install environment and much
of the commonly used scientific computing tools?
http://continuum.io/downloads

As for PyNIO, due to licensing issues, it isn't installable through pip or
easy_install. If you go to their website and create a free account, you can
get an installer that would work fine out of the box, but I have never
tried to install PyNIO in an Anaconda environment.
https://www.pyngl.ucar.edu/Download/install_from_binary.shtml

As for "reading" IDL from python, no such thing exists AFAIK. I have come
across this tool: https://code.google.com/p/i2py/. I have never used it
(luckily), so I can't vouch for its usefulness. The goal of i2py is not to
be a one-to-one converter of IDL code into python, but rather to be an
assistant when migrating an IDL codebase into Python. The human still has
to go over the resulting code and make it valid. The most important thing
for the code migration is to start with unit tests in IDL, and then have
identical unit tests in python. This helps to make sure all of the code is
doing exactly what you expect them to do before and after code migration.

Best of luck to you!
Ben Root



On Fri, Jul 4, 2014 at 11:42 AM,  wrote:

>
>
> On Fri, Jul 4, 2014 at 10:07 AM, Dino Bektešević 
> wrote:
>
>> Hello dydy,
>>
>> If you've never done programing in python I would recommend a book
>> "dive into python" any version will do but the latest one is 3 I
>> think. Asking this questions in [email protected] will probably
>> get you even further since they mainly deal with general python
>> learning.
>>
>> Whatever you can use through command prompt you can use in python if
>> you use import subprocess. Subprocess.call("command") calls whatever
>> command you want over the command line. If you can call IDL to run
>> files over command line this can be an option. If not you're going to
>> have to use a wrapper tool like SWIG is foc c/c++ or another module to
>> connect to IDL. A useful module here will usually be os as well.
>>
>> As for installations of modules under windows platforms, that's always
>> tricky, I recommend using a virtualenv with pip, because then
>> generally installing a module boils down to using "pip install". But
>> even in virtualenv on windows I've had issues with installing i.e.
>> matplotlib and found it impossible and I've had to install it
>> system-wide by using one of the unofficial binary installers from:
>> http://www.lfd.uci.edu/~gohlke/pythonlibs/ and from then I have to
>> start start each virtualenv with the option --system-site-packages
>> which kind of defeats the purpose of a virtualenv, but such is the
>> nature of developing on win's
>> (I've read that you can activate local modules by hand, but I've not
>> been able to reproduce it)
>>
>
> I never recommend pip to Windows users (at least not until everything is
> in wheels).
>
> The last few times I had no problem `easy_install`ing the matplotlib exe
> installer in a virtualenv, nor any of the other exe installers.
>
> (pip is for Linux users, I never found anything better than easy_install
> on Windows.)
>
> Josef
>
>
>
>>
>>
>> I know this is a bunch of new info, I suggest you read up on it, best of
>> luck,
>> Dino
>>
>> 2014-07-04 3:05 GMT+02:00 dydy2014 :
>> > Hello all,
>> >
>> > I interested in python programming that is why I join in this forum.
>> > I want to know how to install new module in my python program?. I use
>> python
>> > under windows OS.
>> > Actually, I interest with PyNio but I don't know how to install it.
>> > Another question is how to make other language, for example, IDL, can be
>> > read in python?
>> > Thank you
>> >
>> > Dydy
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://matplotlib.1069221.n5.nabble.com/PyNio-tp43610.html
>> > Sent from the matplotlib - users mailing list archive at Nabble.com.
>> >
>> >
>> --
>> > Open source business process management suite built on Java and Eclipse
>> > Turn processes into business applications with Bonita BPM Community
>> Edition
>> > Quickly connect people, data, and systems into organized workflows
>> > Winner of BOSSIE, CODIE, OW2 and Gartner awards
>> > http://p.sf.net/sfu/Bonitasoft
>> > ___
>> > Matplotlib-users mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> --
>> Open source business process management suite built on Java and Eclipse
>> Turn processes into business applications with Bonita BPM Community
>> Edition
>> Quickly connect people, data, and systems into organized workflows
>> Winner of BOSSIE, CODIE, OW2 and Gartner awards
>> http://p.sf.net/sfu/Bonitasoft
>> ___
>> Matplotlib-users mailing list
>> Mat

Re: [Matplotlib-users] installation problem

2014-07-04 Thread Benjamin Root
I presume you mean pypi said that the latest version was 1.0.1? PyPi
recently (and rightly so) stopped automatically pull eggs from third-party
locations (this is a *huge* security risk). Version 1.0.1 was the last
version that was directly hosted on PyPi because the test suite made the
package so much bigger after that version.

There was talk about granting "top-tier" projects like matplotlib and
basemap special permission to upload larger eggs to PyPi. I don't know if
that has happened yet.

Cheers!
Ben Root


On Fri, Jul 4, 2014 at 2:48 PM, Rachana Katkam 
wrote:

> I faced the problem of upgrading my matplotlib to 1.3.1 having my
> python2.7. Its on Fedora am talking about. Its the dmg file available here
> http://matplotlib.org/downloads.html
> When I checked for upgrading from Terminal, it said matplotlib1.0.1 is the
> latest version.
>
>
> On Fri, Jul 4, 2014 at 10:52 PM, Goyo  wrote:
>
>> 2014-07-04 8:30 GMT+02:00 Rachana Katkam :
>> > Hey, even I had similar issue.
>> > Later I learnt python2.7 could support matplotlib version1.0.1 only.
>> >
>> > So if you want to upgrade your matplotlib, you first need to upgrade
>> your
>> > python.
>>
>> matplotlib 1.3.1 works quite well with python 2.7.
>>
>> Goyo
>>
>
>
>
> --
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] At.: draw Graph problem

2014-07-14 Thread Benjamin Root
How did you install or build matplotlib? It sounds like you built it from
source, and did not have any GUI dev tools installed. At the very minimum,
matplotlib will build only the non-interactive backends as they don't
require external dependencies (which would explain why you can save images,
but can't show them). Also, what is your OS?

Cheers!
Ben Root


On Sun, Jul 13, 2014 at 12:17 PM, Josè Luis Mietta <
[email protected]> wrote:

> Hi experts.
>
> I have two problems:
>
> 1) plt.show() doesnt work:   When i draw simple plot doing
>
> import numpy as npimport matplotlib.pyplot as plt
> x = np.range(0, 5, 0.1);
> y = np.sin(x)
> plt.plot(x, y)
> plt.show()
>
> no picture appears.I try to do this: 
> http://stackoverflow.com/questions/7534453/matplotlib-does-not-show-my-drawings-although-i-call-pyplot-show,
>  but I cant save changes in the file matplotlibrc.
>
> But, If I do:
> import numpy as npimport matplotlib.pyplot as plt
> x = np.range(0, 5, 0.1);
> y = np.sin(x)
> plt.plot(x, y)
> plt.savefig('.png')
>
>  the picture is generated and saved.
>
> 2. When I try to draw a Graph (using NetworkX and Matplotlib) doing:
>
> import numpy as npimport matplotlib.pyplot as plt
> improt networkx as nx
> x = nx.Graph(M) #M is my matrix
> nx.draw(x)
> plt.savefig('jjj.png')
>
> I always get a pictule like the attached file. How can I restore my
> old-drawing style?
>
> Waiting for your answer.
>
> Thanks a lot!!
>
>
>
>
> --
>
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck®
Code Sight™ - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to use transforms to rotate and shift a group of objects

2014-07-16 Thread Benjamin Root
Have you read through the transformation tutorial?
http://matplotlib.org/users/transforms_tutorial.html

There is a section on how to do a shadow transformation that might be
helpful. Obviously, you wouldn't need to create the second artist, but it
does show how to customize the transform on a per-artist basis.

Others might be able to provide better insight on whether or not there are
easier ways to do what you want.

Cheers!
Ben Root



On Wed, Jul 16, 2014 at 10:11 AM, Dr. Johannes Zellner  wrote:

> Hi,
>
> I'd like to plot several objects which are defined in coordinate systems
> which are local to each object in a common plot.
> The objects (and the corresponding local coordinate systems) are rotated
> and translated wrt. a global reference point.
>
> I tried something like
>
> r = matplotlib.transforms.Affine2D().rotate_deg(90)
> matplotlib.pyplot.plot(x, y, transform = r)
>
> but this didn't work.
>
> Additionally to matplotlib.pyplot.plot I use also
> matplotlib.patches.PathPatch, matplotlib.pyplot.plot to draw shapes and
> text.
>
> Any help on how to rotate (and shift) a whole assembly which contains
> eg. a matplotlib.patches.PathPatch and an annotation would be helpful.
>
> regards,
>
> --
> Johannes
>
>
> --
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to add a basemap to a 3D surface plot

2014-07-17 Thread Benjamin Root
>From the docstring for readshapefile:

A tuple (num_shapes, type, min, max) containing shape file info
is returned.
num_shapes is the number of shapes, type is the type code (one of
the SHPT* constants defined in the shapelib module, see
http://shapelib.maptools.org/shp_api.html) and min and
max are 4-element lists with the minimum and maximum values of the
vertices. If ``drawbounds=True`` a
matplotlib.patches.LineCollection object is appended to the tuple.

So, you are trying to add the tuple result rather than the line collection
that you have. That said, because readshapefile draws to an axes anyway, it
should already be adding the collection to the axes anyway. Try printing
out the type of the last element of the returned tuple. It should say that
it is a Line3DCollection type, because the Axes3D object should be
converting collections upon being added internally.

I should also note that at this time, mplot3d only supports linear
projections (I am currently working on a fix to support non-linear
projections, but it is still limited to rectilinear coordinates). Also, I
have never actually tried mashing together basemap and mplot3d, so if this
works, let me know!

Cheers!
Ben Root


On Thu, Jul 17, 2014 at 8:22 AM,  wrote:

> Dear colleagues,
>
> Wonder if there is a solution for prejecting a basemap, in my task, its a
> river shapefile, onto a 3D surface plot using Matplotlib.
>
> I've tried to use the Axes3D.ax.add_collection3d(rivers) method but my
> test did throw an error message like this.
>
> # tentatively add basemap to 3D
> m =
> Basemap(llcrnrlon=llclon,llcrnrlat=llclat,urcrnrlon=urclon,urcrnrlat=urclat,
> resolution ='l',area_thresh=1000.)
> river4 =
> m.readshapefile('../maps/KEN_water_lines_dcw','rivers4',drawbounds=True,color='SlateBlue',
> linewidth=1)
> ax.add_collection3d(river4)
>
> Error thrown at the add_collection3d is:   AttributeError: 'tuple' object
> has no attribute 'set_label'.
>
> Any hints or references to a similar example code are welcome.
>
> Regards,
> Claude
>
>
>
>
>
>
>
>
> * Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortolândia
> / SP - Brazil phone:+55 13 9 9760 0453 <%2B55%2013%209%209760%200453>
> cell: +55 13 9 8117 3316 <%2B55%2013%209%208117%203316> e-mail:
>  [email protected]  *
>
> --
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] why I can't see all the matplotlib user maillist email achieve from sourceforge

2014-07-28 Thread Benjamin Root
No clue. This question has come up from time to time. I recommend using
Nabble to search the archives.


On Mon, Jul 28, 2014 at 2:10 AM, asmwarrior  wrote:

> Hi, can any one view the full email achieve for the matplotlib user
> maillist?
> I can only see mails up to year 2012, see image shot here:
>
> http://stackoverflow.com/questions/24971546/why-i-cant-see-all-the-matplotlib-user-maillist-email-achieve-from-sourceforge
> Thank you very much.
>
> asmwarrior(ollydbg)
>
>
> --
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basic matshow question

2014-07-30 Thread Benjamin Root
I think it is mostly an issue with how IPython interfaces with matplotlib.
If you were running from a pure python prompt, then I would suspect it to
work (haven't tried myself, though). Note that the --pylab option to
ipython is now highly discouraged. Instead, I would try the "%matplotlib
interactive" cell magic instead (I think that is the right incantation).


On Wed, Jul 30, 2014 at 2:15 AM, JBB  wrote:

> On 7/29/14, 10:49 PM, Eric Firing wrote:
>  > On 2014/07/29, 7:04 PM, JBB wrote:
>  >> Hello,
>  >>
>  >> I am relatively new to Python, numpy, matplotlib, etc., with a
>  >> reasonable amount of Matlab experience.
>
> ...[ Problem and test code trimmed ]
>
>  >
>  > First, at least initially for this sort of thing, run in "ipython
>  > --pylab", and don't use any "ion()" or "ioff()".
>  >
>  > Second, replace the "show(); time.sleep(1)" with "pause(1)".
>  >
>  > I think that will do it.
>  >
>  > Eric
>  >
>
> Thank you, very much.  It did indeed work.
>
> Is there a pointer to why this worked when my initial approach did not?
>   I thought from the documentation/videos that preparing a plot with
> relevant commands then issuing the show() command was the preferred
> approach within Python/Matplotlib.
>
> JBB
>
>
>
>
>
> --
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basic matshow question

2014-07-30 Thread Benjamin Root
There is no change to the recommendations for interactive plots from the
console, if by console you mean the normal python REPL. There is no --pylab
for that. If you mean from the IPython console, then it is the cell magic I
mentioned previously.


On Wed, Jul 30, 2014 at 1:19 PM, Matthew Brett 
wrote:

> Hi,
>
> On Wed, Jul 30, 2014 at 9:30 AM, Benjamin Root  wrote:
> > I think it is mostly an issue with how IPython interfaces with
> matplotlib.
> > If you were running from a pure python prompt, then I would suspect it to
> > work (haven't tried myself, though). Note that the --pylab option to
> ipython
> > is now highly discouraged. Instead, I would try the "%matplotlib
> > interactive" cell magic instead (I think that is the right incantation).
>
> Sorry for being slightly off-topic, but what is the current
> recommendation then for interactive plots from the console, if --pylab
> is discouraged?
>
> Cheers,
>
> Matthew
>
--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basic matshow question

2014-07-30 Thread Benjamin Root
right, thank you, it is "inline", not "interactive". I really need a memory
upgrade...

Cheers!
Ben Root


On Wed, Jul 30, 2014 at 1:26 PM, Nathan Goldbaum 
wrote:

> You would use "%matplotlib inline" if you want the plots to show up inline
> in the notebook.  If you want to use one of the gui backends, it would be
> "%matplotlib ".  More detail here:
>
>
> http://ipython.org/ipython-doc/2/api/generated/IPython.core.magics.pylab.html#IPython.core.magics.pylab.PylabMagics.matplotlib
>
> Pylab is going to be removed in IPython 3.0 (in fact it's already gone in
> master) since it has several bad interactions with the rest of the
> numpy/scipy universe and leads to un-reproducible code.  See this blog post
> for more detail on why using pylab is a bad idea:
>
> https://carreau.github.io/posts/10-No-PyLab-Thanks.ipynb.html
>
>
> On Wed, Jul 30, 2014 at 10:19 AM, Matthew Brett 
> wrote:
>
>>  Hi,
>>
>> On Wed, Jul 30, 2014 at 9:30 AM, Benjamin Root  wrote:
>> > I think it is mostly an issue with how IPython interfaces with
>> matplotlib.
>> > If you were running from a pure python prompt, then I would suspect it
>> to
>> > work (haven't tried myself, though). Note that the --pylab option to
>> ipython
>> > is now highly discouraged. Instead, I would try the "%matplotlib
>> > interactive" cell magic instead (I think that is the right incantation).
>>
>> Sorry for being slightly off-topic, but what is the current
>> recommendation then for interactive plots from the console, if --pylab
>> is discouraged?
>>
>> Cheers,
>>
>> Matthew
>>
>>
>> --
>> Infragistics Professional
>> Build stunning WinForms apps today!
>> Reboot your WinForms applications with our WinForms controls.
>> Build a bridge from your legacy apps to the future.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib history

2014-07-30 Thread Benjamin Root
Hello all,

I am trying to put together notes for a writeup on a short history of
matplotlib (in particular, its uses for interactive plotting). I have John
Hunter's SciPy 2012 Keynote, which helps, but I was hoping for some other
sources.

Unfortunately, searching for "matplotlib" and "history" gets me lots of
results on our trials and tribulations with version control...

Anybody have anything bookmarked?

Cheers!
Ben Root

P.S. - Yes... this is for a book. Stay tuned!
--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib history

2014-07-30 Thread Benjamin Root
Fernando,

This information is going to be the preface of my book on using matplotlib
for making an interactive application (sorry, no IPython, the editor wanted
to keep the scope tight). So, what I am looking for are some of the major
interactive features (who supplied them, and their reasons/purpose). Also,
how has interactive matplotlib supported uses "in the wild" such as the
Mars Phoenix Lander and recently, the ISEE3 reboot project (that abandoned
satellite that was recently revived by citizen scientists).

Of, course, any insights to John's original needs/use cases in the early
years would be very valuable as well. I could have sworn he has written
such missives on the mailing lists, but I can't seem to find them.

Cheers!
Ben Root
On Jul 30, 2014 11:21 PM, "Fernando Perez"  wrote:

> Hi Ben,
>
> if by interactive plotting you refer to using it interactively via ipython
> and other such systems, there's a good part of that history that is spread
> somewhere between the early mpl and ipython archives AND John's and my
> personal inboxes.
>
> A good chunk of that (not all, mind you, since many others contributed)
> happened with John and I working on it, and sadly he's not with us and I
> had a loss of my early email (anything older than 2005) when I left the
> University of Colorado.
>
> I'd be happy to answer some questions if you have them, to the best of my
> memory. Probably quicker over skype/phone, ping me directly (at my Berkeley
> address) if you want.
>
> Cheers
>
> f
>
>
>
> On Wed, Jul 30, 2014 at 7:20 PM, Benjamin Root  wrote:
>
>> Hello all,
>>
>> I am trying to put together notes for a writeup on a short history of
>> matplotlib (in particular, its uses for interactive plotting). I have John
>> Hunter's SciPy 2012 Keynote, which helps, but I was hoping for some other
>> sources.
>>
>> Unfortunately, searching for "matplotlib" and "history" gets me lots of
>> results on our trials and tribulations with version control...
>>
>> Anybody have anything bookmarked?
>>
>> Cheers!
>> Ben Root
>>
>> P.S. - Yes... this is for a book. Stay tuned!
>>
>>
>> --
>> Infragistics Professional
>> Build stunning WinForms apps today!
>> Reboot your WinForms applications with our WinForms controls.
>> Build a bridge from your legacy apps to the future.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Fernando Perez (@fperez_org; http://fperez.org)
> fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
> fernando.perez-at-berkeley: contact me here for any direct mail
>
--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib history

2014-08-01 Thread Benjamin Root
Just to keep my notes in one place... from Matplotlib's "Introduction" page
is prose that I assume was written by John:

For years, I used to use MATLAB exclusively for data analysis and
visualization. MATLAB excels at making nice looking plots easy. When I
began working with EEG data, I found that I needed to write applications to
interact with my data, and developed and EEG analysis application in
MATLAB. As the application grew in complexity, interacting with databases,
http servers, manipulating complex data structures, I began to strain
against the limitations of MATLAB as a programming language, and decided to
start over in Python. Python more than makes up for all of MATLAB’s
deficiencies as a programming language, but I was having difficulty finding
a 2D plotting package (for 3D VTK <http://www.vtk.org/> more than exceeds
all of my needs).

When I went searching for a Python plotting package, I had several
requirements:

   - Plots should look great - publication quality. One important
   requirement for me is that the text looks good (antialiased, etc.)
   - Postscript output for inclusion with TeX documents
   - Embeddable in a graphical user interface for application development
   - Code should be easy enough that I can understand it and extend it
   - Making plots should be easy

Finding no package that suited me just right, I did what any
self-respecting Python programmer would do: rolled up my sleeves and dived
in. Not having any real experience with computer graphics, I decided to
emulate MATLAB’s plotting capabilities because that is something MATLAB
does very well. This had the added advantage that many people have a lot of
MATLAB experience, and thus they can quickly get up to steam plotting in
python. From a developer’s perspective, having a fixed user interface (the
pylab interface) has been very useful, because the guts of the code base
can be redesigned without affecting user code.





On Wed, Jul 30, 2014 at 11:51 PM, Benjamin Root  wrote:

> Fernando,
>
> This information is going to be the preface of my book on using matplotlib
> for making an interactive application (sorry, no IPython, the editor wanted
> to keep the scope tight). So, what I am looking for are some of the major
> interactive features (who supplied them, and their reasons/purpose). Also,
> how has interactive matplotlib supported uses "in the wild" such as the
> Mars Phoenix Lander and recently, the ISEE3 reboot project (that abandoned
> satellite that was recently revived by citizen scientists).
>
> Of, course, any insights to John's original needs/use cases in the early
> years would be very valuable as well. I could have sworn he has written
> such missives on the mailing lists, but I can't seem to find them.
>
> Cheers!
> Ben Root
> On Jul 30, 2014 11:21 PM, "Fernando Perez"  wrote:
>
>> Hi Ben,
>>
>> if by interactive plotting you refer to using it interactively via
>> ipython and other such systems, there's a good part of that history that is
>> spread somewhere between the early mpl and ipython archives AND John's and
>> my personal inboxes.
>>
>> A good chunk of that (not all, mind you, since many others contributed)
>> happened with John and I working on it, and sadly he's not with us and I
>> had a loss of my early email (anything older than 2005) when I left the
>> University of Colorado.
>>
>> I'd be happy to answer some questions if you have them, to the best of my
>> memory. Probably quicker over skype/phone, ping me directly (at my Berkeley
>> address) if you want.
>>
>> Cheers
>>
>> f
>>
>>
>>
>> On Wed, Jul 30, 2014 at 7:20 PM, Benjamin Root  wrote:
>>
>>> Hello all,
>>>
>>> I am trying to put together notes for a writeup on a short history of
>>> matplotlib (in particular, its uses for interactive plotting). I have John
>>> Hunter's SciPy 2012 Keynote, which helps, but I was hoping for some other
>>> sources.
>>>
>>> Unfortunately, searching for "matplotlib" and "history" gets me lots of
>>> results on our trials and tribulations with version control...
>>>
>>> Anybody have anything bookmarked?
>>>
>>> Cheers!
>>> Ben Root
>>>
>>> P.S. - Yes... this is for a book. Stay tuned!
>>>
>>>
>>> --
>>> Infragistics Professional
>>> Build stunning WinForms apps today!
>>> Reboot your WinForms applications with our WinForms controls.
>>> Build a bridge from your legacy apps to t

Re: [Matplotlib-users] Matplotlib history

2014-08-03 Thread Benjamin Root
For those interested, I have found the release announcement that introduced
the jet colormap: http://ehc.ac/p/matplotlib/mailman/message/188760/ . We
have someone named "Perry" to blame... :-P

Ben Root


On Fri, Aug 1, 2014 at 9:01 PM, Benjamin Root  wrote:

> Just to keep my notes in one place... from Matplotlib's "Introduction"
> page is prose that I assume was written by John:
>
> For years, I used to use MATLAB exclusively for data analysis and
> visualization. MATLAB excels at making nice looking plots easy. When I
> began working with EEG data, I found that I needed to write applications to
> interact with my data, and developed and EEG analysis application in
> MATLAB. As the application grew in complexity, interacting with databases,
> http servers, manipulating complex data structures, I began to strain
> against the limitations of MATLAB as a programming language, and decided to
> start over in Python. Python more than makes up for all of MATLAB’s
> deficiencies as a programming language, but I was having difficulty finding
> a 2D plotting package (for 3D VTK <http://www.vtk.org/> more than exceeds
> all of my needs).
>
> When I went searching for a Python plotting package, I had several
> requirements:
>
>- Plots should look great - publication quality. One important
>requirement for me is that the text looks good (antialiased, etc.)
>- Postscript output for inclusion with TeX documents
>- Embeddable in a graphical user interface for application development
>- Code should be easy enough that I can understand it and extend it
>- Making plots should be easy
>
> Finding no package that suited me just right, I did what any
> self-respecting Python programmer would do: rolled up my sleeves and dived
> in. Not having any real experience with computer graphics, I decided to
> emulate MATLAB’s plotting capabilities because that is something MATLAB
> does very well. This had the added advantage that many people have a lot of
> MATLAB experience, and thus they can quickly get up to steam plotting in
> python. From a developer’s perspective, having a fixed user interface (the
> pylab interface) has been very useful, because the guts of the code base
> can be redesigned without affecting user code.
>
>
>
>
>
> On Wed, Jul 30, 2014 at 11:51 PM, Benjamin Root  wrote:
>
>> Fernando,
>>
>> This information is going to be the preface of my book on using
>> matplotlib for making an interactive application (sorry, no IPython, the
>> editor wanted to keep the scope tight). So, what I am looking for are some
>> of the major interactive features (who supplied them, and their
>> reasons/purpose). Also, how has interactive matplotlib supported uses "in
>> the wild" such as the Mars Phoenix Lander and recently, the ISEE3 reboot
>> project (that abandoned satellite that was recently revived by citizen
>> scientists).
>>
>> Of, course, any insights to John's original needs/use cases in the early
>> years would be very valuable as well. I could have sworn he has written
>> such missives on the mailing lists, but I can't seem to find them.
>>
>> Cheers!
>> Ben Root
>> On Jul 30, 2014 11:21 PM, "Fernando Perez"  wrote:
>>
>>> Hi Ben,
>>>
>>> if by interactive plotting you refer to using it interactively via
>>> ipython and other such systems, there's a good part of that history that is
>>> spread somewhere between the early mpl and ipython archives AND John's and
>>> my personal inboxes.
>>>
>>> A good chunk of that (not all, mind you, since many others contributed)
>>> happened with John and I working on it, and sadly he's not with us and I
>>> had a loss of my early email (anything older than 2005) when I left the
>>> University of Colorado.
>>>
>>> I'd be happy to answer some questions if you have them, to the best of
>>> my memory. Probably quicker over skype/phone, ping me directly (at my
>>> Berkeley address) if you want.
>>>
>>> Cheers
>>>
>>> f
>>>
>>>
>>>
>>> On Wed, Jul 30, 2014 at 7:20 PM, Benjamin Root  wrote:
>>>
>>>> Hello all,
>>>>
>>>> I am trying to put together notes for a writeup on a short history of
>>>> matplotlib (in particular, its uses for interactive plotting). I have John
>>>> Hunter's SciPy 2012 Keynote, which helps, but I was hoping for some other
>>>> sources.
>>>>
>>>> Unfortunately

Re: [Matplotlib-users] Matplotlib history

2014-08-03 Thread Benjamin Root
Whoops, I hadn't realized I stumbled onto a clone of sourceforge (a
mirror?). Here is the real link:
http://sourceforge.net/p/matplotlib/mailman/message/188760/


On Sun, Aug 3, 2014 at 9:37 PM, Benjamin Root  wrote:

> For those interested, I have found the release announcement that
> introduced the jet colormap:
> http://ehc.ac/p/matplotlib/mailman/message/188760/ . We have someone
> named "Perry" to blame... :-P
>
> Ben Root
>
>
> On Fri, Aug 1, 2014 at 9:01 PM, Benjamin Root  wrote:
>
>> Just to keep my notes in one place... from Matplotlib's "Introduction"
>> page is prose that I assume was written by John:
>>
>> For years, I used to use MATLAB exclusively for data analysis and
>> visualization. MATLAB excels at making nice looking plots easy. When I
>> began working with EEG data, I found that I needed to write applications to
>> interact with my data, and developed and EEG analysis application in
>> MATLAB. As the application grew in complexity, interacting with databases,
>> http servers, manipulating complex data structures, I began to strain
>> against the limitations of MATLAB as a programming language, and decided to
>> start over in Python. Python more than makes up for all of MATLAB’s
>> deficiencies as a programming language, but I was having difficulty finding
>> a 2D plotting package (for 3D VTK <http://www.vtk.org/> more than
>> exceeds all of my needs).
>>
>> When I went searching for a Python plotting package, I had several
>> requirements:
>>
>>- Plots should look great - publication quality. One important
>>requirement for me is that the text looks good (antialiased, etc.)
>>- Postscript output for inclusion with TeX documents
>>- Embeddable in a graphical user interface for application development
>>- Code should be easy enough that I can understand it and extend it
>>- Making plots should be easy
>>
>> Finding no package that suited me just right, I did what any
>> self-respecting Python programmer would do: rolled up my sleeves and dived
>> in. Not having any real experience with computer graphics, I decided to
>> emulate MATLAB’s plotting capabilities because that is something MATLAB
>> does very well. This had the added advantage that many people have a lot of
>> MATLAB experience, and thus they can quickly get up to steam plotting in
>> python. From a developer’s perspective, having a fixed user interface (the
>> pylab interface) has been very useful, because the guts of the code base
>> can be redesigned without affecting user code.
>>
>>
>>
>>
>>
>> On Wed, Jul 30, 2014 at 11:51 PM, Benjamin Root  wrote:
>>
>>> Fernando,
>>>
>>> This information is going to be the preface of my book on using
>>> matplotlib for making an interactive application (sorry, no IPython, the
>>> editor wanted to keep the scope tight). So, what I am looking for are some
>>> of the major interactive features (who supplied them, and their
>>> reasons/purpose). Also, how has interactive matplotlib supported uses "in
>>> the wild" such as the Mars Phoenix Lander and recently, the ISEE3 reboot
>>> project (that abandoned satellite that was recently revived by citizen
>>> scientists).
>>>
>>> Of, course, any insights to John's original needs/use cases in the early
>>> years would be very valuable as well. I could have sworn he has written
>>> such missives on the mailing lists, but I can't seem to find them.
>>>
>>> Cheers!
>>> Ben Root
>>> On Jul 30, 2014 11:21 PM, "Fernando Perez"  wrote:
>>>
>>>> Hi Ben,
>>>>
>>>> if by interactive plotting you refer to using it interactively via
>>>> ipython and other such systems, there's a good part of that history that is
>>>> spread somewhere between the early mpl and ipython archives AND John's and
>>>> my personal inboxes.
>>>>
>>>> A good chunk of that (not all, mind you, since many others contributed)
>>>> happened with John and I working on it, and sadly he's not with us and I
>>>> had a loss of my early email (anything older than 2005) when I left the
>>>> University of Colorado.
>>>>
>>>> I'd be happy to answer some questions if you have them, to the best of
>>>> my memory. Probably quicker over skype/phone, ping me directly (at my
>>&

Re: [Matplotlib-users] Missing tests when trying to run unit tests with agg on linux

2014-08-07 Thread Benjamin Root
Just to note, the first log also has the font-manager issue as well. What I
see as odd here is that while it was configured to install the tests (and
presumedly the test data), it doesn't seem to have done that. At the very
least, the test data wasn't installed.

Ben


On Thu, Aug 7, 2014 at 12:15 PM, Russell Warren  wrote:

> Since my test script was using nose directly, I figured I would try the
> "proper" `tests.py` script in the repo, but there seems to be a font_manger
> issue.  An exception is thrown with:
>
> " matplotlib/ft2font.so: undefined symbol: inflateEnd"
>
> Full log here:
> http://bpaste.net/raw/MVuf4UlQ1g9xCecivwlQ/
>
>
>
> On Thu, Aug 7, 2014 at 12:00 PM, Russell Warren 
> wrote:
>
>> I'm trying to run the matplotlib unit tests on linux with the agg
>> backend, and am getting a tonne of errors.
>>
>> Here is my test method and output (method is the script created at the
>> top):
>> http://bpaste.net/raw/n0JVrWcXnlPVxaAlArHJ/
>>
>> It is not clear to me why the tests don't exist.  I have run this test
>> successfully several times on this platform over the last couple of years,
>> although I haven't tried it in (I'm guessing) a year or so.
>>
>> Searching around I found this in the mailing list:
>> http://goo.gl/9nDILp
>>
>> The testing output is similar (bottom of the mail), but perusing the rest
>> of the thread it does not seem to have a resolution, nor does it seem like
>> the same issue.
>>
>> For reference, matplotlib was installed with `pip install matplotlib`,
>> and the output log is here:
>> http://bpaste.net/raw/5tfTFJepFRAwGF5tSkyb/
>>
>> Does anybody know what is wrong, or have any tips on where/how I can dig
>> further?
>>
>> Thanks,
>> Russ
>>
>>
>
>
> --
> Russell Warren
> Perspexis Technologies Inc.
>
> This information is confidential and intended solely for the use of the
> individual or entity to whom it is addressed.
> If you have received this email in error, please notify the sender
> immediately.
>
>
> --
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pick_event after zooming/panning stops working.

2014-08-21 Thread Benjamin Root
Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
IIRC. This is entirely intentional, and I an not sure there is a bug here
to fix.


On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell  wrote:

> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman 
> wrote:
> >
> ># plot axvlines here... etc.
> >
> >global cids
> >
> ># remove any previous connections
> >for i in cids:
> >   gcf().canvas.mpl_disconnect(i)
> >cids = []
> >
> >cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
> >cids.append(gcf().canvas.mpl_connect('button_press_event',self.click))
> >
> >draw()
> >
> > def pick(self, event):
> >thisline = event.artist
> >xdata, ydata = thisline.get_data()
> >print xdata[0]
> >
> > def click(self, event):
> >print "clicked"
>
>
> See this minimal example
>
> ```
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()
>
> ax.axvline(.5, picker=6)
> ax.plot(range(3))
> cids = []
>
> plt.draw()
>
> def pick(event):
>thisline = event.artist
>xdata, ydata = thisline.get_data()
>print xdata[0]
>
> def click(event):
>print "clicked"
>
>
> cids.append(fig.canvas.mpl_connect('pick_event', pick))
> cids.append(fig.canvas.mpl_connect('button_press_event', click))
>
> ```
>
> If you turn the zoom/pan tool off the picker works again.  I suspect
> that there is some logic underneath those tools that are snarfing
> events when the are turned on to avoid messy conflicts.  There is some
> work going on (MEP22 iirc) to update the toolbar and make our tool
> handling saner.
>
> Tom
> --
> Thomas Caswell
> [email protected]
>
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pick_event after zooming/panning stops working.

2014-08-21 Thread Benjamin Root
Imagine someone creates some event that would modify an artist upon
picking, or do some expensive calculation, or some other action. But, I
seriously doubt anybody would want those actions to fire while using the
zoom/pan tool. Especially since the mouse cursor looks totally different. I
am curious why you would expect pick events to fire while using pan/zoom.
What is the user-story that compels that expectation? Perhaps I could be
convinced otherwise to offer some sort of toggle.



On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman  wrote:

> What kind of bad stuff happens if we were to allow that?
>
> M
>
>
> On 8/21/14 2:29 PM, Benjamin Root wrote:
>
>> Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
>> IIRC. This is entirely intentional, and I an not sure there is a bug
>> here to fix.
>>
>>
>> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell > <mailto:[email protected]>> wrote:
>>
>> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman > <mailto:[email protected]>> wrote:
>>  >
>>  ># plot axvlines here... etc.
>>  >
>>  >global cids
>>  >
>>  ># remove any previous connections
>>  >for i in cids:
>>  >   gcf().canvas.mpl_disconnect(i)
>>  >cids = []
>>  >
>>  >cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
>>  >
>> cids.append(gcf().canvas.mpl_connect('button_press_event',
>> self.click))
>>  >
>>  >draw()
>>  >
>>  > def pick(self, event):
>>  >thisline = event.artist
>>  >xdata, ydata = thisline.get_data()
>>  >print xdata[0]
>>  >
>>  > def click(self, event):
>>  >print "clicked"
>>
>>
>> See this minimal example
>>
>> ```
>> import matplotlib.pyplot as plt
>> fig, ax = plt.subplots()
>>
>> ax.axvline(.5, picker=6)
>> ax.plot(range(3))
>> cids = []
>>
>> plt.draw()
>>
>> def pick(event):
>> thisline = event.artist
>> xdata, ydata = thisline.get_data()
>> print xdata[0]
>>
>> def click(event):
>> print "clicked"
>>
>>
>> cids.append(fig.canvas.mpl_connect('pick_event', pick))
>> cids.append(fig.canvas.mpl_connect('button_press_event', click))
>>
>> ```
>>
>> If you turn the zoom/pan tool off the picker works again.  I suspect
>> that there is some logic underneath those tools that are snarfing
>> events when the are turned on to avoid messy conflicts.  There is some
>> work going on (MEP22 iirc) to update the toolbar and make our tool
>> handling saner.
>>
>> Tom
>> --
>> Thomas Caswell
>> [email protected] <mailto:[email protected]>
>>
>>
>> 
>> --
>> Slashdot TV.
>> Video for Nerds.  Stuff that matters.
>> http://tv.slashdot.org/
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> <mailto:[email protected]>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pick_event after zooming/panning stops working.

2014-08-21 Thread Benjamin Root
Pick events, by default, won't fire while the zoom/pan tool is active,
because there is no way to distinguish between a "pick" click, and a click
for performing a zoom/pan. So, the question is really, is it sensible to
keep the tools active after their action. I think it is, particularly when
considering the panning tool, as it may take multiple "pans" before I
finding what I want.

You can easily turn the various tools on and off via keyboard shortcuts:
http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts
Command Keyboard Shortcut(s)  Home/Reset *h* or *r* or *home* Back *c* or *left
arrow* or *backspace* Forward *v* or *right arrow* Pan/Zoom *p* Zoom-to-rect
*o* Save *ctrl* + *s* Toggle fullscreen *ctrl* + *f* Close plot *ctrl*
+ *w* Constrain
pan/zoom to x axis hold *x* when panning/zooming with mouse Constrain
pan/zoom to y axis hold *y* when panning/zooming with mouse Preserve aspect
ratio hold *CONTROL* when panning/zooming with mouse Toggle grid *g* when
mouse is over an axes Toggle x axis scale (log/linear) *L* or *k* when
mouse is over an axes Toggle y axis scale (log/linear) *l* when mouse is
over an axes
Does this solve the issue, or do we need something more configurable?

Cheers!
Ben Root



On Thu, Aug 21, 2014 at 3:02 PM, Joe Kington  wrote:

> I think the OP's desire is to have pick events fire after the zoom has
> been triggered.
>
> Currently, after you zoom (or pan), the zoom tool is still active until
> you click it again.  Pick events won't fire while the zoom tool is the
> selected tool, and you have to manually de-select it (i.e. click the zoom
> button again for pick events to work).
>
> The current behavior is the right default choice, i.m.o., but it's
> counter-intuitive when combined with pick events.
>
> When you're building a gui to interact with data (or, for example, when
> using mpldatacursor -- this is a question I get a lot), a common
> expectation is that after you zoom once, the zoom tool is no longer
> active.  Pick events should work again.
>
> Currently, you have to subclass (or monkey-patch) the toolbar to make this
> happen.  It's a bit of a pain.  (It's more complicated that just setting
> `fig.canvas.toolbar._active`.)  (If I'm wrong about that, please let me
> know!!!)
>
> It would be nice to have an easier way to "deactivate" the zoom/pan tool.
> I think the "new" toolbar might have that, but I haven't checked.
>
> Cheers,
> -Joe
>
>
> On Thu, Aug 21, 2014 at 1:41 PM, Benjamin Root  wrote:
>
>> Imagine someone creates some event that would modify an artist upon
>> picking, or do some expensive calculation, or some other action. But, I
>> seriously doubt anybody would want those actions to fire while using the
>> zoom/pan tool. Especially since the mouse cursor looks totally different. I
>> am curious why you would expect pick events to fire while using pan/zoom.
>> What is the user-story that compels that expectation? Perhaps I could be
>> convinced otherwise to offer some sort of toggle.
>>
>>
>>
>> On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman 
>> wrote:
>>
>>> What kind of bad stuff happens if we were to allow that?
>>>
>>> M
>>>
>>>
>>> On 8/21/14 2:29 PM, Benjamin Root wrote:
>>>
>>>> Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
>>>> IIRC. This is entirely intentional, and I an not sure there is a bug
>>>> here to fix.
>>>>
>>>>
>>>> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell >>> <mailto:[email protected]>> wrote:
>>>>
>>>> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <
>>>> [email protected]
>>>> <mailto:[email protected]>> wrote:
>>>>  >
>>>>  ># plot axvlines here... etc.
>>>>  >
>>>>  >global cids
>>>>  >
>>>>  ># remove any previous connections
>>>>  >for i in cids:
>>>>  >   gcf().canvas.mpl_disconnect(i)
>>>>  >cids = []
>>>>  >
>>>>  >cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
>>>>  >
>>>> cids.append(gcf().canvas.mpl_connect('button_press_event',
>>>> self.click))
>>>>  >
>>>>  >draw()
>>>>  >
>>>>  > def pick(self, event):
>>>>  >thisline = event.artist
>>>>  >  

Re: [Matplotlib-users] Preserving figure over closes and reopenings of the window

2014-08-25 Thread Benjamin Root
Maciej,

When you close a figure, just about everything gets destroyed (this is why
you should always savefig() prior to doing a show()). There is a mechanism
for "reloading" a plot using python pickles:
http://stackoverflow.com/questions/7290370/store-and-reload-matplotlib-pyplot-object

As for setting the aspect ratio to 'equal', there is a second optional
argument that indicates which thing should get adjusted to achieve an equal
aspect. By default, it is 'datalim', I think, which adjusts the limits of
the axes. I think if you set it to 'box', it will do what you want (you
might need 'box-forced' if you are sharing axes). Fiddle around with these
settings to get what you want.
http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_aspect

To have the axes extended on the whole figure area, there are multiple ways
to do that. In particular, you can set the margins for the figure:
http://matplotlib.org/api/pyplot_api.html?highlight=subplots_adjust#matplotlib.pyplot.subplots_adjust

All of this would work just fine with autoscale.

I hope that helps!
Ben Root



On Mon, Aug 25, 2014 at 7:00 AM, Maciej Kurnicki 
wrote:

> I'm using matplotlib for drawing lines, points and circles basically. I
> have 2 problems i can't solve by myself and it's hard to solve them not
> digging into source i think.
> First problem: I got an instance of figure class and i want to preserve
> it during closing and reopening the output window. I'm curious what is
> happening after clicking on close button on the main widow and is there
> any way to reopen previously saved figure, and if yes how to save that
> figure for future reopenings.
> Second problem: I want to achieve 3 things simultaneously,
> a) have the axes extended on the whole figure area
> b) unit distance on y axis has to be the same as unit distance on x axis
> c) all above has to work well with autoscale(), i want to have a lot of
> artists on the axes
> The best thing i have is setting aspect as equal and using autoscale,
> but it fix axes to be same lenght and i don't want axes to be same
> length i want the unit distance to be the same
>
> Thanks for any help,
> Maciek
>
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Preserving figure over closes and reopenings of the window

2014-08-25 Thread Benjamin Root
I am glad that solution worked for you. As for an alternative to pickling,
no there is no current mechanism to do what you want easily. It is by
design to start destroying everything upon close. We get enough complaints
about "memory" leaks as it is. What you are asking for is essentially
serialization, you just don't want it written to disk. The good news is
that you don't have to write to disk. The pickle module accepts a file-like
object, so you could dump to a cStringIO object, rewind that stream and
then reload that data from the cStringIO object.

Now, maybe some work could be done to improve things, but as it stands
right now, this is the only method I can think of to do what you want.
Maybe one of the other devs has a better idea.

I hope that helps!
Ben



On Mon, Aug 25, 2014 at 11:50 AM, Maciej Kurnicki 
wrote:

>  Ben,
>
> The adjusting and aspect solution works just perfect, thanks for your fast
> answer. Although i still want to ask for another solution for reloading a
> plot, because i don't like the idea of serialization and writing to disk.
> From what i've found even if i have a variables handling figure and axis
> when i quit the window some part of it probably form the window framework
> are deleted anyway. In this case i think i can redraw all the artists on
> the newly created figure somehow but is there a relatively simple way to
> just set up new window and attach the old figure there?
>
> Maciej
>
> W dniu 25.08.2014 o 16:00, Benjamin Root pisze:
>
>Maciej,
>
>  When you close a figure, just about everything gets destroyed (this is
> why you should always savefig() prior to doing a show()). There is a
> mechanism for "reloading" a plot using python pickles:
>
> http://stackoverflow.com/questions/7290370/store-and-reload-matplotlib-pyplot-object
>
>  As for setting the aspect ratio to 'equal', there is a second optional
> argument that indicates which thing should get adjusted to achieve an equal
> aspect. By default, it is 'datalim', I think, which adjusts the limits of
> the axes. I think if you set it to 'box', it will do what you want (you
> might need 'box-forced' if you are sharing axes). Fiddle around with these
> settings to get what you want.
> http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_aspect
>
>  To have the axes extended on the whole figure area, there are multiple
> ways to do that. In particular, you can set the margins for the figure:
>
> http://matplotlib.org/api/pyplot_api.html?highlight=subplots_adjust#matplotlib.pyplot.subplots_adjust
>
>  All of this would work just fine with autoscale.
>
>  I hope that helps!
>  Ben Root
>
>
>
> On Mon, Aug 25, 2014 at 7:00 AM, Maciej Kurnicki 
> wrote:
>
>> I'm using matplotlib for drawing lines, points and circles basically. I
>> have 2 problems i can't solve by myself and it's hard to solve them not
>> digging into source i think.
>> First problem: I got an instance of figure class and i want to preserve
>> it during closing and reopening the output window. I'm curious what is
>> happening after clicking on close button on the main widow and is there
>> any way to reopen previously saved figure, and if yes how to save that
>> figure for future reopenings.
>> Second problem: I want to achieve 3 things simultaneously,
>> a) have the axes extended on the whole figure area
>> b) unit distance on y axis has to be the same as unit distance on x axis
>> c) all above has to work well with autoscale(), i want to have a lot of
>> artists on the axes
>> The best thing i have is setting aspect as equal and using autoscale,
>> but it fix axes to be same lenght and i don't want axes to be same
>> length i want the unit distance to be the same
>>
>> Thanks for any help,
>> Maciek
>>
>>
>> --
>> Slashdot TV.
>> Video for Nerds.  Stuff that matters.
>> http://tv.slashdot.org/
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Region within contour --> 2D array

2014-08-28 Thread Benjamin Root
That stuff is done in the deep underbelly of matplotlib and isn't exposed
to the user. It is done as part of the rendering process in AGG or
whichever other backend is performing the render. I have done something
very similar to what you are asking for my job, and while I can't share the
code, I can point out that GDAL has a very fast polygon rasterizer. I can
also point you to this link:
http://stackoverflow.com/questions/2220749/rasterizing-a-gdal-layer

I will also say that there are some subtle errors in that code, but it
should get you to where you need to go.

Cheers!
Ben Root



On Thu, Aug 28, 2014 at 9:02 AM, Matthew Czesarski <
[email protected]> wrote:

> Hi Matplotlib Users!
>
>
>
> I have some 2-d arrays, which i am displaying  with implot, and deriving
> contours for with contour.  Easy -  I'm just pulling them out of
> collections[0].get_paths() .
>
> However what's not easy is that I would like to recover a 1-0 or
> True-False array of the array values (pixels) that fall within the
> contours. Some line crossing algorithm/floodfill could do it, but I guess
> that matplotlib's fill() or contourf() must do this under the hood anyway.
> I've looked into the output both functions, but I don't see anything
> obvious..
>
> Does anybody know if there's an a way to pull out a such an array from
> matplotlib?   Any pointers are appreciated!
>
> Cheers,
> Matt
>
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Region within contour --> 2D array

2014-08-28 Thread Benjamin Root
You are asking for the twinx() feature:
http://matplotlib.org/examples/api/two_scales.html


On Thu, Aug 28, 2014 at 9:24 AM, Shantha Kumara  wrote:

> Hi All,
>
> Thank you so much for your help, It really worked for me.
>
>
> I need one more favor,
>
>
> I have ploted the graph with 2 Y-axes
>
> Here is the code
>
>  lns1 = ax1.plot(x1, y1, 'r-o',label=LY1,markersize=4)
> ax1 = self.set_ylim(ax1,y1,label=LY1)
> lns2 = ax2.plot(x2, y2, 'b-o',label=LY2,markersize=4)
>
> I want to set the grid to the second y-axes in the same graph.
>
> Please help on the same.
>
> See here the difference
>
> (Embedded image moved to file: pic19302.gif)
>
>
>
> SHANTHA KUMARA REVANASIDDAPPA
> Python Developper
> Operations & Production Control, A1 Telekom
> IBM
> M   +43-6642196132
> @[email protected]
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] violin plot

2014-08-28 Thread Benjamin Root
No reason why it shouldn't. I would be more than happy to see that feature
added. I could perhaps be convinced that it is a "bug" that it is in the
boxplot function and not the violin function so that it could get out into
a 1.4.1 release sooner. ::wink::


On Thu, Aug 28, 2014 at 8:05 AM, Neal Becker  wrote:

> As others noted, seaborn does very nice violin plots.  I was hoping the
> mpl version would replace that.
>
>
> On Thu, Aug 28, 2014 at 8:04 AM, Thomas Caswell 
> wrote:
>
>> We also welcome PRs!  Adding that feature should be pretty straight
>> forward.
>>
>> Iirc it should be a matter of adding an extra key to the dictionary and a
>> conditional to draw the lines if those keys exist.
>>
>> Tom
>> On Aug 27, 2014 4:57 PM, "Arnaldo Russo"  wrote:
>>
>>> Hi Neal,
>>> I don't know if you need exclusively matplotlib tools to apply your
>>> violin plot, but seaborn package [1, 2] do this very well.
>>> I hope you enjoy it!
>>> Cheers,
>>> Arnaldo.
>>>
>>> [1]
>>> http://web.stanford.edu/~mwaskom/software/seaborn/examples/violinplots.html
>>> [2] https://github.com/mwaskom/seaborn
>>>
>>>
>>> ---
>>> *Arnaldo D'Amaral Pereira Granja Russo*
>>> Lab. de Estudos dos Oceanos e Clima
>>> Instituto de Oceanografia - FURG
>>>
>>>
>>>
>>>
>>> 2014-08-27 12:15 GMT-03:00 Neal Becker :
>>>
 I'm pleased to see violinplot added to mpl-1.4.  One question.  I might
 like to
 annotate with some statistic.  Like boxplot can show quantiles.  I
 might like to
 show either quantiles, or some other statistic (3 sigma) on my
 violinplot.
 After all, violinplot is advertised as an improved boxplot, but it
 seems to be
 missing this feature.

 --
 -- Those who don't understand recursion are doomed to repeat it



 --
 Slashdot TV.
 Video for Nerds.  Stuff that matters.
 http://tv.slashdot.org/
 ___
 Matplotlib-users mailing list
 [email protected]
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

>>>
>>>
>>>
>>> --
>>> Slashdot TV.
>>> Video for Nerds.  Stuff that matters.
>>> http://tv.slashdot.org/
>>> ___
>>> Matplotlib-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>
>
> --
> *Those who don't understand recursion are doomed to repeat it*
>
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Region within contour --> 2D array

2014-08-29 Thread Benjamin Root
slaps forehead...

Joe, you just won the "duh!" moment of the month award!

Cheers!
Ben Root



On Thu, Aug 28, 2014 at 10:18 PM, Joe Kington 
wrote:

> Why not just use boolean indexing?
>
> E.g. to find the region that falls between 5 and 10, do "(z >=5) & (z <=
> 10)":
>
> In [1]: import numpy as np
>
> In [2]: x, y = np.mgrid[-10:10, -10:10]
>
> In [3]: z = np.hypot(x, y)
>
> In [4]: result = (z >= 5) & (z <= 10)
>
> In [5]: result.astype(int)
> Out[5]:
> array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
>[0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
>[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
>[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
>[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
>[0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],
>[0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
>[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
>[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
>[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
>[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
>[0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],
>[0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
>[0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],
>[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
>[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
>[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
>[0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
>[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]])
>
> Cheers,
> -Joe
>
>
>
> On Thu, Aug 28, 2014 at 8:23 PM, Eric Firing  wrote:
>
>> On 2014/08/28, 3:02 AM, Matthew Czesarski wrote:
>> > Hi Matplotlib Users!
>> >
>> >
>> >
>> > I have some 2-d arrays, which i am displaying  with implot, and deriving
>> > contours for with contour.  Easy -  I'm just pulling them out of
>> > collections[0].get_paths() .
>> >
>> > However what's not easy is that I would like to recover a 1-0 or
>> > True-False array of the array values (pixels) that fall within the
>> > contours. Some line crossing algorithm/floodfill could do it, but I
>> > guess that matplotlib's fill() or contourf() must do this under the hood
>> > anyway. I've looked into the output both functions, but I don't see
>> > anything obvious..
>> >
>> > Does anybody know if there's an a way to pull out a such an array from
>> > matplotlib?   Any pointers are appreciated!
>>
>> Make an array of (x, y) pairs from the X and Y you use in your call to
>> contour, and then feed that array to the contains_points() method of
>> your contour Path.  This will give you the desired Boolean array for any
>> given Path; depending on what you want, you might need to combine arrays
>> for more than one Path.
>>
>> To get closed paths, I think you will want to use contourf, not contour.
>>
>> Eric
>>
>>
>>
>> >
>> > Cheers,
>> > Matt
>> >
>> >
>> >
>> --
>> > Slashdot TV.
>> > Video for Nerds.  Stuff that matters.
>> > http://tv.slashdot.org/
>> >
>> >
>> >
>> > ___
>> > Matplotlib-users mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>>
>>
>>
>> --
>> Slashdot TV.
>> Video for Nerds.  Stuff that matters.
>> http://tv.slashdot.org/
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


  1   2   3   4   5   6   7   8   9   10   >