[Matplotlib-users] Mouse event blocked in 1.0 but works with 0.93 ?

2010-09-23 Thread David Trémouilles
Hello,

  I've just updated matplotlib to 1.0 svn version from 0.93.
My pyqt4 app use the pick event. Cliking on a point in the graph
triggers an event but with matplotlib 1.0 it does not anymore while
it was working fine with 0.93.
Any idea/help on where I should look for ?

Thanks in advance,

David

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] empty xticklabel before plotting ...

2010-09-23 Thread Oz Nahum
Hi Everyone,

I don't like the default scientific formatting in matplotlib, IMHO the
format of having a zero after the exponent is a waste of space in my opinion
...
What I mean is that mpl is writing zero as:
0.0e+00 or 1.2e-03. IMHO it would suffice just to do 0.0 and 1.2e-3, which
take less space and looks better (again, imho).

In any case, I would like to access the strings of the yticklables in my
plots and I discovered I can do the following:

setp(axs[2].set_yticklabels(['0.0','2.0E-4','4.0E-4','6.0E-4','8.0E-4','1.0E-3','1.2E-3']))

Which works, but forces me to first look at the output and the redraw
everything with manually feeding the values.
if there is a way to loop on this text values before plotting I will be
happy to know.

I tried doing this:
In [1]: from pylab import *

In [2]: f=figure()

In [3]: ax=f.add_subplot()

In [4]: ax.plot([1,2,3,4,5])
---
AttributeErrorTraceback (most recent call last)

/home/oz/ipython console in module()

AttributeError: 'NoneType' object has no attribute 'plot'

In [5]: ax=f.add_subplot(111)

In [6]: ax.plot([1,2,3,4,5])
Out[6]: [matplotlib.lines.Line2D object at 0x95ecdcc]

In [7]: a=ax.get_xticklabels()

In [8]: a[0].get_text()
Out[8]: ''

In [9]: draw()

In [10]: a[0].get_text()
In [10]: a[0].get_text()
Out[10]: ''

In [11]: show()

KeyboardInterrupt:

In [12]: a[0].get_text()
Out[12]: u'0.0

As can be seen, the text string is empty before calling show, which is
forcing me to show the image . Is there a way to access these labales with
out calling show() ?

Thanks in advance,


-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery

2010-09-23 Thread John Hunter
On Wed, Sep 22, 2010 at 8:31 PM, C M cmpyt...@gmail.com wrote:

 Until a more permanent solution is figured out, can anyone recommend
 any workarounds, even if they are a little clunky?  I'm embedding mpl
 plots in wxPython and am also finding this issue suboptimal.

Change your subplots adjust parameters to make the default bottom,
left, wspace and hspace wider.  This will reduce the chance of
overlaps.

http://matplotlib.sourceforge.net/search.html?q=subplots_adjust

The defaults can be changed in your rc file

  http://matplotlib.sourceforge.net/users/customizing.html

See also these recipes on the FAQ to automatically choose boundaries

  
http://matplotlib.sourceforge.net/faq/howto_faq.html#move-the-edge-of-an-axes-to-make-room-for-tick-labels

  
http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels

Automatic layout to avoid overlap is not an easy problem -- Michael
Droetboom worked on it for a while but didn't get to a satisfactory
point.  So far our philosophy has been : make it easy to customize
rather than do it automatically.  I realize this is not always a good
approach, especially in automated figure generators where you don't
have access to the data ahead of time.

JDH

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Mouse event blocked in 1.0 but works with 0.93 ?

2010-09-23 Thread Aman Thakral
Hi David,

I'm using the pick event in wx (matplotlib 1.0) without any issues.  Could
you please post some sample code?  Have you tried to see if
legend.draggable() works? If so, the pick event is likely not an issue.

-Aman

