Re: [Matplotlib-users] 3d performance question

2012-12-14 Thread Ethan Gutmann
Hi Neal, my understanding is that matplotlib does not use OpenGL (thus
the terrible performance you see). You might want to look into glumpy
for mplot3d OpenGL acceleration.

Ethan


On Dec 14, 2012, at 5:23 AM, Neal Becker  wrote:

> I'm using fedora (17) linux.  I notice on complicated 3d plot, interactive
> performance can get sluggish.  I'm using nouveau driver now, but wondering if
> installing nvidia driver will improve mpl 3d performance?  Does mpl use 
> opengl?
>
>
> --
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot_surface does not work

2012-12-11 Thread Ethan Gutmann
> This is because the default rstride and cstride arguments is 10, IIRC.  Since 
> your array is only 12x12, the surface plotting is barely plotting anything.  
> Try calling:
> 
> ax.plot_surface(x, y, a, rstride=1, cstride=1)


You know, this has tripped me up a few times too.  I don't use plot_surface 
often enough to always remember this, and it is not the first parameter I think 
to check when debugging a program.  Is there a reason the default rstride and 
cstride aren't 1 other than possible memory constraints for large arrays?  

I suppose changing the defaults might break programs that rely on this 
behavior, but if this API ever gets revamped, consider this a request to make 1 
be the default instead.  I would think that the default should be that the 
obvious command "just works" while plots that may require too much memory can 
be tweaked to work faster (I'm assuming that is the reason for the default of 
10). 

thanks
Ethan
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plot multiple lines

2012-11-15 Thread Ethan Gutmann
> 1. How to open excel file in python?

You can read excel files with the xlrd module : http://www.python-excel.org/ 
However, you may want to simply read your exported CSV files. 

> 2. I would like to plot multiple line joining the positions of each of the 
> events, it is possible to do this? Have any idea how to do it?

I'm not quite sure what you are aiming for with this.  You should be able to 
just plot a series of lines, as long as they have common start and end points 
they will appear joined, but the lines can have different attributes (e.g. 
color).  Or you can plot all the points as a single line with multiple segments 
(all segments having the same attributes).  

> The idea is to plot the trajectories on a particular region, for my case is 
> Mexico.
> --



--
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3d surfaces in basemap?

2012-10-27 Thread Ethan Gutmann
Hi Andreas, 
Someone else, please correct me if I'm wrong, but I think the only way to do 
this is to provide your own "facecolors" map.  Pick your preferred color map 
and apply it to dataset B, then now use mplot3d 
plot_surface(X,Y,Z_A,facecolors=B_colors). 

Assuming you are running inside pylab or have done similar imports, the 
following example should work

---
import mpl_toolkits.mplot3d.axes3d
x=arange(10)
y=arange(10)
x,y=meshgrid(x,y)

za=sin(np.deg2rad(x))+20*cos(np.deg2rad(y))
zb=x*25

colors=cm.jet(zb)

ax = gca(projection='3d')
surf = ax.plot_surface(x,y,za,rstride=1,cstride=1,facecolors=colors)
draw() #I'm not sure why the draw command is necessary… anyone?
---

Note, plot_surface will apply shading by default, you can turn it off and just 
use your supplied colors using the shade=False keyword arg

ethan




On Oct 27, 2012, at 2:09 AM, Andreas Hilboll wrote:

> Hi, maybe matplotlib is capable of doing this:
> 
> I have two gridded datasets, A and B, for say Europe. Now I want to plot
> a 3d surface with the z-values given by dataset A. The surface should be
> colored using a given color palette and the values from dataset B.
> 
> Any ideas on how to do this are greatly appreciated =)
> 
> Cheers, Andreas.
> 
> --
> WINDOWS 8 is here. 
> Millions of people.  Your app in 30 days.
> Visit The Windows 8 Center at Sourceforge for all your go to resources.
> http://windows8center.sourceforge.net/
> join-generation-app-and-make-money-coding-fast/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Format date tick labels

