[Matplotlib-users] sharex with different tick labels

2012-09-13 Thread Daniel Welling
Greetings, all.

I have an issue: I have several axes stacked in a column with a common time
vector on each x-axis.  Each plot is a contour, so overplotting is not an
option.  In a perfect world, I want the following:
1) The subplots are tightly spaced such that with ax.grid() activated, the
grid lines appear continuous.  This makes comparing simultaneous
characteristics between subplots very easy.
2) The subplots are linked via the sharex keyword so I can move them all
in unison.
3) Only the bottommost subplot has x tick labels; on other plots, the long
time-formatted labels stick out of the left and right of the plots.

Items 2 and 3 are contradictory: if I turn off tick labels (e.g.
ax.set_xticklabels('')) on one axes, the others turn off as well, including
the bottom axes.  That is bad.
Does anyone know of a good workaround for this?

Thanks for your help.

-dw
--
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


[Matplotlib-users] Selecting a color from a given color map.

2012-02-16 Thread Daniel Welling
Greetings.

I have a series of lines that I would like to plot on the same axis,
but I would like to set the color of each such that the range of
colors used progresses through a given color map (e.g. the default Jet
map.)  For example, if I have 7 lines, the first would use the first
most color from the Jet color map (blue.)  The next line would use the
color that is 1/7 the way up the map, e.g. green or so.  This would
continue until the last line was red.

How would I go about doing this (that is, loading a color map and
pulling a specific color from it that could be handed to plot as an
rgba tuple)?

Thanks!
-dw

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


[Matplotlib-users] Triangulations and Polar Plots

2011-11-14 Thread Daniel Welling
Greetings.

I recently found myself in the position of needing to plot polar,
irregularly spaced data.  I've done similar using regularly spaced values
with no problem.  However, I've found that when the points become greatly
scattered, the triangulation does not translate from rectangular to polar
very well.  Below, find a code example that shows this; though it is much
better than my real-world case that uses simulation results.
 Essentially, in the translation from regular to polar axes, many of the