On Thu, Sep 23, 2010 at 4:20 AM, David Trémouilles david.t...@gmail.comwrote:

 Hello,

  I've just updated matplotlib to 1.0 svn version from 0.93.
 My pyqt4 app use the pick event. Cliking on a point in the graph
 triggers an event but with matplotlib 1.0 it does not anymore while
 it was working fine with 0.93.
 Any idea/help on where I should look for ?

 Thanks in advance,

 David


 --
 Start uncovering the many advantages of virtual appliances
 and start using them to simplify application deployment and
 accelerate your shift to cloud computing.
 http://p.sf.net/sfu/novell-sfdev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] empty xticklabel before plotting ...

2010-09-23 Thread Oz Nahum
Hi Ryan,

Thanks for your answer. However, I don't understand from the existing
documentation how to use tickers.

In the past I used the following method:
class SciFormatter(Formatter):
def __call__(self, x, pos=None):
return %1.1e % x


axs.yaxis.set_major_formatter(SciFormatter())

This still does not allow me to get read of the zeros that matplotlib
coherces .

I would like to manipulate the strings of the tick labels directly. I know
it's not ideal, but I it should work.

If I could access the label 1.1E+01, I could tell python just to take
label[:-2] and glue it to  label[-1], which will give me
1.1E+1

I would be greatful if someone showed me how to access that string.


Cheers,
Oz


On Thu, Sep 23, 2010 at 3:37 PM, Ryan May rma...@gmail.com wrote:

 On Thu, Sep 23, 2010 at 3:49 AM, Oz Nahum nahu...@gmail.com wrote:
  Hi Everyone,
 
  I don't like the default scientific formatting in matplotlib, IMHO the
  format of having a zero after the exponent is a waste of space in my
 opinion
  ...
  What I mean is that mpl is writing zero as:
  0.0e+00 or 1.2e-03. IMHO it would suffice just to do 0.0 and 1.2e-3,
 which
  take less space and looks better (again, imho).

 SNIP

 
  As can be seen, the text string is empty before calling show, which is
  forcing me to show the image . Is there a way to access these labales
 with
  out calling show() ?

 What you want is to set a custom formatter:

 http://matplotlib.sourceforge.net/api/ticker_api.html

 import matplotlib.pyplot as plt
 f = plt.figure()
 ax = f.add_subplot(111)
 ax.plot([1,2,3,4,5])
 # Formats ticks on the xaxis with the %.2g format string
 ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.2g'))
 plt.show()

 If you can't get what you want using a format string, you can write a
 function that does what you want can create a formatter from that
 using FuncFormatter.

 Ryan

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




-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Mouse event blocked in 1.0 but works with 0.93 ?

2010-09-23 Thread David Trémouilles

OK, was able to narrow thinks down:
actually it looks like
figure.canvas.mpl_connect('pick_event', function)
does not connect the function if it is a class method (...?)
In attachment you will find two files illustrating this:
buggy_pick.py and buggy_pick2.py
Both work nicely with matplotlib 0.93
With matplotlib 1.0 buggy_pick.py does not work while buggy_pick2.py 
does work.

The only difference is in the PickFig class...

Is it really a bug or I'm doing something wrong ?

Any workaround would be welcome.

Thx,

David

PS. Is it better to discuss this on users or devel list ?

Le 23/09/10 15:42, Ryan May a écrit :

On Thu, Sep 23, 2010 at 3:20 AM, David Trémouillesdavid.t...@gmail.com  wrote:

Hello,

  I've just updated matplotlib to 1.0 svn version from 0.93.
My pyqt4 app use the pick event. Cliking on a point in the graph
triggers an event but with matplotlib 1.0 it does not anymore while
it was working fine with 0.93.
Any idea/help on where I should look for ?


Not without a better idea of what you're doing. I *can* say that both
picking examples work fine for me with the Qt4Agg backend. Can you
create a complete, minimal example that replicates the problem you're
seeing? Without that, I'd just be guessing blindly.

Ryan

import matplotlib
matplotlib.use('Qt4Agg')
import numpy as np
import sys
from PyQt4 import QtCore
from PyQt4 import QtGui