2012-10-12 Thread Ethan Gutmann
On Oct 12, 2012, at 4:15 PM, Mark Lawrence wrote:

> On 12/10/2012 20:38, Ethan Gutmann wrote:
>> 
>> I'm a little confused by this attitude.  I recognize that there are issues 
>> around dates, I've written a few date libraries myself to get around insane 
>> excel date issues (pop quiz for anyone at MS, was 1900 a leap year?) or just 
>> to simplify APIs for my own use.  But do neither of you think that 
>> nanoseconds are important to scientists?  I know of enough projects that 
>> work with pico (and a few with femto) seconds.  Even though I often work 
>> with climate data covering ~100s of years and used to work with geologic 
>> data covering ~billions of years, I may start working with raw laser data 
>> for distance measurements where nanoseconds can be a pretty big deal.  These 
>> data would be collected over a few years time, so a date utility that can 
>> handle that scale range would be useful.  I guess I'll be writing my own 
>> date/time library again and hacking together some way of plotting data in a 
>> meaningful way in matplotlib.
>> 
>> Don't get me wrong, matplotlib shouldn't have to reinvent the wheel here, 
>> but claiming that nobody could possibly care about 1e-12 seconds seems a 
>> little provincial.  My apologies if that is not how the above statements 
>> were intended.
>> 
>> regards,
>> Ethan
>> 
>> 
> 
> I actually said "What percentage of computer users wants a delta of 
> 1e-12?  I suspect that the vast majority of users couldn't care two 
> hoots about miniscule time deltas in a world where changing time zones 
> can cause chaos...".
> 
> How does this translate into "claiming that nobody could possibly care 
> about 1e-12 seconds seems a little provincial"?
> 
> -- 
> Cheers.
> 
> Mark Lawrence.

Like I said, my apologies if I mis-interpreted.  To me the statement "the vast 
majority of users couldn't care two hoots..." *implies* "since almost nobody 
needs this we won't worry about it", especially when it is in response to 
someone who felt this was an important feature: 
"A delta of 1e-9 is the *least* I'd expect. Maybe even 1e-12. ".  
My response was as much an issue with how I perceived the tone as anything else 
(obviously, tone doesn't cary well over email ;) )  

Don't get me wrong, I realize there are bigger fish to fry.  I just want add a 
vote that 1E-12 seconds (and less) can indeed be important to a significant 
number of people.  I suspect that many experimental physicists would be unable 
to use a time utility that can't handle those timescales.  Many of them will 
simply write there own utility, but then if they start running into any of the 
longer time scale issues e.g. leap years/seconds etc. they end up having to 
reinvent the wheel.  Others have also pointed out that databases[1], network 
packets and stock trading transactions[2] may care about nanoseconds.  

[1]http://code.activestate.com/lists/python-dev/117090/
[2]http://code.activestate.com/lists/python-dev/117091/

I'm glad to see that others are thinking about this and that future python 
versions may get down to nanosecond (or better?) resolution, though I haven't 
found the PEP for it yet.  Guido seems to have given his approval for more work 
on the matter at least : http://code.activestate.com/lists/python-dev/117147/  

PEP 418 mentioned before doesn't mention the date time class as far as I can 
tell.  http://www.python.org/dev/peps/pep-0418/ 

regards,
Ethan


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Format date tick labels

2012-10-12 Thread Ethan Gutmann

On Oct 11, 2012, at 2:58 PM, Benjamin Root wrote:
> 
> On Thu, Oct 11, 2012 at 4:53 PM, Mark Lawrence  
> wrote:
> On 11/10/2012 10:55, Damon McDougall wrote:
> 
> > Am I missing something here? Are seconds just floats internally? A
> > delta of 1e-6 is nothing (pardon the pun). A delta of 1e-9 is the
> > *least* I'd expect. Maybe even 1e-12. Perhaps the python interpreter
> > doesn't do any 
> > denormalising
> > when encountered with deltas very close to zero...
> >
> 
> What percentage of computer users wants a delta of 1e-12?  I suspect
> that the vast majority of users couldn't care two hoots about miniscule
> 
> 
> Preach on, my brother! Preach on!
> 
> [psst -- you are facing the choir...]


I'm a little confused by this attitude.  I recognize that there are issues 
around dates, I've written a few date libraries myself to get around insane 
excel date issues (pop quiz for anyone at MS, was 1900 a leap year?) or just to 
simplify APIs for my own use.  But do neither of you think that nanoseconds are 
important to scientists?  I know of enough projects that work with pico (and a 
few with femto) seconds.  Even though I often work with climate data covering 
~100s of years and used to work with geologic data covering ~billions of years, 
I may start working with raw laser data for distance measurements where 
nanoseconds can be a pretty big deal.  These data would be collected over a few 
years time, so a date utility that can handle that scale range would be useful. 
 I guess I'll be writing my own date/time library again and hacking together 
some way of plotting data in a meaningful way in matplotlib.  

Don't get me wrong, matplotlib shouldn't have to reinvent the wheel here, but 
claiming that nobody could possibly care about 1e-12 seconds seems a little 
provincial.  My apologies if that is not how the above statements were 
intended.  

regards,
Ethan--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] MemoryError with NetCDF