triangles overlap others, many features of the plot are lost, and the plot
looks mangled in certain regions, esp. across the theta=0 boundary.  While
subtle here (but MUCH worse in the results I'm trying to visualize), some
of the triangles lie outside of the triangulated region.  It isn't merely
that the polar plot is suffering from poor data coverage; the triangulation
is not working properly in polar coordinates and the results are
quantitatively different than the rectangular plot.

The obvious work-around for this problem illustrates the issue more
clearly.  If we convert rad, theta back to x, y and do a rectangular plot,
the triangulation is much better (not only is there no issue around
theta=0, but there are no overlapping triangles), all of the details of the
non-polar version are maintained, and the plot looks great.  This is not
the best solution, as polar plots in Matplotlib are quite elegant.

Any help here would be appreciated.  It could be that triangulations are
just not suited for polar plots; it could be that the theta=0 issue throws
things off, etc; I'm just not sure.  It would be perfect if I could use the
polar axes in the end.

Thanks.
-dw

#!/usr/bin/env python
'''
Demonstrate troubles with polar plots and triangulations.
'''
import numpy as np
import matplotlib.pyplot as plt

# Regular grid:
angle=np.linspace(0, 2*np.pi, 20)
x=np.tile(angle,20)
y=np.repeat(angle,20)
z=np.cos(x)*np.sin(y)

# Irregular grid:
x_ir=2*np.pi*np.random.random(400)
y_ir=2*np.pi*np.random.random(400)
z_ir=np.cos(x_ir)*np.sin(y_ir)

f=plt.figure()
a1=f.add_subplot(221)
a1.tricontourf(x,y,z); a1.plot(x,y, 'k+')
a2=f.add_subplot(222, polar=True)
a2.tricontourf(x,y,z); a2.plot(x,y, 'k+')
a2.triplot(x,y)

a3=f.add_subplot(223)
a3.tricontourf(x_ir,y_ir,z_ir); a3.plot(x_ir,y_ir, 'k+')
a4=f.add_subplot(224, polar=True)
a4.tricontourf(x_ir,y_ir,z_ir); a4.plot(x_ir,y_ir, 'k+')
a4.triplot(x_ir,y_ir)

# Fix back to rectangular.
x=y_ir*np.cos(x_ir)
y=y_ir*np.sin(x_ir)
f=plt.figure(); ax=f.add_subplot(111)
ax.tricontourf(x,y,z_ir)
ax.triplot(x,y)
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Updating/drawing all axes.

2011-11-13 Thread Daniel Welling
Sorry for the very slow reponse time; it's a busy time of the year.
 Anyway, I've narrowed the problem quite a bit.
Here is the kind of situation that causes the issue:

import matplotlib.pyplot as plt
plt.ion()

f1=plt.figure()
a1=f1.add_subplot(111)

f2=plt.figure()
a2=f2.add_subplot(111)

a1.plot([0,1])
a2.plot([0,1])

plt.draw()

Here, f2 is drawn but f1 only draws the axis object without the line; you
must do something else to trigger f1 to draw (e.g. use one of the gui
features or make it the current axis, then draw.)  The key to recreating
this issue is to make the plots in parallel, that is, make one fig, make
another, make one ax, make the other, plot one line, plot the other, etc.

This will narrow it down further: I can only recreate this issue on my OS X
system; my Ubuntu box does not have this issue.  Here's as much info as I
can drum up now; let me know what else would be helpful.

OS X 10.6.8, Python 2.6.7 (r267:88850, Oct 17 2011, 15:53:34); IPython
0.10.1 (all installed through MacPorts.)  MPL 1.1.0 obtained from the MPL
website and installed manually (e.g. not through macports); TkAgg backend.
 Because it's a macports install, it should be a mac Framework install of
python.

Again, this problem did not manifest until MPL 1.1.0.
Thanks for your help.
-dw

On Sun, Oct 30, 2011 at 10:06 AM, John Hunter jdh2...@gmail.com wrote:

 .draw()

 On Sun, Oct 30, 2011 at 10:51 AM, Daniel Welling dantwell...@gmail.com
 wrote:
  Greetings, MatPlotLibbers.
 
  Since 1.1, pyplot.draw() in interactive mode only updates the current
 axis.
   If I want to update many axes, I need to use sca() and draw() for each
 one.
   Is there a way to update all axes?

 I'm not seeing this, and I'm not sure *why* it would be occurring for
 you.  plt.draw triggers a call to fig.canvas.draw which calls draw on
 all axes.  Here is some example code in ipython, which has 'ion.

  In [2]: fig, axes = plt.subplots(2)

  In [3]: axes[0].plot([1,2,3])
  Out[3]: [matplotlib.lines.Line2D at 0x4b90550]

  In [4]: axes[1].plot([1,2,3])
  Out[4]: [matplotlib.lines.Line2D at 0x4b90610]

  In [5]: plt.draw()


 The call to 'plt.draw' on line 5 triggers a draw to both axes.  Can
 you provide an example which exposes your problem?  Please also
 provide backend and OS information

  In [6]: !uname -a
  Linux pinchiepie 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25
 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

  In [7]: import matplotlib; print matplotlib.__version__
  1.2.x

  In [8]: matplotlib.rcParams['backend']
  Out[8]: 'WXAgg'


 JDH

--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Triangulation objects

2011-11-13 Thread Daniel Welling
Greetings.

I am interested in accessing Triangulation objections that are created by
MPL for tricontour-type plots.  The docs for MPL routines that use
triangulation objects refer to documentation, but none exists in the MPL
online docs.  Does anyone have docs/info on using these objects?  Having
access to them would be great.

-dw
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Updating/drawing all axes.

2011-10-30 Thread Daniel Welling
Greetings, MatPlotLibbers.

Since 1.1, pyplot.draw() in interactive mode only updates the current axis.
 If I want to update many axes, I need to use sca() and draw() for each
one.  Is there a way to update all axes?

Thanks.
-dw
--
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World#153; now supports Android#153; Apps 
for the BlackBerryreg; PlayBook#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Increase max polygons/patches

2011-04-21 Thread Daniel Welling
Greetings, MPL Users.

I have a very detailed array that I am visualizing using pcolor mesh.  When
the size of the array surpasses some threshold (I don't know the value),
pcolormesh stops drawing polygons/patches.  Thus, I only see some percentage
of my array.  Is there a way to increase the number of polygons/patches MPL
will draw to screen?

Thanks.
-dw
--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Increase max polygons/patches

2011-04-21 Thread Daniel Welling
While trying to recreate this outside of my work code, I found that I cannot
do it in a simple manner- that is, just creating a ton of points and
plotting them doesn't reproduce the problem.  I'm going to revisit this and
make sure it isn't a problem in my working program versus what I thought it
was, e.g. some sort of drawing limitation.

FYI, I get this using the Qt4Agg backend and am using MPL 1.0.1

-dw
--
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Qt4 on OSX

2011-03-24 Thread Daniel Welling
Thanks for your help, Michiel.  Two follow up points, one concerning the OSX
backend and one concerning the QT4 backend:
1) A colleague can reproduce the OSX problem we have talked about, but has
never run into it before.  We have identical installs of
python/matplotlib/etc through MacPorts, however his OSX plots pop up
automatically without turning interactive plotting on (pyplot.ion()).  I did
not have this behavior; show() was required to bring up a plot up until
ion() was called.  A fresh install (see item 2) has fixed this behavior on
my machine so that our two installs now behave identically.
2) With an understanding of the importance of a +framework install when
using Python/MPL, I wiped my QT4 and pyqt4 installs (again, through
MacPorts) and reinstalled.  I also reinstalled MPL.  Because I have been
using all of them for some time, I had many old versions installed but not
activated in MacPorts.  I removed every old version for all of the programs
listed above and started from scratch.  I used the +framework variant (also,
+quartz).  Everything seems to work smoothly now.  I'm not sure why; was it
the fresh install?  was it the +framework variant?  This fresh install also
seemed to change the MacOSX backend behavior, however I have done nothing
different with how I installed MPL.