from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar

class MatplotlibFig(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self)
figure = Figure()
fig_canvas = FigureCanvasQTAgg(figure)
fig_toolbar = NavigationToolbar(fig_canvas, self)
fig_vbox = QtGui.QVBoxLayout()
fig_vbox.addWidget(fig_canvas)
fig_vbox.addWidget(fig_toolbar)
fig_canvas.setParent(self)
self.setLayout(fig_vbox)
self.figure = figure

class PickFig(object):
def __init__(self, fig):
x = np.arange(10)
y = np.exp(x)
ax1 = fig.add_subplot(111)
selected_flag = np.zeros(x.shape[0],dtype=np.bool)
ax1.plot(x, y)
line, = ax1.plot(x, y, 'o', picker=5)
selected_point, = ax1.plot(x[selected_flag], y[selected_flag], 'ro')
self.ax1 = ax1
self.x = x
self.y = y
self.fig = fig
self.selected_flag = selected_flag
self.selected_point = selected_point
fig.canvas.mpl_connect('pick_event', self.onpick3)
fig.canvas.draw()

def onpick3(self, event):
print event
if event.mouseevent.button == 1:
self.ax1.set_autoscale_on(False)
ind = event.ind
self.selected_flag[ind] = not self.selected_flag[ind]
print self.x[self.selected_flag]
print 'onpick3 scatter:', ind, np.take(self.x, ind), np.take(self.y, ind)
self.selected_point.set_data(self.x[self.selected_flag],
self.y[self.selected_flag])
self.fig.canvas.draw()



class TestFig(MatplotlibFig):
def __init__(self, parent=None):
MatplotlibFig.__init__(self, parent)
PickFig(self.figure)


class MainWin(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.setWindowTitle(Test)
mat_fig = TestFig(self)
self.setCentralWidget(mat_fig)


def main():
app = QtGui.QApplication(sys.argv)
mainwin = MainWin()
mainwin.show()
sys.exit(app.exec_())

if __name__ == '__main__':
main()
import matplotlib
matplotlib.use('Qt4Agg')
import numpy as np
import sys
from PyQt4 import QtCore
from PyQt4 import QtGui


from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar

class MatplotlibFig(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self)
figure = Figure()
fig_canvas = FigureCanvasQTAgg(figure)
fig_toolbar = NavigationToolbar(fig_canvas, self)
fig_vbox = QtGui.QVBoxLayout()
fig_vbox.addWidget(fig_canvas)
fig_vbox.addWidget(fig_toolbar)
fig_canvas.setParent(self)
self.setLayout(fig_vbox)
self.figure = figure

class PickFig(object):
def __init__(self, fig):
x = np.arange(10)
y = np.exp(x)
ax1 = fig.add_subplot(111)
selected_flag = np.zeros(x.shape[0],dtype=np.bool)
ax1.plot(x, y)
line, = ax1.plot(x, y, 'o', picker=5)
selected_point, = ax1.plot(x[selected_flag], y[selected_flag], 'ro')
def onpick3(event):
print event
if event.mouseevent.button == 1:
ax1.set_autoscale_on(False)
ind = event.ind

Re: [Matplotlib-users] empty xticklabel before plotting ...

2010-09-23 Thread Oz Nahum
Hi Every, Hi Ryan

I finally solved this issue, which bothered me very long.

I managed to make a nicer scientific formatting on the xticks !

from pylab import *
import numpy as N


from matplotlib.ticker import Formatter,FuncFormatter
import os
#class to produce scientific format numbering
class SciFormatter(Formatter):
def __call__(self, x, pos=None):
return %1.e % x

class NiceSciFormatter(Formatter):
def __call__(self, x, pos=None):
a=%1.1E % x
a=a[:5]+a[-1]
return a

fig=figure()
ax=fig.add_subplot(111)

y=[.0001,.0002,.0003,.0004,.0005]
x=[1,2,3,4,5]
ax.plot(x,y)

ax.yaxis.set_major_formatter(NiceSciFormatter())

show()


Cheers ,

Oz


-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] empty xticklabel before plotting ...