2012-09-07 Thread Ethan Gutmann

On Sep 7, 2012, at 11:04 AM, Eric Firing wrote:

> On 2012/09/07 4:00 AM, Benjamin Root wrote:
>> 
>> 
>> On Fri, Sep 7, 2012 at 9:49 AM, Shahar Shani-Kadmiel
>> mailto:kadm...@post.bgu.ac.il>> wrote:
>> 
>>On Sep 7, 2012, at 4:25 PM, Benjamin Root wrote:
>> 
>>> 
>>> 
>>>On Fri, Sep 7, 2012 at 8:44 AM, Shahar Shani-Kadmiel
>>>mailto:kadm...@post.bgu.ac.il>> wrote:
>>> 
> 


> Normalization has to handle all sorts of inputs--masked or not, all 
> sorts of numbers, scalar or array--and it is much easier to do this 
> efficiently if all these possibilities are reduced to a very few at the 
> start.  Specifically, it needs to supply a copy of the input (so that 
> normalization doesn't change the original) in a floating point masked 
> array, using float32 if possible for space efficiency.  It needs to keep 
> track of whether the input was a scalar, so that normalization can 
> return a scalar when given a scalar input.
> 
> Eric

Another option as I understand it is to pass in a 1D (greyscale) or 3d (color) 
array (where the 3rd dimension is RGB and optionally A) of type uint8(?). This 
array does not need to get normalized, it will be displayed as raw pixel 
values.  I don't remember if you also have to specifically tell it not to 
normalize the data. 

But the easier answer for your case would probably be imshow(data[::10,::10]) 
which will take every 10th element in x and y thus reducing the size by a 
factor of 100 (depending on the size of your data you could use ::2 or ::50, 
etc)

Ethan--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] scatter plot with constant x

2012-06-06 Thread Ethan Gutmann
On Jun 6, 2012, at 11:41 AM, Eric Firing wrote:

> Since we end up needing float64 anyway:
> 
> In [3]: %timeit l=np.empty(1,dtype=np.float64); l.fill(3)
> 10 loops, best of 3: 14.1 us per loop

nice, fill and empty seem to be responsible for about half the speed up each, 
good tools to know about. 
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] scatter plot with constant x

2012-06-06 Thread Ethan Gutmann

On Jun 6, 2012, at 10:49 AM, Michael Droettboom wrote:
> Interesting result.  Note, however, that matplotlib will eventually turn 
> all data arrays into float64 at rendering time, so any speed advantage 
> to using integers will be lost by the subsequent conversion, I suspect.