Hopefully, this info is useful to someone down the line.  Thanks again to
Michiel for his clarifications and help with the OSX backend; it is one of
the better backends if you are on a Mac!

-dw


On Wed, Mar 23, 2011 at 2:34 PM, Michiel de Hoon mjldeh...@yahoo.comwrote:

 OK, thanks. I got the same behavior using Python (instead of ipython).
 Non-interactive usage has not yet been implemented in the MacOSX backend.
 We should be able to fix the bug that you found when implementing
 interactive/non-interactive usage for the MacOSX backend.

 Thanks,
 --Michiel.

 --- On *Wed, 3/23/11, Daniel Welling dantwell...@gmail.com* wrote:


 From: Daniel Welling dantwell...@gmail.com
 Subject: Re: [Matplotlib-users] Qt4 on OSX
 To: Michiel de Hoon mjldeh...@yahoo.com
 Cc: matplotlib-users@lists.sourceforge.net
 Date: Wednesday, March 23, 2011, 12:27 PM


 Greetings again, Michiel.  Please excuse my slow response time...

 First, thanks for explaining the Framework stuff; it clarifies situation.
  I'll be sure to never blame the OSX backend where it is not warranted!

 Unfortunately (in terms of easy explanations):
 In [3]: MacOS.WMAvailable()
 Out[3]: True

 crap.

 Fortunately, I've been able to nail down the problem:
 bash-3.2$ ipython
 Python 2.6.6 (r266:84292, Jan 18 2011, 14:07:55)
 Type copyright, credits or license for more information.

 IPython 0.10.1 -- An enhanced Interactive Python.
 ? - Introduction and overview of IPython's features.
 %quickref - Quick reference.
 help  - Python's own help system.
 object?   - Details about 'object'. ?object also works, ?? prints more.

 In [2]: import matplotlib.pyplot as plt
 In [3]: plt.plot([0,1])
 Out[3]: [matplotlib.lines.Line2D object at 0x118c6be90]
 In [4]: plt.show()
 (Here, saving the plot works like normal.)
 In [5]: plt.ion()
 In [6]: plt.plot([0,1])
 Out[6]: [matplotlib.lines.Line2D object at 0x118c8bc90]
 (Now, when trying to save the plot, the save and cancel buttons no
 longer respond.  I must kill python from another terminal.)

 So that's the situation with OSX.  It's something that comes up frequently
 enough (typically a quick plot turns into a more thorough customization
 followed by the lockup) that TK becomes a more viable option for me though
 OSX is faster and has better file navigation features.  Again, if QT4 was
 working, that is certainly my weapon of choice...


 On Mon, Mar 21, 2011 at 7:14 AM, Michiel de Hoon 
 mjldeh...@yahoo.comhttp://mc/compose?to=mjldeh...@yahoo.com
  wrote:

 --- On *Sun, 3/20/11, Daniel Welling 
 dantwell...@gmail.comhttp://mc/compose?to=dantwell...@gmail.com
 * wrote:
  The OSX backend used to have a bug where you cannot type a
  name in the file name text box.Since that has been fixed, ...
 That was not a bug in the MacOSX backend (and therefore was not fixed), but
 is related to how Python is installed on your system: If your Python is not
 a framework installation, it will not interact correctly with Apple's
 windowing manager. This is due to OS X itself and is independent of the
 MacOSX backend.

 I have found a new bug: every so often, when you go to save a file, the
 save and cancel button stop responding, trapping the user in file saving
 limbo.  I'll have to play with it again to figure out what triggers this.

 Can you check if your Python is built as a framework? If it is,
 MacOS.WMAvailable() should return True:

 $ python
 Python 2.7.1 (r271:86832, Mar 12 2011, 13:44:53)
 [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
 Type help, copyright, credits or license for more information.
  import MacOS
  MacOS.WMAvailable()
 True
 


 Best,
 --Michiel

Re: [Matplotlib-users] Qt4 on OSX

2011-03-23 Thread Daniel Welling
Greetings again, Michiel.  Please excuse my slow response time...

First, thanks for explaining the Framework stuff; it clarifies situation.
 I'll be sure to never blame the OSX backend where it is not warranted!

Unfortunately (in terms of easy explanations):
In [3]: MacOS.WMAvailable()
Out[3]: True

crap.

Fortunately, I've been able to nail down the problem:
bash-3.2$ ipython
Python 2.6.6 (r266:84292, Jan 18 2011, 14:07:55)
Type copyright, credits or license for more information.

IPython 0.10.1 -- An enhanced Interactive Python.
? - Introduction and overview of IPython's features.
%quickref - Quick reference.
help  - Python's own help system.
object?   - Details about 'object'. ?object also works, ?? prints more.

In [2]: import matplotlib.pyplot as plt
In [3]: plt.plot([0,1])
Out[3]: [matplotlib.lines.Line2D object at 0x118c6be90]
In [4]: plt.show()
(Here, saving the plot works like normal.)
In [5]: plt.ion()
In [6]: plt.plot([0,1])
Out[6]: [matplotlib.lines.Line2D object at 0x118c8bc90]
(Now, when trying to save the plot, the save and cancel buttons no
longer respond.  I must kill python from another terminal.)

So that's the situation with OSX.  It's something that comes up frequently
enough (typically a quick plot turns into a more thorough customization
followed by the lockup) that TK becomes a more viable option for me though
OSX is faster and has better file navigation features.  Again, if QT4 was
working, that is certainly my weapon of choice...


On Mon, Mar 21, 2011 at 7:14 AM, Michiel de Hoon mjldeh...@yahoo.comwrote:

 --- On *Sun, 3/20/11, Daniel Welling dantwell...@gmail.com* wrote:
  The OSX backend used to have a bug where you cannot type a
  name in the file name text box.Since that has been fixed, ...
 That was not a bug in the MacOSX backend (and therefore was not fixed), but
 is related to how Python is installed on your system: If your Python is not
 a framework installation, it will not interact correctly with Apple's
 windowing manager. This is due to OS X itself and is independent of the
 MacOSX backend.

 I have found a new bug: every so often, when you go to save a file, the
 save and cancel button stop responding, trapping the user in file saving
 limbo.  I'll have to play with it again to figure out what triggers this.

 Can you check if your Python is built as a framework? If it is,
 MacOS.WMAvailable() should return True:

 $ python
 Python 2.7.1 (r271:86832, Mar 12 2011, 13:44:53)
 [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
 Type help, copyright, credits or license for more information.
  import MacOS
  MacOS.WMAvailable()
 True
 


 Best,
 --Michiel.



--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Qt4 on OSX

2011-03-20 Thread Daniel Welling
Hello, Michiel.

The OSX backend used to have a bug where you cannot type a name in the file
name text box.  Since that has been fixed, I have found a new bug: every so
often, when you go to save a file, the save and cancel button stop
responding, trapping the user in file saving limbo.  I'll have to play with
it again to figure out what triggers this.  Other than that, the OSX backend
is light and quick, which is nice.  When QT4 is working, however, I prefer
that.  Sorry I can't give you more details; I'll see if I can get a clearer
picture.

-dw

On Sun, Mar 20, 2011 at 1:31 AM, Michiel de Hoon mjldeh...@yahoo.comwrote:

 --- On *Wed, 3/16/11, Daniel Welling dantwell...@gmail.com* wrote:

 After playing with backends quite a bit, I have found that the best one in
 terms of speed, robustness, and features is Qt4Agg - especially on OSX,
 where the MacOSX backend is buggy and many others just don't plain work.

 Why do you think that the MacOSX backend is buggy?

 --Michiel.






--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Qt4 on OSX

2011-03-16 Thread Daniel Welling
Greetings, MPL'ers.

After playing with backends quite a bit, I have found that the best one in
terms of speed, robustness, and features is Qt4Agg - especially on OSX,
where the MacOSX backend is buggy and many others just don't plain work.

To my great disappointment, I have found that this backend doesn't work on
some machines anymore.  As soon as a plot is created, ipython stops
responding, python CPU usage goes to 100%+, and I have to kill ipython or
shut the terminal.  I am not the only person to experience this; a co-worker
has the same problem.  It didn't use to be like this; it has started
happening after an update a few months ago (I'm not sure what update, I use
macports so I update in batches.)

To complicate matters, on a mac laptop (which is updated on a similar
schedule as my desktop machine), I do not have this problem.  Everything
works flawlessly.

Has anyone else had this problem, and does anyone know of a solution?
Thanks for your help.

Details:
All software through MacPorts.
OSX 10.6.5
Ipython 0.10.1
python 2.6.6
MPL 1.0.1_2
pyqt4 4.8.3_1
Qt4-mac 4.7.1_1/4.7.2_0
--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Two sets of ticks on a single colorbar?

2010-11-15 Thread Daniel Welling
Greetings.

I am making some contour plots and in my field for this particular value,
there are two widely used units.  As such, it is very useful to have both
units listed on the colorbar.  To clarify: the colorbar's normal ticks would
be facing to the right and labeled with Unit Type 1, which was the units
that the data were in when they were plotted.  Unit Type 2 is simply a
factor of X different than unit type two.  It would be nice if I could add a
second set of ticks to the color bar using a different locator and have them
face left.  Is this possible? Is there another way to display two values for
each tick such that the colorbar shows both units?

Thanks.
-dw
--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Two sets of ticks on a colorbar?

2010-11-12 Thread Daniel Welling
Greetings.

I am making some contour plots and in my field for this particular value,
there are two widely used units.  As such, it is very useful to have both
units listed on the colorbar.  To clarify: the colorbar's normal ticks would
be facing to the right and labeled with Unit Type 1, which was the units
that the data were in when they were plotted.  Unit Type 2 is simply a
factor of X different than unit type two.  It would be nice if I could add a
second set of ticks to the color bar using a different locator and have them
face left.  Is this possible? Is there another way to display two values for
each tick such that the colorbar shows both units?

Thanks.
-dw
--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Axes3D and tricontours.

2010-07-19 Thread Daniel Welling
Greetings, MPL Users.

I have been experimenting with Axes3D with the hopes that I could create
some 3d lines and then project some contours on different planes in the 3D
axes object, much like the contour3d_demo3.py example (but with lines
instead of the 3d wireframe.)  The catch, however, is creating the contour
objects using tricontour instead of a regular contour.  Being that I
typically use irregular grids for my research, the triangulate module has
been a tremendous feature, but it doesn't seem to work with Axes3D objects.

For example, this quick script:
import matplotlib.pyplot as plt
#import matplotlib.tri as tri
import numpy as np
from numpy.random import uniform, seed
from mpl_toolkits.mplot3d import Axes3D

seed(0)
npts = 200
ngridx = 100
ngridy = 200
x = uniform(-2,2,npts)
y = uniform(-2,2,npts)
z = x*np.exp(-x**2-y**2)

# tricontour.
fig = plt.figure()
ax = Axes3D(fig)
ax.tricontour(x, y, z, 15, zdir=x, offset=-2)

plt.show()

creates a huge traceback, listed below.
Is it possible to combine tricontour with Axes3D?  It would appear that they
are just incompatible, but perhaps there is a way to force it to work?
Thanks for your help.

tricont3d.py in module()
 20 ax.tricontour(x, y, z, 15, zdir=x, offset=-2)
 21
--- 22 plt.show()
 23
 24

python2.6/site-packages/matplotlib/backends/backend_qt4.pyc in show()
 69 figManager =  Gcf.get_active()
 70 if figManager != None:
--- 71 figManager.canvas.draw()
 72
 73 if _create_qApp.qAppCreatedHere:

python2.6/site-packages/matplotlib/backends/backend_qt4agg.pyc in draw(self)
128 if DEBUG: print FigureCanvasQtAgg.draw, self
129 self.replot = True
-- 130 FigureCanvasAgg.draw(self)
131 self.update()
132
site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
392
393 self.renderer = self.get_renderer()
-- 394 self.figure.draw(self.renderer)
395
396 def get_renderer(self):

python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist,
renderer, *args, **kwargs)
 53 def draw_wrapper(artist, renderer, *args, **kwargs):
 54 before(artist, renderer)
--- 55 draw(artist, renderer, *args, **kwargs)
 56 after(artist, renderer)
 57

python2.6/site-packages/matplotlib/figure.pyc in draw(self, renderer)
796 dsu.sort(key=itemgetter(0))
797 for zorder, func, args in dsu:
-- 798 func(*args)
799
800 renderer.close_group('figure')

python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in draw(self,
renderer)
152 # Calculate projection of collections and zorder them

153 zlist = [(col.do_3d_projection(renderer), col) \
-- 154  for col in self.collections]
155 zlist.sort()
156 zlist.reverse()

AttributeError: 'LineCollection' object has no attribute 'do_3d_projection'
WARNING: Failure executing file: tricont3d.py
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] pcolorfast and log axes.