2010-09-23 Thread Ryan May
On Thu, Sep 23, 2010 at 8:52 AM, Oz Nahum nahu...@gmail.com wrote:
 Hi Ryan,

 Thanks for your answer. However, I don't understand from the existing
 documentation how to use tickers.

 In the past I used the following method:
 class SciFormatter(Formatter):
     def __call__(self, x, pos=None):
     return %1.1e % x


 axs.yaxis.set_major_formatter(SciFormatter())

 This still does not allow me to get read of the zeros that matplotlib
 coherces .

 I would like to manipulate the strings of the tick labels directly. I know
 it's not ideal, but I it should work.

 If I could access the label 1.1E+01, I could tell python just to take
 label[:-2] and glue it to  label[-1], which will give me
 1.1E+1

 I would be greatful if someone showed me how to access that string.

Why not just format the number yourself?

import matplotlib.pyplot as plt
import numpy as np

def format(x, pos=None):
if x == 0.0:
exp = 0
else:
exp = int(np.log10(np.abs(x)))
mant = x / 10**exp
return '%.2fE%+d' % (mant, exp)

f = plt.figure()
ax = f.add_subplot(111)
data = np.array([1,2,3,4,5]) / 100.
ax.plot(data, np.arange(len(data)))

ax.xaxis.set_major_formatter(plt.FuncFormatter(format))

plt.show()

Ryan

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

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ImportError: No module named _path

2010-09-23 Thread Christopher Barker
Justin Park wrote:
 Hello,
 
 I am using Mac 10.5.8.
 
 I have been trying to install Matplotlib, and succeeded to do so.

How did you install it?

What python are you using?

-Chris


 But when I try to import matplotlib.pyplot, I got the following error:
 
 import matplotlib.pyplot
 Traceback (most recent call last):
   File stdin, line 1, in module
   File
 /Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/pyplot.py,
 line 23, in module
 from matplotlib.figure import Figure, figaspect
   File
 /Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/figure.py,
 line 16, in module
 import artist
   File
 /Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/artist.py,
 line 6, in module
 from transforms import Bbox, IdentityTransform, TransformedBbox,
 TransformedPath
   File
 /Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/transforms.py,
 line 34, in module
 from matplotlib._path import affine_transform
 ImportError: No module named _path
 
 Could you please let me know how I can fix this problem?
 I tried several ways of reinstalling it(after cleaning as described in
 many web-sites), but all the ways returned the same error.
 
 Thanks,
 Justin.
 
 --
 Nokia and ATT present the 2010 Calling All Innovators-North America contest
 Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
 $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
 Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
 http://p.sf.net/sfu/nokia-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Mouse event blocked in 1.0 but works with 0.93 ?

2010-09-23 Thread Ryan May
On Thu, Sep 23, 2010 at 9:16 AM, David Trémouilles david.t...@gmail.com wrote:
 OK, was able to narrow thinks down:
 actually it looks like
 figure.canvas.mpl_connect('pick_event', function)
 does not connect the function if it is a class method (...?)
 In attachment you will find two files illustrating this:
 buggy_pick.py and buggy_pick2.py
 Both work nicely with matplotlib 0.93
 With matplotlib 1.0 buggy_pick.py does not work while buggy_pick2.py does
 work.
 The only difference is in the PickFig class...

 Is it really a bug or I'm doing something wrong ?

 Any workaround would be welcome.

Technically, you're doing something sort of wrong, though it's very
subtle. And it just so happens that the way the code for callbacks was
reworked that this even showed up.
In this code:

class TestFig(MatplotlibFig):
def __init__(self, parent=None):
MatplotlibFig.__init__(self, parent)
PickFig(self.figure)