I don't think it does if you pass uint8 to imshow, but otherwise you might be 
right. 

ethan
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] scatter plot with constant x

2012-06-06 Thread Ethan Gutmann
> ...
> No, but you can do this:
> 
> plt.plot([3] * 4, [60, 80, 120, 180], ...)

This started from a simple enough question, but it got me thinking about what 
the fastest way to do this is (in case you have HUGE arrays, or many loops over 
them).  This may be old news to some of you, but I thought it was interesting: 

In ipython --pylab

In [1]: %timeit l=[3]*1
1 loops, best of 3: 53.3 us per loop

In [2]: %timeit l=np.zeros(1)+3
1 loops, best of 3: 26.9 us per loop

In [3]: %timeit l=np.ones(1)*3
1 loops, best of 3: 32.9 us per loop

In [4]: %timeit l=(np.zeros(1)+3).repeat(1)
1 loops, best of 3: 87.4 us per loop

In [5]: %timeit l=np.zeros(1);l[:]=3
1 loops, best of 3: 21.6 us per loop

In [6]: %timeit l=np.zeros(1,dtype=np.uint8);l[:]=3
10 loops, best of 3: 13.9 us per loop

Using int16, int32, float32 get progressively slower to the default float64 
case listed on line [5], changing the datatype in other methods doesn't result 
in nearly as large a speed up as it does in the last case. 

Ben's method is probably the most elegant for small arrays, but does any one 
else have a faster way to do this?  (I'm assuming no use of blitz, inline C, 
f2py, but if you think you can do it faster in one of those, show me the way).  

Sorry, maybe this is more appropriate on the numpy list. 

Ethan


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Focus in OSX

2012-04-11 Thread Ethan Gutmann
On Apr 11, 2012, at 2:19 PM, Chris Laumann wrote:

> I get the exact same behavior from both Enthought supplied python and Apple 
> supplied python. I haven't tried any other pythons, but it isn't limited to 
> the Apple one.
> 
> C


I've never seen quite what has been described, but I've had issues with the 
macosx backend not updating the plot window in realtime when working 
interactively. 

I've given up and just use the tkagg backend, no problems there on OSX for me. 
It might be something others should try.  When I was having trouble, I tried 
reinstalling python & matplotlib about 5 different ways including just using 
the builtin python plus the binary matplotlib installer, nothing worked with 
the osx backend, but I think tkagg always worked. 

Is there a benefit to the macosx backend over the tkagg one? 

Ethan