2010-07-14 Thread Daniel Welling
Greetings.

I've recently found that when I replace pcolor with pcolorfast, the image
will not scale correctly when placed on an axis with a logarithmic scale.
 It will remain linear, thus not matching the axis range whatsoever.  The
pcolor plot will still fit nicely in the axis object, but the ticks and
labels clearly do not match the data.  I've tried several things, from
changing the axis from linear to log before and after using pcolorfast, etc,
but pcolorfast artist objects do not seem to respond to this.  Again, pcolor
acts as one would expect.

Complicating this is that I have made two changes at once: upgrading from
MPL 99 to 1.0 and switching from pcolor to pcolorfast.  As such, I do not
know if this a new or old issue (or if it is an issue at- perhaps this
behavior is on purpose.)

If anyone could shed some light on this, that would be great.  Pcolorfast is
preferable over pcolor because of the complexity of my plots and the speed
up gained by using pcolorfast.

Thanks!
-dw
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Mac backend problems for nearly all backends.

2010-05-26 Thread Daniel Welling
A quick update on Mac backends:
1) Two others in my office use macports, python 2.6, mpl 99.1, and
snowleopard.  They have none of the issues I have with the GUI stuff.  Most
notably, their MacOSX backends work properly in both X11 and native Mac
terminal.
2) I cannot follow up on WxPython or Qt4 for my PPC machine; installs failed
for both.  I'm working on it some more but have limited time to play around.
3) A recompile of python through fink using updated gcc/g++ (from 4.0 to
4.2) had no effect.