You create a PickFig, but since you don't assign it to anything, it
gets garbage collected and (eventually) removed from the callbacks.
Previously, the callback registry would have a reference to the
callbacks, which would have kept PickFig alive. This was changed to
eliminate some resource leaks. The fix is simple, just save the
PickFig as a member of TestFig:

self.pf = PickFig(self.figure)

That fixes the problem for me.

Ryan

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

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Mouse event blocked in 1.0 but works with 0.93 ? (Solved)

2010-09-23 Thread David Trémouilles
Wonderful !
This does indeed solve my issue.

Many many thanks,

David

Le 23/09/10 17:35, Ryan May a écrit :
 On Thu, Sep 23, 2010 at 9:16 AM, David Trémouillesdavid.t...@gmail.com  
 wrote:
 OK, was able to narrow thinks down:
 actually it looks like
 figure.canvas.mpl_connect('pick_event', function)
 does not connect the function if it is a class method (...?)
 In attachment you will find two files illustrating this:
 buggy_pick.py and buggy_pick2.py
 Both work nicely with matplotlib 0.93
 With matplotlib 1.0 buggy_pick.py does not work while buggy_pick2.py does
 work.
 The only difference is in the PickFig class...

 Is it really a bug or I'm doing something wrong ?

 Any workaround would be welcome.

 Technically, you're doing something sort of wrong, though it's very
 subtle. And it just so happens that the way the code for callbacks was
 reworked that this even showed up.
 In this code:

 class TestFig(MatplotlibFig):
  def __init__(self, parent=None):
  MatplotlibFig.__init__(self, parent)
  PickFig(self.figure)

 You create a PickFig, but since you don't assign it to anything, it
 gets garbage collected and (eventually) removed from the callbacks.
 Previously, the callback registry would have a reference to the
 callbacks, which would have kept PickFig alive. This was changed to
 eliminate some resource leaks. The fix is simple, just save the
 PickFig as a member of TestFig:

 self.pf = PickFig(self.figure)

 That fixes the problem for me.

 Ryan


--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Order of 3d Plots

2010-09-23 Thread Jason Grout
On 9/22/10 2:55 PM, Lütteke Felix wrote:
 Hello,



 is there a possibility to order several 3dplots, if all are plotted
 in the same figure. If  I execute the code below, the higher values
 (blue) are covered by the lower (yellow) ones, which seems quite
 unlogical to me (see attached image). Any help if greatly appreciated
 - after having searched for a solution quite a few hours...




There is no cutting up of objects and ordering them based on distance to 
the viewer, if that's what you're asking.  I see an experiment on github 
that starts to implement that sort of thing, though:

http://github.com/astraw/matplotlib/network/members

Thanks,

Jason

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib and PySide ?

2010-09-23 Thread David Trémouilles
 On Wed, Sep 15, 2010 at 3:03 AM, David Trémouilles david.t...@gmail.com
 mailto:david.t...@gmail.com wrote:

 Hello,

   Does anybody know if matplotlib work with pyside ?
 If it does how to use matplotib with pyside ?

 Thanks,

 David


 David,

 I am not familiar with PySide, so I looked it up.  Please correct me if
 I am wrong, but it appears to be an alternative to PyQt for licensing
 reasons, and the FAQ says that it is API compatible.  On the python side
 of matplotlib, I wonder if using PySide would be as simple as just
 replacing all of the import PyQt or import PyQt4 with import
 PySide (and all the from PyQt import ...).

 Does PySide still use the same compiled Qt libraries that PyQt uses?  If
 so, then I don't *think* you need to recompile the Qt backends, but I am
 not entirely sure.

 Good luck!
 Ben Root


Hi Ben,
I did try to roughly replace PyQt4 import by PySide import
in my installed matplotlib but pyplot.plot function led to a seg fault...
(PyQt and PySide where indeed compiled with the same Qt lib)

I'm not skilled enough to go further on...

Thanks for your help,