> 
> On Apr 11, 2012, at 1:58 PM, Elliot Saba wrote:
> 
>> I'm using homebrew python, which is built from source, and the latest 
>> matplotlib gotten from git://github.com/matplotlib/matplotlib.git.  (I 
>> rebuilt it ~2 minutes ago)
>> 
>> Perhaps there's some kind of environment difference?
>> -E
>> 
>> On Wed, Apr 11, 2012 at 5:12 AM, Zachary Pincus  
>> wrote:
>>> 1. Keyboard input always goes to the terminal. Shortcuts don't work in the 
>>> standard plot windows and my custom widgets no longer catch 
>>> key_press_events  (I'm not sure when this functionality broke exactly as I 
>>> haven't used those widgets much recently but it worked when I developed 'em 
>>> a year or two ago.)
>>> 
>>> 2. There's no icon in the cmd-tab task switcher corresponding to the figure 
>>> windows. Swapping to the terminal running ipython (or the qtconsole for 
>>> ipython qtconsole) does not raise the windows.
>>> 
>>> 3. Using mission control, the figures appear grouped as if they belong to 
>>> an application of their own. However, when you click on them to swap to 
>>> them and bring them forward from behind other windows, they raise and then 
>>> immediately disappear again. I think that mission control is raising the 
>>> specific window you select from the collection of figures, but then OSX is 
>>> somehow immediately re-raising the previously selected app, which hides the 
>>> figures again.
>> 
>> Hmm, I don't really see these issues, using a dev matplotlib, OS X 10.7.3, 
>> and a python.org python 2.7. Interesting. (This is with the 'MacOSX' 
>> backend, mind. Also note that on March 5 there was a patch to that backend 
>> to fix a few issues, so if your matplotlib checkout is before that, perhaps 
>> that's the problem?)
>> 
>> Anyhow, when I start python (or ipython), and then do "import 
>> matplotlib.pyplot as plt", nothing happens, but then "plt.figure()", for 
>> example, causes a new dock icon to appear -- a python rocket-ship thing -- 
>> that acts as an "app" that owns the figure windows. I can use this app to 
>> switch to / raise the windows from the dock or the cmd-tab switcher, and 
>> things work correctly via mission control as well.
>> 
>> The keyboard shortcuts are a bit flaky ('s' never seems to work, but I can 
>> e.g. toggle gridlines with 'g' or log-axes with 'l'), but the key-presses 
>> definitely don't go to the terminal.
>> 
>> I wonder what the difference is? Perhaps the apple-supplied python is a bit 
>> broken in this regard?
>> 
>> Zach
>> --
>> Better than sec? Nothing is better than sec when it comes to
>> monitoring Big Data applications. Try Boundary one-second
>> resolution app monitoring today. Free.
>> http://p.sf.net/sfu/Boundary-dev2dev
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
>> --
>> Better than sec? Nothing is better than sec when it comes to
>> monitoring Big Data applications. Try Boundary one-second 
>> resolution app monitoring today. Free.
>> http://p.sf.net/sfu/Boundary-dev2dev___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Fr

Re: [Matplotlib-users] How matplotlib got me a job

2012-02-07 Thread Ethan Gutmann
On Feb 7, 2012, at 1:42 AM, Friedrich Romstedt wrote:
> I'd like to thank John and Ben for this inspiring posts, which showed
> them from a side I've never seen so far.  Show your hands if you're
> thinking the same.  I hope I didn't bore you all :-)

Well said Friedrich, though I'm a relative newcomer to python/matplotlib, I've 
been on the peripheral of a lot of open source, and I've enjoyed this thread. 

Also, congrats Ben, both on finishing the PhD and on the job. If you ever find 
yourself in Boulder, CO (I'm at NCAR), let me know and I'll buy you a drink. 

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


Re: [Matplotlib-users] [matplotlib-users] How to plot y vs x with some missing points in y vector?

2012-01-27 Thread Ethan Gutmann
On Jan 27, 2012, at 9:11 AM, Fabien Lafont wrote:

> Ive tried:
> 
> for i in range(0,NbPts):
>if column1[i] == nan:
>column1[i].remove(nan)
>column2[i].remove(nan)
> 
> to remove these points but it doesn't work
> 

you are close, I think what you want is: 

# assuming column1 and 2 are numpy arrays
import numpy as np

for i in range(0,NbPts):
   if np.isnan(column1[i]):
   column1=np.remove(column1,i,0)
   column1=np.remove(column2,i,0)

> 
> 2012/1/27 Benjamin Root :
>> On Fri, Jan 27, 2012 at 9:52 AM, Fabien Lafont 
>> wrote:
>>> 
>>> Sorry, It's an awkward manipulation. I finish the mail
>>> 
>>> 2012/1/27 Fabien Lafont :
 I want to plot something like:
 
 
 X(time)Ypoints
 08
 1
 27
 36
 44
 5
 6
 77
 82
 9   10
>>> 
>>> In fact I've recorded some live datas and when I use genfromtxt() the
>>> blank parts are "translated" as 'nan' and I can't for example fit it
>>> with polynomials.
>>> 
>> 
>> If you plot the data, it should skip data points that are NaNs and you
>> should see a break in the line IIRC.  Is that not what you want?
>> 
>> Ben Root
>> 
> 
> --
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] using solid colours in surface plots

2012-01-09 Thread Ethan Gutmann
Along these lines, it looks to me like plot_surface is not shading when I would 
expect it to (maybe I just have the wrong expectations?)  

I would expect the following to create a surface with colors from the colormap 
but shading from a lightsource.   

surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, 
cmap=cm.jet,shade=True)