While I don't want to drag this thread on forever, I feel like some of this
info is useful for the Mac/MPL community.  I would love to hear from anyone
else who has the OSX backend problem; it seems to be isolated to Fink.

It seems like the bottom line is that depending on your install, some
experimentation is required to determine which GUI backends work well or at
all.

On Tue, May 25, 2010 at 10:51 PM, Daniel Welling dantwell...@gmail.comwrote:

 2) In which case, it's not a framework install.  Fink puts everything into
 /sw/; there's nothing to do with pyton in /Library/Frameworks.
 Thanks for the clarification; I'm tempted to get Python from source and try
 this...

 -dw

 On Tue, May 25, 2010 at 10:41 PM, Michiel de Hoon mjldeh...@yahoo.comwrote:


  1)The problem does manifest in the same manner through the normal python
 prompt.

 OK that is good to know.


  2) I'm not sure what is meant by a framework install.  Everything
 (except MPL 99.1.1)
  was installed through fink.

 This is important. Check where python is installed. If 'which python'
 shows /Library/Frameworks/Python.framework/Versions/2.6/bin/python or
 something similar, you have a framework version. If on the other hand it
 shows /usr/bin/python, /usr/local/bin/python, or something similar, you
 don't have a framework version. I don't know what fink installs by default.
 If you don't have Python installed as a framework, some backends (including
 the MacOSX backend) will not interact properly with the window manager. This
 is a Mac peculiarity. If you build Python from source, you can specify to
 install a framework version by passing the --enable-framework option to the
 configure script.


  6) Although I use x11 and not the native Mac terminal, I'm not sure if
 this requires me to  install different packages for the gui stuff.  Could
 you guys expand on this, please?

 Some backends go make use of X11 (e.g., the gtkcairo backend), others do
 not (e.g., the MacOSX backend). The MacOSX backend should work with both the
 native Mac terminal and with an X11 terminal.

 --Michiel.