David

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] empty xticklabel before plotting ...

2010-09-23 Thread Oz Nahum
Hi Ryan,
Thanks again,

Well your solution is also working.

I get very similar results with

class NiceSciFormatter(Formatter):

def __call__(self, x, pos=None):
a=%1.1E % x
a=a[:5]+a[-1]
return a

It seems though that your solution enables more fine tuning !

Cheers,
Oz

On Thu, Sep 23, 2010 at 5:10 PM, Ryan May rma...@gmail.com wrote:

 On Thu, Sep 23, 2010 at 8:52 AM, Oz Nahum nahu...@gmail.com wrote:
  Hi Ryan,
 
  Thanks for your answer. However, I don't understand from the existing
  documentation how to use tickers.
 
  In the past I used the following method:
  class SciFormatter(Formatter):
  def __call__(self, x, pos=None):
  return %1.1e % x
 
 
  axs.yaxis.set_major_formatter(SciFormatter())
 
  This still does not allow me to get read of the zeros that matplotlib
  coherces .
 
  I would like to manipulate the strings of the tick labels directly. I
 know
  it's not ideal, but I it should work.
 
  If I could access the label 1.1E+01, I could tell python just to take
  label[:-2] and glue it to  label[-1], which will give me
  1.1E+1
 
  I would be greatful if someone showed me how to access that string.

 Why not just format the number yourself?

 import matplotlib.pyplot as plt
 import numpy as np

 def format(x, pos=None):
if x == 0.0:
exp = 0
else:
exp = int(np.log10(np.abs(x)))
mant = x / 10**exp
return '%.2fE%+d' % (mant, exp)

 f = plt.figure()
 ax = f.add_subplot(111)
 data = np.array([1,2,3,4,5]) / 100.
 ax.plot(data, np.arange(len(data)))

 ax.xaxis.set_major_formatter(plt.FuncFormatter(format))

 plt.show()

 Ryan

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




-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes outer position - amount of space for axeslabels

2010-09-23 Thread Stan West
From: Jeremy Lewi [mailto:jl...@intellisis.com] 
Sent: Friday, September 17, 2010 17:38

 

Is there a way to get the size of the bounding box for the axes which includes
the axes labels and tick marks? It looks like Axes.get_position/set_position
refers to the inner position (i.e the actual plot area).

Perhaps you could use the get_tightbbox() method possessed by Figure and Axes
instances, although you need to tell it what renderer to use. If you've
already drawn the figure in a GUI window, the method employed by
FigureCanvasBase.print_figure in backend_bases.py might work:

fig = plt.gcf()
bbox = fig.get_tightbbox(fig._cachedRenderer)

You can then get the measurements using such properties and methods as these:

left, bottom, width, height = bbox.bounds
left, bottom, right, top = bbox.get_points().flatten()

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] how to put non-latin text on plots?

2010-09-23 Thread Oz Nahum
Hi Everyone,
Not really related to my every day work, but I was asking myself how to put
non latin letters, like arabic or hebrew on plots.

I found a way to put german umlauts and ß but this is only a very partial
solution. It would be cool to know how to over come this.

My code to work with umlauts is:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import numpy as np

def format(x, pos=None):
   if x == 0.0:
   exp = 0
   else:
   exp = int(np.log10(np.abs(x)))
   mant = x / 10**exp
   return '%.1fE%+d' % (mant, exp)

f = plt.figure()
ax = f.add_subplot(111)
data = np.array([1,2,3,4,5]) / 100.
ax.plot(data, np.arange(len(data)))

ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
ax.yaxis.set_major_formatter(plt.FuncFormatter(format))
ax.text(0.03,0.5,Umlauts äüöß+ u\u00e4)
plt.show()

If I include arabic or hebrew letters I get Bricks displays.

Thanks in advance,

Oz

-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to put non-latin text on plots?

2010-09-23 Thread Michael Droettboom
You may need to use a font with a more complete character set, such as 
DejaVu.