However, axes3d.py requires facecolors to be set in order to generate 
facecolors to shade...

mpl_toolkits/mplot3d/axes3d.py
line 1378-1380 mpl v1.1.0

# Shade the data
if shade and cmap is not None and fcolors is not None:
fcolors = self._shade_colors_lightsource(Z, cmap, lightsource)

should the if statement be: 
if shade and cmap is not None and fcolors is None:

I'm not sure if this will screw anything else up, but it makes a lot more sense 
to me as an API. Maybe there are other reasons to require facecolors to be set? 

Ethan

On Jan 9, 2012, at 10:28 AM, Zoltán Vörös wrote:

> 
> 
> On 01/09/2012 05:46 PM, Benjamin Root wrote:
>> When we said that GTK is not supported, (1) is not an official 
>> decision, I think, (2) we mean the pure GTK *backend*.  We fully 
>> support the GTKAgg backend, which is superior to the GTK backend in 
>> every way.  Please try v1.1.0 before continuing.  There were many 
>> important changes to mplot3d between v1.0.1 and v1.1.0.
> Indeed, that was the case. The surface plot works as advertised now. 
> Thanks for helping out with this! Once I have a viable code for 
> phonging, I will send it to you in a personal mail.
> Cheers,
> Zoltán
> 
> --
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual 
> desktops for less than the cost of PCs and save 60% on VDI infrastructure 
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib 3D: interpolated shading

2011-10-05 Thread Ethan Gutmann
Holger, for what it is worth, you can hack this fairly easily. Run the
code twice once with colors, once with shading. Take the output from
both as images, the convert both images to HSV, the recombine the HS
components from the color version with the V component of the shaded
version. I haven't done this in matplotlib, but it worked great for me
in IDL.



On Oct 5, 2011, at 1:23 PM, Holger Brandsmeier
 wrote:

> Ben,
>
> I would be very happy to have this functionality. I think this would
> also make the 3D plots in the examples that matplot provides look a
> good deal nicer.
>
> Let me know if you have any updates on this.
>
> -Holger
>
> On Mon, Oct 3, 2011 at 21:18, Benjamin Root  wrote:
>>
>>
>> On Fri, Sep 30, 2011 at 11:33 AM, Holger Brandsmeier
>>  wrote:
>>>
>>> Ben,
>>>
>>> On Fri, Sep 30, 2011 at 17:06, Benjamin Root  wrote:
 What values for rstride and cstride are you using?  By default,
 plot_surface() will sample every 10th point of the data array (for
 performance reasons).  Also, color interpoltion can be turned on by
 setting
 shade to True.
>>>
>>> I beleive I start to understand the underlying logic. If no color map
>>> is set and shading and antialiazing is set,  then indeed the surface
>>> is nicely and smoothly displayed. When I provide a color map, then I
>>> seem to be able to assign one color for the whole polygon. I also find
>>> something like that in the code.
>>>
>>> In my case I want the z-coordinate to determine the color. I want to
>>> use a colormap like jet and no transparency. If I don't use the
>>> colormap argument, then I get shading, however everything is blue with
>>> shading depending on a lightsource.I don't really need a lightsource,
>>> but I would like non-constant colors per polygon.
>>>
>>
>> Yes, you have the logic correct (and probably better explained than I could
>> have done).  This actually was an issue raised a couple of months ago in a
>> bit of a different context, but the solution wasn't entirely clear at that
>> point.  However, looking at the code again (remember, I didn't write it
>> originally, and it had next to no comments), I think I see a fairly simple
>> solution.  If I allow for the user to specify a light source of None, then I
>> could feed the data through a different function to "shade" the surface.  I
>> will look into doing that, but it won't make it into the v1.1.0 release
>> (slated for tomorrow).
>>
>> Cheers!
>> Ben Root
>>
>>
>
>
>
> --
> Holger Brandsmeier, SAM, ETH Zürich
> http://www.sam.math.ethz.ch/people/bholger
>
> --
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot arrows for wind direction (degrees)