--

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


Re: [Matplotlib-users] Mac backend problems for nearly all backends.

2010-05-25 Thread Daniel Welling
$%$^#!!!  My sincere apologies, gmail sent before I was ready.  To
continue:
GtkCairo: looks great, crashes ipython on resize.

Wx: color issues, not stable.
Qt: installs from fink, but won't load.

In any case, it's not the Gtk/Qt/Wx problems that are important, it's the
OSX backend issue.  Others whom I work with do not have this issue, but
installed using EPD.
Has anyone else experienced such problems?

Thanks for your help; let me know if there's more info I can provide.

-dw

On Tue, May 25, 2010 at 12:47 PM, Daniel Welling dantwell...@gmail.comwrote:

 Greetings.

 I did quite a bit of digging on this and cannot find similar problems, but
 if I did miss an earlier discussion, then I apologize.

 In any case, I have been having royal problems with GUI backends and
 matplotlib.
 Some background on where I've been having these problems:
 Machine 1: OSX 10.5.8 G5 PPC
 Machine 2: OSX 10.5.7 Macbook pro/Intel
 Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through
 fink.)
 MPL versions: 99.0.1 and 99.1.1 (Older obtained through fink, newer
 installed from source.)

 Here are the issues; behavior is consistent on both machines:

 MacOSX backend: Loads plots quickly, but when I try to save, I cannot type
 in the file name area of the save file dialog.  Furthermore, with ipython, I
 can continue to use the ipython prompt up until the I shut the plot window.
 ipython then freezes until I control-c it.  This occurs in both versions.

 TkAgg backend: In 99.0.1, this works fine.  However, it is slow, hence my
 want for a different working backend.  in 99.1.1, the plot window opens but
 the picture is never drawn.  After a moment, segfault back to the x11
 prompt.  Blerg.

 GtkAgg: Bad color (e.g. the background is pink rather than gray, color
 tables are way goofed up.  Writes to file fine.)