Mike

On 09/23/2010 02:56 PM, Oz Nahum wrote:

Hi Everyone,
Not really related to my every day work, but I was asking myself how 
to put non latin letters, like arabic or hebrew on plots.


I found a way to put german umlauts and ß but this is only a very 
partial solution. It would be cool to know how to over come this.


My code to work with umlauts is:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import numpy as np

def format(x, pos=None):
   if x == 0.0:
   exp = 0
   else:
   exp = int(np.log10(np.abs(x)))
   mant = x / 10**exp
   return '%.1fE%+d' % (mant, exp)

f = plt.figure()
ax = f.add_subplot(111)
data = np.array([1,2,3,4,5]) / 100.
ax.plot(data, np.arange(len(data)))

ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
ax.yaxis.set_major_formatter(plt.FuncFormatter(format))
ax.text(0.03,0.5,Umlauts äüöß+ u\u00e4)
plt.show()

If I include arabic or hebrew letters I get Bricks displays.

Thanks in advance,

Oz

--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace



--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev


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



--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to put non-latin text on plots?

2010-09-23 Thread Michael Droettboom
I should also add that matplotlib doesn't have any advanced text layout 
algorithms (such as what would be found in Pango), so Hebrew and Arabic 
are likely to be backwards and wrong.


Mike

On 09/23/2010 03:07 PM, Michael Droettboom wrote:
You may need to use a font with a more complete character set, such as 
DejaVu.


Mike

On 09/23/2010 02:56 PM, Oz Nahum wrote:

Hi Everyone,
Not really related to my every day work, but I was asking myself how 
to put non latin letters, like arabic or hebrew on plots.


I found a way to put german umlauts and ß but this is only a very 
partial solution. It would be cool to know how to over come this.


My code to work with umlauts is:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import numpy as np

def format(x, pos=None):
   if x == 0.0:
   exp = 0
   else:
   exp = int(np.log10(np.abs(x)))
   mant = x / 10**exp
   return '%.1fE%+d' % (mant, exp)

f = plt.figure()
ax = f.add_subplot(111)
data = np.array([1,2,3,4,5]) / 100.
ax.plot(data, np.arange(len(data)))

ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
ax.yaxis.set_major_formatter(plt.FuncFormatter(format))
ax.text(0.03,0.5,Umlauts äüöß+ u\u00e4)
plt.show()

If I include arabic or hebrew letters I get Bricks displays.

Thanks in advance,

Oz

--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace



--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev


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



--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev


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



--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] citation of mpl

2010-09-23 Thread Chloe Lewis
Well, I had my bib program open, so here are a couple formats:?xml version=1.0 encoding=UTF-8?
xml
records
recorddatabase name=Everything.bib path=/Users/chlewis/Documents/svn/chlewis/Everything.bibEverything.bib/databasesource-app name=BibDesk version=1.5.3BibDesk/source-apprec-number1/rec-numberref-type17/ref-typecontributorsauthorsauthorHunter, John D./author/authorssecondary-authors/secondary-authorssubsidiary-authors/subsidiary-authors/contributorstitlestitleMatplotlib: A 2D graphics environment/titlesecondary-titleComputing In Science \amp; Engineering/secondary-title/titlesvolume9/volumenumber3/numberpages90--95/pagespub-location10662 LOS VAQUEROS CIRCLE, PO BOX 3014, LOS ALAMITOS, CA 90720-1314 USA/pub-locationpublisherIEEE COMPUTER SOC/publisherwork-typeEditorial Material/work-typedatesyear2007/yearpub-datesdateMay-Jun/date/pub-dates/dateslabelHunter:2007/labelkeywords/keywordsurlspdf-urls/pdf-urlsrelated-urlsurlhttp://gateway.isiknowledge.com/gateway/Gateway.cgi?GWVersion=2amp;SrcAuth=Alertingamp;SrcApp=Alertingamp;DestApp=WOSamp;DestLinkType=FullRecord;KeyUT=000245668100019/url/related-urls/urlsabstractMatplotlib is a 2D graphics package used for Python for application development, interactive scripting, and publication-quality image generation across user interfaces and operating systems./abstractcustom3article/custom3added-date23/09/2010/added-datemodified-date23/09/2010/modified-date/record
/records
/xml