2011-10-04 Thread Ethan Gutmann
Anon, 
I don't know the quiver routine, but u and v are usually vectors for the wind 
speed in the east-west and north south directions.  As such they should not be 
equal to lat and lon (*10), as you are doing, but rather should be windspeed * 
sin(direction)  and windspeed*cos(direction).  If you don't have windspeed or 
want them all to be the same size arrows, just substitute 1 for windspeed (or 
10 if you want longer arrows)

You shouldn't have to "set" north,south,east,west, etc.  generally North is 0, 
South is 180, etc, so that should all be assigned already.  

It also looks like you have an array size mis-match, can you print LAT.shape, 
LON.shape,TIME.shape,WDIR.shape it may be that your lat,lon variables also need 
to be subset to [-50]? 

hope this helps,
Ethan

On Oct 4, 2011, at 5:58 PM, questions anon wrote:

> Thanks for responding. I believe quiver is more appropriate because I am only 
> using wind direction (at this stage) and this results in arrows. 
> I have had a look at the demos and still do not understand how to plot my 
> degrees in arrows. How do I define which angle is north, south, west, east, 
> etc?
> Any suggestions? Thanks
> 
> from netCDF4 import Dataset
> import numpy as N
> import pylab as plt
> from numpy import ma as MA
> from mpl_toolkits.basemap import Basemap
> import os
> 
> ncfile=Dataset('E:/temp_winddir/IDZ00026_VIC_ADFD_Wind_Dir_SFC.nc', 'r+', 
> 'NETCDF4')
> WDIR=ncfile.variables['Wind_Dir_SFC'][-50]
> LAT=ncfile.variables['latitude'][:]
> LON=ncfile.variables['longitude'][:]
> TIME=ncfile.variables['time'][-50]
> ncfile.close()
> 
> map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
>   llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
> x,y=LON,LAT
> u=10*x
> v=10*y
> map.quiver(x,y,u, v, WDIR)
> plt.title('Wind Direction')
> plt.show()
> 
> 
> Traceback (most recent call last):
>   File "d:/plot_winddirection.py", line 22, in 
> map.quiver(x,y,u, v, WDIR)
>   File "C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 
> 3102, in quiver
> ret =  ax.quiver(x,y,u,v,*args,**kwargs)
>   File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 6320, in 
> quiver
> q = mquiver.Quiver(self, *args, **kw)
>   File "C:\Python27\lib\site-packages\matplotlib\quiver.py", line 395, in 
> __init__
> self.XY = np.hstack((X[:,np.newaxis], Y[:,np.newaxis]))
>   File "C:\Python27\lib\site-packages\numpy\core\shape_base.py", line 270, in 
> hstack
> return _nx.concatenate(map(atleast_1d,tup),1)
> ValueError: array dimensions must agree except for d_0
> 
> 
> 
> On Tue, Oct 4, 2011 at 12:54 PM, Eric Firing  wrote:
> On 10/03/2011 03:00 PM, Benjamin Root wrote:
> > On Mon, Oct 3, 2011 at 6:51 PM, questions anon  > > wrote:
> >
> > Hi All,
> > Is there a simple way to plot a directional arrow to represent a degree?
> > I have a netcdf file containing wind direction as degrees and I
> > would like to make a plot with all little arrows representing the
> > wind direction.
> > Below is the code I am using currently to plot wind direction but am
> > not sure where/how to add directional arrows.
> > Thanks
> >
> >
> > from netCDF4 import Dataset
> > import numpy as N
> > import pylab as plt
> > from numpy import ma as MA
> > from mpl_toolkits.basemap import Basemap
> > import os
> >
> > ncfile=Dataset('E:/WINDDIR/IDZ00026_VIC_ADFD_Wind_Dir_SFC.nc', 'r+',
> > 'NETCDF4')
> > WDIR=ncfile.variables['Wind_Dir_SFC'][-50]
> > LAT=ncfile.variables['latitude'][:]
> > LON=ncfile.variables['longitude'][:]
> > TIME=ncfile.variables['time'][-50]
> > fillvalue=ncfile.variables['Wind_Dir_SFC']._FillValue
> > WDIR=MA.masked_values(WDIR, fillvalue)
> > ncfile.close()
> >
> > map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
> >llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
> > x,y=map(*N.meshgrid(LON,LAT))
> > map.drawstates()
> > map.drawcoastlines()
> > plt.title('Wind Direction')
> > CS = map.contourf(x,y,WDIR,15, cmap=plt.cm.jet)
> > l,b,w,h =0.1,0.1,0.8,0.8
> > cax = plt.axes([l+w+0.025, b, 0.025, h])
> > plt.colorbar(CS,cax=cax,drawedges=True)
> > plt.savefig((os.path.join('E:/WINDDIR/', 'WDIRSFC.png')))
> > plt.show()
> >
> >
> > Would the barb() command do what you want?
> >
> > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.barbs
> > http://matplotlib.sourceforge.net/examples/pylab_examples/barb_demo.html
> >
> > They aren't arrows, but they are commonly used in meteorology to plot
> > windfields.
> >
> > Cheers,
> > Ben Root
> 
> There is also quiver, both in matplotlib and in basemap.  See the
> quiver_demo.py and barb_demo.py in the basemap examples directory.
> 
> Eric
> 
> >
> >
> >
> > --
> > All the data contin