--

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


[Matplotlib-users] Mac backend problems for nearly all backends.

2010-05-25 Thread Daniel Welling
Greetings.

I did quite a bit of digging on this and cannot find similar problems, but
if I did miss an earlier discussion, then I apologize.

In any case, I have been having royal problems with GUI backends and
matplotlib.
Some background on where I've been having these problems:
Machine 1: OSX 10.5.8 G5 PPC
Machine 2: OSX 10.5.7 Macbook pro/Intel
Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through
fink.)
MPL versions: 99.0.1 and 99.1.1 (Older obtained through fink, newer
installed from source.)
Compilers: gcc/g++ 4.0.1/Mac.

Here are the issues; behavior is consistent on both machines:

MacOSX backend: Loads plots quickly, but when I try to save, I cannot type
in the file name area of the save file dialog.  Furthermore, with ipython, I
can continue to use the ipython prompt up until the I shut the plot window.
ipython then freezes until I control-c it.  This occurs in both versions.

TkAgg backend: In 99.0.1, this works fine.  However, it is slow, hence my
want for a different working backend.  in 99.1.1, the plot window opens but
the picture is never drawn.  After a moment, segfault back to the x11
prompt.  Blerg.

I've tried nearly all of the GUI tool kits, but ran into some problem:
GtkAgg: Bad color (e.g. the background is pink rather than gray, color
tables are way goofed up.  Writes to file fine.)
GtkCairo: looks great, crashes ipython on resize.
Wx: color issues, not stable.
Qt: installs from fink, but won't load.
Fltk: Couldn't get it to install via fink; can't remember why.

In any case, it's not the Gtk/Qt/Wx problems that are important, it's the
OSX backend issue.  Others whom I work with do not have this issue, but
installed using the EPD.
Has anyone else experienced such problems?  Anyone know possible fixes?
Given that this occurs on two different machines with two different MPL
versions (a total of 4 combinations), I'm guessing it's my fault somehow.

Thanks for your help; let me know if there's more info I can provide.
--

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


Re: [Matplotlib-users] Mac backend problems for nearly all backends.