matplotlib.ris
Description: application/research-info-systems


matplotlib.bib
Description: Binary data
On Sep 22, 2010, at 22 Sep, 1:18 PM, Benjamin Root wrote:On Wed, Sep 22, 2010 at 3:13 PM, Jason Grout jason-s...@creativetrax.com wrote:  On 09/22/2010 08:59 AM, John Hunter wrote:  On Wed, Sep 22, 2010 at 8:45 AM, Bala subramanian  bala.biophys...@gmail.com wrote:  Friends,  I have mentioned in my research manuscript that plots were generated by  'matplotlib package'. I dnt find the related reference of mpl. Kindly tell  me how can i site mpl.  You can certainly reference the website, but if you want to refer to a  published paper, I suggest   Matplotlib: A 2D Graphics Environment  Source: Computing in Science and Engineering archive  Volume 9 , Issue 3 (May 2007)  Pages: 90-95  Year of Publication: 2007  ISSN:1521-9615  Author:John D. Hunter  Publisher   : IEEE Educational Activities Department Piscataway, NJ, USA   and/or the conference abstract at  http://adsabs.harvard.edu/abs/2005ASPC..347...91B  Could this be put up on the website somewhere in a easily-found place? Maybe a short sentence and link in the bar on the right under "Other stuff"? Something like "To cite matplotlib in a paper, use a href='' this reference/a." or something.  Thanks,  Jason +1...This would help by providing a consistent way of citing matplotlib. Without this, different authors may reference matplotlib different ways, thereby diluting the impact of the above reference. Plus, it always annoyed me to try and figure out how to cite things like matplotlib or various data sources. Ben Root --Start uncovering the many advantages of virtual appliancesand start using them to simplify application deployment andaccelerate your shift to cloud computing.http://p.sf.net/sfu/novell-sfdev2dev___Matplotlib-users mailing listMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe LewisEcosystem Sciences, Policy and Management, UC Berkeley137 Mulford HallBerkeley, CA 94720-3114http://nature.berkeley.edu/~chlewis --
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] citation of mpl

2010-09-23 Thread John Hunter
On Thu, Sep 23, 2010 at 2:33 PM, Chloe Lewis chle...@berkeley.edu wrote:
 Well, I had my bib program open, so here are a couple formats:

Thanks for posting these.  I added this to the FAQ:

  http://matplotlib.sourceforge.net/faq/howto_faq.html#cite-matplotlib

JDH

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] citation of mpl

2010-09-23 Thread Carlos Grohmann
many thanks. very useful info.

Carlos


On Thu, Sep 23, 2010 at 17:03, John Hunter jdh2...@gmail.com wrote:
 On Thu, Sep 23, 2010 at 2:33 PM, Chloe Lewis chle...@berkeley.edu wrote:
 Well, I had my bib program open, so here are a couple formats:

 Thanks for posting these.  I added this to the FAQ:

  http://matplotlib.sourceforge.net/faq/howto_faq.html#cite-matplotlib

 JDH

 --
 Nokia and ATT present the 2010 Calling All Innovators-North America contest
 Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
 $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
 Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
 http://p.sf.net/sfu/nokia-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
http://lattes.cnpq.br/5846052449613692
Linux User #89721

Can’t stop the signal.

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] set style similar to ROOT

2010-09-23 Thread Ruggero
Can someone give some hints to change the style of plot produced with
matplotlib to be similar to plots produced with ROOT? Example here:
http://precision-turra.mi.infn.it/ph_oq/graphs/eta_energy_position_amount/reta_mean/ph_oq/

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users