Re: [Matplotlib-users] how to hide axes in a 3D plot

2011-09-07 Thread Ethan Gutmann
I see the same thing here (from within ipython -pylab), and moving the  
ax.set_axis_off() immediately after the add_subplot call doesn't  
change anything.  Interacting with the plot doesn't change anything  
either.


Ethan

On Sep 7, 2011, at 1:21 PM, Benjamin Root wrote:


On Wed, Sep 7, 2011 at 2:14 PM, Joe Kington  wrote:
This no longer seems to work with matplotlib 1.0.1.

As a quick example:

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

x,y,z,c = np.random.random((4,10))
ax.scatter(x, y, z, c=c)
ax.set_axis_off()

plt.show()

The attached .png shows the result on my system... Is this a bug, or  
am I doing something strange?


Thanks!
-Joe


Hmmm, try putting that call right after the add_subplot() call.  I  
don't have time to test it out right now, but I wonder if the axes  
are being drawn once prior to the call to set_axis_off().  I would  
also be interested to know if the axes disappear when you interact  
with it.


Ben Root

--
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new  
level of
agility. Learn what those decisions are and how to modernize your  
storage

and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Moving plot windows?

2011-09-06 Thread Ethan Gutmann

Hi, 
I'm trying to move plot windows programmatically, or at least control where
a new window opens.  At the moment, every new window opens 20px further
down/right from the previous new window, but can I tell it to open e.g. 0px
down and 100px right?  Or can I move it after it opens? I've dug around a
bit and gotten lost in fig.canvas.get_tk_widget(), am I looking in the wrong
place?  

At the moment I'm using the TkAgg backend with matplotlib 1.0.1 (python 2.6)
on Mac OS X.  

thanks,
Ethan

-- 
View this message in context: 
http://old.nabble.com/Moving-plot-windows--tp32411243p32411243.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Malware Security Report: Protecting Your Business, Customers, and the 
Bottom Line. Protect your business and customers by understanding the 
threat from malware and how it can impact your online business. 
http://www.accelacomm.com/jaw/sfnl/114/51427462/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users