2010-05-25 Thread Daniel Welling
Thanks for the info...
1)The problem does manifest in the same manner through the normal python
prompt.
2) I'm not sure what is meant by a framework install.  Everything (except
MPL 99.1.1) was installed through fink.
3) I've never had problems with Fink software before, and I have a crapload
(technical term) of stuff installed.  This is neither here nor there,
however, as it seems that not all Pythons are created equal.
4) A colleague of mine claims to have everything working on a new Intel mac
(I'm guessing 10.5.8) right out of MacPorts; I'll talk to him more and try
to find out what is different between our two cases.
5) I have yet to try installing wxPython for python 2.5; this may work in
the end.  It's not in fink, so I've put off installing it manually.  I'll
give it a shot and let you know how it works.
6) Although I use x11 and not the native Mac terminal, I'm not sure if this
requires me to install different packages for the gui stuff.  Could you guys
expand on this, please?

Finally, I've had some measure of success by installing Qt4 (through Fink)
and using the Qt4Agg backend.  Because the current stable fink Qt4 release
(4.6.1) has a bug, I need to apply the fix found here:
http://old.nabble.com/Qt4-backend:-critical-bug-with-PyQt4-v4.6%2B-td26205716.html
in order to allow more than one plot per session to be shown.  I'll re-write
the fix here for convenience and clarity (the original did not have the
proper module references in it, so this saves some 5 minutes of
tab-completion work in ipython...)

# Add this before FigureManagerQT class
class FigureWindow(QtGui.QMainWindow):
def __init__(self):
super(FigureWindow, self).__init__()
def closeEvent(self, event):
super(FigureWindow, self).closeEvent(event)
if QtCore.PYQT_VERSION_STR.startswith('4.6'):
self.emit(QtCore.SIGNAL('destroyed()'))
# Replace QtGui.QMainWindow by FigureWindow in
FigureManagerQT's constructor

This works perfectly on my Intel machine running MPL 99.1.1.  It's fast and
looks sharp.  I'll report back on the PPC/99.0 combo tomorrow; Qt4 takes a
thousand hours to compile.

Thanks for the input.

On Tue, May 25, 2010 at 8:48 PM, Jonathan Stickel jjstic...@vcn.com wrote:

 On 05/25/2010 matplotlib-users-requ...@lists.sourceforge.net wrote:
  From: Christopher Barker chris.bar...@noaa.gov
  Subject: Re: [Matplotlib-users] Mac backend problems for nearly all
  backends.
  To: matplotlib-users@lists.sourceforge.net
  Message-ID: 4bfc626c.40...@noaa.gov
  Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
  Jonathan Stickel wrote:
I've experienced many of the same problems on Mac OS X 10.6.3
  (Snow
Leopard).  I have python/scipy/numpy/matplotlib/ipython all
  installed
via Macports.
 
  Just to be clear -- this sounds like a MacPorts problem, not
  necessarily
  an OS-X problem.
 
 
 I finally have the WXagg backend
working, but that required installed WXPython with the gtk/X11
  backend.
 
  Does MacPorts not allow a native wx? Maybe becasue you're running 64
  bit?
 

 Right, I am running Snow Leopard and have Python 2.6 installed 64 bit.
 Apparently, Carbon requires 32 bit and wxWidgets/wxPython does not (yet)
 support Cocoa.  This problem will bite you in one form or another on Mac
 OS X, regardless of whether you are using Macports or something else.

  Anyway, I guess that's why I don't use macports for python.

 See above.

 
 
In any case, I have been having royal problems with GUI
  backends and
matplotlib.
Some background on where I've been having these problems:
Machine 1: OSX 10.5.8 G5 PPC
 
  That's what I've been running, and I've had no real issues (Haven't
  tried the OS-X back-end) -- but I'm using the python.org python.
 
Machine 2: OSX 10.5.7 Macbook pro/Intel
Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all
  obtained through
fink.)
 
  OK -- then a fink issue, rather than a Macports one -- same idea,
  though.
 
  My impression is that neither fink nor macports do well with Mac GUI
  stuff -- unless you're talking X11.

 Not exactly true.  Fink and Macports are tools and have their
 shortcomings, but both can be immensely useful for installing all this
 stuff.  Otherwise, you do it manually, which of course can cause you
 trouble as well.  Anyway, getting off topic.  I only intended to report
 some form of success with the wx backend.

 Jonathan


 --

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

--

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