[Matplotlib-users] Getting the set of point actually plotted (from Sage)

2011-02-06 Thread Laurent
Hello all !

I'm sorry if my question is not clear, but I do not know ho to produce a 
simple example.

I'm plotting the graph of an implicit given function (say x^2+y^2=3) 
using Sage.

What I know it that
1. when I ask sage to plot   implicit_plot( f==3,(x,-5,5),(y,-5,5) ),
 Sage computes f-3 on an array of points in the square (-5,-5)x(5,5).
2. Sage creates an object matplotlib.figure.Figure that contains 
somewhere the information about the array of computed points and ask 
matplotlib to plot it

What I understood is that somewhere in matplotlib, the values are parsed 
and a path is created. That path is the set of points on which f-3=0


My aim : catch the set of points that satisfy f-3=0. That has to be 
stored --or at last computed-- somewhere in matplotlib.figure.Figure

I read the source, but I'm really lost.

The final purpose is to know the bounding box of the points that are 
*actually* plotted without taking into account the axes, labels and 
other decorations.

Does someone know how to do that ?

Since the object I have on hand is created by Sage[1] in a quite complex 
way, I'm sorry to not being able to furnish an example.


Thanks
Laurent


If it can help, I have the following in a Sage terminal :

sage: var('x,y')
sage: F=implicit_plot(x**2+y**2==2,(x,-5,5),(y,-5,5),plot_points=100)
sage: F.matplotlib()

sage: F.matplotlib().get_children()
[, 
]

I really do not understand where is the data ??? In the Rectangle ? In 
the Axes ?

On the Sage's side, the discussion is here :
http://ask.sagemath.org/question/359/get_minmax_data-on-implicit_plot


[1] www.sagemath.org

--
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting the set of point actually plotted (from Sage)

2011-02-06 Thread Laurent
> Your data are embedded in a Line2d object which is itself a child of an
> Axes, itself child of the figure. Try:
> Fig = F.matplotlib()
> ax = Fig.get_axes()[0] # to get the first (and maybe only) subplot
> line = ax.get_axes()[0]
> xdata = line.get_xdata()
> ydata = line.get_ydata()

There is something wrong ...

sage: var('x,y') 

(x, y)
sage: F=implicit_plot(x**2+y**2==1,(x,-5,5),(y,-5,5))
sage: Fig = F.matplotlib()
sage: ax = Fig.get_axes()[0] <-- I checked  : it is the only element :)
sage: line = ax.get_axes()[0]
---
TypeError Traceback (most recent call 
last) 
 

TypeError: 'AxesSubplot' object does not support indexing 
 

sage:line=ax.get_axes() 

sage:type(line) 



However, using some "grep get_ydata" from that point, I suceed to track 
my information.
It was in the segments argument of matplotlib.collections.LineCollection

Now I'm tracking back the information ... It is in
mcontour.QuadContourSet(self, *args, **kwargs).allsegs
in the method matplotlib.axes.Axes.contour()

I'm almost done.

Thanks for help !

Have a nice afternoon
Laurent

PS :
I'll post the final answer here :
http://ask.sagemath.org/question/359/get_minmax_data-on-implicit_plot

PPS :
Argh !! Someone already did !


--
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Little help needed with pqt ...

2009-09-11 Thread Laurent Dufrechou
Hello,

I face a very boring problem.
Here is a little modified pyqt widget example found on matplotlib website.
Basicaly I've just added a tab widget and inside it a matplotlib widget.

Sadly, on creation the widget don't get the full size of the PA_tab widget
:(
BUT once I resize manually the app all became OK...

To be honest I've got NO idea of what is the problem :(

Any direction highly appreciated!

Laurent

matplotlib:
__version__  = '0.98.5.2'

And pyqt: 4.4.3.6


#!/usr/bin/env python

# embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases
#
# Copyright (C) 2005 Florent Rougon
#   2006 Darren Dale
#
# This file is an example program for matplotlib. It may be used and
# modified with no restriction; raw copies as well as modified versions
# may be distributed without limitation.

import sys, os, random
from PyQt4 import QtGui, QtCore

from numpy import arange, sin, pi
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

progname = os.path.basename(sys.argv[0])
progversion = "0.1"


class MyMplCanvas(FigureCanvas):
"""Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
self.axes = fig.add_subplot(111)
# We want the axes cleared every time plot() is called
self.axes.hold(False)

self.compute_initial_figure()

#
FigureCanvas.__init__(self, fig)
self.setParent(parent)

FigureCanvas.setSizePolicy(self,
   QtGui.QSizePolicy.Expanding,
   QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)


def compute_initial_figure(self):
pass


class MyStaticMplCanvas(MyMplCanvas):
"""Simple canvas with a sine plot."""
def compute_initial_figure(self):
t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)
self.axes.plot(t, s)


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

def compute_initial_figure(self):
 self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r')

def update_figure(self):
# Build a list of 4 random integers between 0 and 10 (both inclusive)
l = [ random.randint(0, 10) for i in xrange(4) ]

self.axes.plot([0, 1, 2, 3], l, 'r')
self.draw()


class ApplicationWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setWindowTitle("application main window")

self.centralwidget  = QtGui.QWidget(self)
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.MainTab = QtGui.QTabWidget(self.centralwidget)
self.verticalLayout.addWidget(self.MainTab)
self.PA_tab  = QtGui.QWidget()
self.MainTab.addTab(self.PA_tab, "")
toto = MyDynamicMplCanvas(self.PA_tab)

self.vLayout = QtGui.QVBoxLayout(self.PA_tab)
self.vLayout.addWidget(toto)


self.setCentralWidget(self.centralwidget)
self.resize(QtCore.QSize(1024,900))

def fileQuit(self):
self.close()

def closeEvent(self, ce):
self.fileQuit()

def about(self):
QtGui.QMessageBox.about(self, "About %s" % progname,
u"""%(prog)s version %(version)s
Copyright \N{COPYRIGHT SIGN} 2005 Florent Rougon, 2006 Darren Dale

This program is a simple example of a Qt4 application embedding matplotlib
canvases.

It may be used and modified with no restriction; raw copies as well as
modified versions may be distributed without limitation."""
% {"prog": progname, "version": progversion})


qApp = QtGui.QApplication(sys.argv)

aw = ApplicationWindow()
aw.setWindowTitle("%s" % progname)
aw.show()
sys.exit(qApp.exec_())
#qApp.exec_()
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Re :Re: Little help need ed with pqt ...

2009-09-11 Thread laurent . dufrechou

Hi Darren,

Thanks for your answer.
... I've updated to matplotlib 0.99 since the last email... and the bug  
disappeared :)
Must be a bug of previous version since I had ever added a layout to the  
central widget!


Thanks anyway for your help!


On Fri, Sep 11, 2009 at 5:52 PM, Laurent Dufrechou



[email protected]> wrote:



> Hello,



>



> I face a very boring problem.


> Here is a little modified pyqt widget example found on matplotlib  
website.



> Basicaly I've just added a tab widget and inside it a matplotlib widget.



>


> Sadly, on creation the widget don't get the full size of the PA_tab  
widget



> :(



> BUT once I resize manually the app all became OK...



>



> To be honest I've got NO idea of what is the problem :(



>



> Any direction highly appreciated!





Try adding a layout to the central widget and adding your tab widget



to that layout.





Darren


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Testing email becuase my previuous didn't want to appear...

2009-10-08 Thread Laurent Dufrechou
.

Laurent

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Little issue with blitting technique

2009-10-08 Thread Laurent Dufrechou
Hello,

 

I've just discovered blitting technique to improve performances.

I'm using this example
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4.html

 

I encounter an issue if instead of using subplot I use add_axes method to
hand define where I want my plot.

In this case blitting is no more working like if restore_region was not
restoring context.

 

def __init__(self):

FigureCanvas.__init__(self, Figure())

 

#self.ax = self.figure.add_subplot(111)

self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])

 

Any idea why in this case the example given is not working?

 

Cheers,

Laurent

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Little issue with blitting technique [Update]

2009-10-08 Thread Laurent Dufrechou
Hello,

Continuing on my previous email, I'm using this example:

http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4.html

 

def __init__(self):

FigureCanvas.__init__(self, Figure())

 

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

self.ax.set_position([0.1,0.05,0.5,0.9]) 

 

works, but:

 

def __init__(self):

FigureCanvas.__init__(self, Figure())

 

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

self.ax.set_position([0.1,0.1,0.5,0.9])



is not working L, the region is wrongly blitted and some part of the graph
is not restored.

 

I think there is a bug in the refresh of the bounding box or something like
this.

 

Using matplotlib 0.99.1.1 python2.5 win32 pyqt4 4.4.3.7 (given with
python(x,y) 2.1.17)

 

Laurent

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Some icons do not showup after packaging with py2exe or pyinstaller

2009-10-09 Thread Laurent Dufrechou
Hello,

 

Whether method I use to package my python app, I always reach the issue
where the toolbar does not display some icons whiel the "subplot" is well
displayed.

Each time the packaging method copy mpl-data where the .exe is created so
file are or should be at the right location.

Does anybody has encountered this issue /solved it?

 

If not, can someone explain me the basic process behind finding the pictures
inside matplotlib? So I'l try to debug this with py2exe and pyinstaller
team.

Ps: using matplotlib 0.99.1 + pyqt 4.4

 

Thx a lot for any direction!

 

Laurent

<>--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Little issue with blitting technique

2009-10-12 Thread Laurent Dufrechou
Hello,

 

I've just discovered blitting technique to improve performances.

I'm using this example
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4.
html

 

I encounter an issue if instead of using subplot I use add_axes method
to hand define where I want my plot.

In this case blitting is no more working like if restore_region was not
restoring context...

 

def __init__(self):

FigureCanvas.__init__(self, Figure())

 

#self.ax = self.figure.add_subplot(111)

self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])

 

Any idea why in this case the example given is not working?

 

Cheers,

Laurent

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Some icons do not showup after packaging with py2exe or pyinstaller

2009-10-12 Thread Laurent Dufrechou
Hello,

 

Whether method I use to package my python app, I always reach the issue
where the toolbar does not display some icons whiel the "subplot" is
well displayed.

Each time the packaging method copy mpl-data where the .exe is created
so file are or should be at the right location.

Does anybody has encountered this issue /solved it?

 

If not, can someone explain me the basic process behind finding the
pictures inside matplotlib? So I'l try to debug this with py2exe and
pyinstaller team.

Ps: using matplotlib 0.99.1 + pyqt 4.4

 

Thx a lot for any direction!

 

Laurent

<>--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Little issue with blitting technique

2009-10-13 Thread Laurent Dufrechou
Hello,

I've tested so far with wx and QT4 backend.
The two are buggy.
Easy way to reproduce the bug (another way I mean)

ax = p.subplot(212)
ax2 = p.subplot(211)

and the two backends got the same error.

Note that I'm under windows. I'll try under linux tonight just to check.
I'll also try gtk backend as you suggest.

Update in next email :)

> -Message d'origine-
> De : Jae-Joon Lee [mailto:[email protected]]
> Envoyé : mardi 13 octobre 2009 18:36
> À : Laurent Dufrechou
> Cc : [email protected]
> Objet : Re: [Matplotlib-users] Little issue with blitting technique
> 
> I haven't tested it with qt4, but with gtk, add_axes DOES work.
> 
> So, can you try other backends and see if they work?
> 
> And, I believe that add_subplot -> add_axes is a only change you made?
> 
> Unless the problem is persistent among other backends, I hope other
> developers who use qt4 backend step in and help.
> 
> Regards,
> 
> -JJ
> 
> 
> On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou
>  wrote:
> > Hello,
> >
> >
> >
> > I’ve just discovered blitting technique to improve performances.
> >
> > I’m using this example
> >
> http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
> .html
> >
> >
> >
> > I encounter an issue if instead of using subplot I use add_axes
> method to
> > hand define where I want my plot.
> >
> > In this case blitting is no more working like if restore_region was
> not
> > restoring context…
> >
> >
> >
> > def __init__(self):
> >
> >     FigureCanvas.__init__(self, Figure())
> >
> >
> >
> >     #self.ax = self.figure.add_subplot(111)
> >
> >     self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
> >
> >
> >
> > Any idea why in this case the example given is not working?
> >
> >
> >
> > Cheers,
> >
> > Laurent
> >
> > -
> -
> > Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> > is the only developer event you need to attend this year. Jumpstart
> your
> > developing skills, take BlackBerry mobile applications to market and
> stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> > http://p.sf.net/sfu/devconference
> > ___
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Little issue with blitting technique

2009-10-13 Thread Laurent Dufréchou
I've just installer GTK on windows + tested your file and it works...
Moreover, I've modified the source to make the code use QT4Agg instead of GTK 
and the bug does not appears.
So I think it is more an issue of misusing bliting technique in other examples.
(still your gtk example is more beautiful but 10 times slower than other 
examples, so is blitting really working in this case ?)

I'll dig this a little more but any idea welcome :)

> -Message d'origine-
> De : Laurent Dufrechou [mailto:[email protected]]
> Envoyé : mardi 13 octobre 2009 19:02
> À : Jae-Joon Lee
> Cc : [email protected]
> Objet : Re: [Matplotlib-users] Little issue with blitting technique
> 
> Hello,
> 
> I've tested so far with wx and QT4 backend.
> The two are buggy.
> Easy way to reproduce the bug (another way I mean)
> 
> ax = p.subplot(212)
> ax2 = p.subplot(211)
> 
> and the two backends got the same error.
> 
> Note that I'm under windows. I'll try under linux tonight just to
> check.
> I'll also try gtk backend as you suggest.
> 
> Update in next email :)
> 
> > -Message d'origine-
> > De : Jae-Joon Lee [mailto:[email protected]]
> > Envoyé : mardi 13 octobre 2009 18:36
> > À : Laurent Dufrechou
> > Cc : [email protected]
> > Objet : Re: [Matplotlib-users] Little issue with blitting technique
> >
> > I haven't tested it with qt4, but with gtk, add_axes DOES work.
> >
> > So, can you try other backends and see if they work?
> >
> > And, I believe that add_subplot -> add_axes is a only change you
> made?
> >
> > Unless the problem is persistent among other backends, I hope other
> > developers who use qt4 backend step in and help.
> >
> > Regards,
> >
> > -JJ
> >
> >
> > On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou
> >  wrote:
> > > Hello,
> > >
> > >
> > >
> > > I’ve just discovered blitting technique to improve performances.
> > >
> > > I’m using this example
> > >
> >
> http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
> > .html
> > >
> > >
> > >
> > > I encounter an issue if instead of using subplot I use add_axes
> > method to
> > > hand define where I want my plot.
> > >
> > > In this case blitting is no more working like if restore_region was
> > not
> > > restoring context…
> > >
> > >
> > >
> > > def __init__(self):
> > >
> > > FigureCanvas.__init__(self, Figure())
> > >
> > >
> > >
> > > #self.ax = self.figure.add_subplot(111)
> > >
> > > self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
> > >
> > >
> > >
> > > Any idea why in this case the example given is not working?
> > >
> > >
> > >
> > > Cheers,
> > >
> > > Laurent
> > >
> > > ---
> --
> > -
> > > Come build with us! The BlackBerry(R) Developer Conference in SF,
> CA
> > > is the only developer event you need to attend this year. Jumpstart
> > your
> > > developing skills, take BlackBerry mobile applications to market
> and
> > stay
> > > ahead of the curve. Join us from November 9 - 12, 2009. Register
> now!
> > > http://p.sf.net/sfu/devconference
> > > ___
> > > Matplotlib-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >
> > >
> ---
> ---
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
> your
> developing skills, take BlackBerry mobile applications to market and
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [Solved] Little issue with blitting technique

2009-10-13 Thread Laurent Dufréchou
Hey, coparing on how GTK2 example is done I've seen a difference between the 
two!

In QT4Agg example and WX example the code use:

canvas.copy_from_bbox(ax.bbox)
replacing all occurrence of ax.bbox with ax.get_figure().bbox solved all the 
issue I add.

Perhaps we should correct the examples.
I can send you the good working example if you want.

Cheers,
Laurent


> -Message d'origine-
> De : Laurent Dufrechou [mailto:[email protected]]
> Envoyé : mardi 13 octobre 2009 19:02
> À : Jae-Joon Lee
> Cc : [email protected]
> Objet : Re: [Matplotlib-users] Little issue with blitting technique
> 
> Hello,
> 
> I've tested so far with wx and QT4 backend.
> The two are buggy.
> Easy way to reproduce the bug (another way I mean)
> 
> ax = p.subplot(212)
> ax2 = p.subplot(211)
> 
> and the two backends got the same error.
> 
> Note that I'm under windows. I'll try under linux tonight just to
> check.
> I'll also try gtk backend as you suggest.
> 
> Update in next email :)
> 
> > -Message d'origine-
> > De : Jae-Joon Lee [mailto:[email protected]]
> > Envoyé : mardi 13 octobre 2009 18:36
> > À : Laurent Dufrechou
> > Cc : [email protected]
> > Objet : Re: [Matplotlib-users] Little issue with blitting technique
> >
> > I haven't tested it with qt4, but with gtk, add_axes DOES work.
> >
> > So, can you try other backends and see if they work?
> >
> > And, I believe that add_subplot -> add_axes is a only change you
> made?
> >
> > Unless the problem is persistent among other backends, I hope other
> > developers who use qt4 backend step in and help.
> >
> > Regards,
> >
> > -JJ
> >
> >
> > On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou
> >  wrote:
> > > Hello,
> > >
> > >
> > >
> > > I’ve just discovered blitting technique to improve performances.
> > >
> > > I’m using this example
> > >
> >
> http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
> > .html
> > >
> > >
> > >
> > > I encounter an issue if instead of using subplot I use add_axes
> > method to
> > > hand define where I want my plot.
> > >
> > > In this case blitting is no more working like if restore_region was
> > not
> > > restoring context…
> > >
> > >
> > >
> > > def __init__(self):
> > >
> > > FigureCanvas.__init__(self, Figure())
> > >
> > >
> > >
> > > #self.ax = self.figure.add_subplot(111)
> > >
> > > self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
> > >
> > >
> > >
> > > Any idea why in this case the example given is not working?
> > >
> > >
> > >
> > > Cheers,
> > >
> > > Laurent
> > >
> > > ---
> --
> > -
> > > Come build with us! The BlackBerry(R) Developer Conference in SF,
> CA
> > > is the only developer event you need to attend this year. Jumpstart
> > your
> > > developing skills, take BlackBerry mobile applications to market
> and
> > stay
> > > ahead of the curve. Join us from November 9 - 12, 2009. Register
> now!
> > > http://p.sf.net/sfu/devconference
> > > ___
> > > Matplotlib-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >
> > >
> ---
> ---
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
> your
> developing skills, take BlackBerry mobile applications to market and
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Solved] Little issue with blitting technique

2009-10-15 Thread Laurent Dufréchou
Hi Auré,

 

Taking this example (FPS is computed at the end of the loop each 100
frames):

(this is the same example as you but not using FileUtils10)

 



import sys

import pylab as p

import numpy as npy

import time

 

ax2 = p.subplot(212)

ax = p.subplot(211)

canvas = ax.figure.canvas

 

 

# create the initial line

x = npy.arange(0,2*npy.pi,0.01)

line, = p.plot(x, npy.sin(x), animated=True, lw=2)

 

def run(*args):

background = canvas.copy_from_bbox(ax.bbox)

# for profiling

tstart = time.time()

 

while 1:

# restore the clean slate background

canvas.restore_region(background)

# update the data

line.set_ydata(npy.sin(x+run.cnt/10.0))

# just draw the animated artist

ax.draw_artist(line)

# just redraw the axes rectangle

canvas.blit(ax.bbox)

 

if run.cnt==100:

# print the timing info and quit

print 'FPS:' , 100/(time.time()-tstart)

return

 

run.cnt += 1

run.cnt = 0

 

 

p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs

p.grid() # to ensure proper background restore

manager = p.get_current_fig_manager()

manager.window.after(100, run)

 

p.show()



 

This example will work on my machine @99FPS.

Now replace:

ax2 = p.subplot(212)

ax = p.subplot(211)

 

with:

ax = p.subplot(212)

ax2 = p.subplot(211)

 

The image is buggy because the blitting is no more working, still I get
86FPS. So let say no change.

 

Now replace “ax.bbox” with ”ax.get_figure().bbox”:

The bug disappear and I get a small 20 FPS…

 

Tested under windows vista , matplotlib 0.99.1, python 2.5.4.

 

Laurent

Ps: I think ax.getFigure().bbox is getting the whole picture so this is why
it is slower.

 

 

De : Auré Gourrier [mailto:[email protected]] 
Envoyé : jeudi 15 octobre 2009 10:32
À : [email protected]
Objet : Re: [Matplotlib-users] [Solved] Little issue with blitting technique

 

>On Tue, Oct 13, 2009 at 5:06 PM, Laurent Dufr?chou

> wrote:
>> Hey, coparing on how GTK2 example is done I've seen a difference between
the two!
>>
>> In QT4Agg example and WX example the code use:
>>
>> canvas.copy_from_bbox(ax.bbox)
>> replacing all occurrence of ax.bbox with ax.get_figure().bbox solved all
the issue I add.
>>
>
>I'm not sure why using ax.bbox does not work, and it SHOULD work.
>Note that animation_blit_gtk.py DOES use ax.bbox.
>
>> Perhaps we should correct the examples.
>> I can send you the good working example if you want.
>
>If using ax.bbox does not work, than it is a bug (either mpl or the
example).
>Unfortunately, this seems to happen only on windows.
>So, please file a bug report (again).
>
>Regards,
>
>-JJ
>

Hy guys,

Just saw your posts. I don't understand the business with the
ax.get_figure().bbox.
I'm also using windows, and a modified version of the animation_blit_tk.py
using imshow work fine for me.
I just checked whether the get_figure() changes anything and I get exactly
the same result in terms of performance.
I attach the code below if it can be of any use.

Cheers,

Auré


# For detailed comments on animation and the techniqes used here, see
# the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations

import matplotlib
matplotlib.use('TkAgg')

import sys
import pylab as p
import matplotlib.numerix as nx
import time

from FileUtils10 import fileHandling

# for profiling
tstart = time.time()
tprevious = time.time()

fnamelist = ['']

ax = p.subplot(111)
canvas = ax.figure.canvas

print 't1 ',time.time()-tprevious
tprevious = time.time()

# create the initial line
dataarr = fileHandling(fnamelist[0]).read()
#print dataarr.dtype
#dataarr = dataarr.astype('uint8')
print 't2 ',time.time()-tprevious
tprevious = time.time()

image = p.imshow(dataarr, animated=True)
print 't3 ',time.time()-tprevious
tprevious = time.time()

def run(*args):
tprevious = time.time()
background = canvas.copy_from_bbox(ax.bbox)
print 't4 ',time.time()-tprevious
tprevious = time.time()
while 1:
#print fnamelist[run.cnt]
# restore the clean slate background
canvas.restore_region(background)
print 't5 ',time.time()-tprevious
tprevious = time.time()
# update the data
dataarr = fileHandling(fnamelist[run.cnt]).readMCCD()
dataarr *= run.cnt
print 't6 ',time.time()-tprevious
tprevious = time.time()
image.set_data(dataarr)
print 't7 ',time.time()-tprevious
tprevious = time.time()
# just draw the animated artist
ax.draw_artist(image)
print 't8 ',time.

Re: [Matplotlib-users] Little issue with blitting technique

2009-10-16 Thread Laurent Dufrechou
Bug reported:

https://sourceforge.net/tracker/index.php?func=detail&aid=2880692&group_id=80706&atid=560720

Does anybody where I could dig a little to try to correct it?
It a really needed feature for me, so if I could help...

Cheers,
Laurent

> -Message d'origine-
> De : Jae-Joon Lee [mailto:[email protected]]
> Envoyé : jeudi 15 octobre 2009 05:23
> À : Laurent Dufrechou
> Cc : [email protected]
> Objet : Re: [Matplotlib-users] Little issue with blitting technique
> 
> On Tue, Oct 13, 2009 at 1:02 PM, Laurent Dufrechou
>  wrote:
> > Hello,
> >
> > I've tested so far with wx and QT4 backend.
> > The two are buggy.
> > Easy way to reproduce the bug (another way I mean)
> >
> > ax = p.subplot(212)
> > ax2 = p.subplot(211)
> >
> 
> On mac with wxgtk, it works fine.
> Maybe this is an windows only issue.
> 
> > and the two backends got the same error.
> 
> Since nobody steped in, and I don't use windows, can you file a bug
> report.
> 
> http://sourceforge.net/tracker/?atid=560720&group_id=80706&func=browse
> 
> Please provide a short, complete example that reproduces the bug. Also
> the error message you get.
> 
> -JJ
> 
> 
> >
> > Note that I'm under windows. I'll try under linux tonight just to
> check.
> > I'll also try gtk backend as you suggest.
> >
> > Update in next email :)
> >
> >> -Message d'origine-
> >> De : Jae-Joon Lee [mailto:[email protected]]
> >> Envoyé : mardi 13 octobre 2009 18:36
> >> À : Laurent Dufrechou
> >> Cc : [email protected]
> >> Objet : Re: [Matplotlib-users] Little issue with blitting technique
> >>
> >> I haven't tested it with qt4, but with gtk, add_axes DOES work.
> >>
> >> So, can you try other backends and see if they work?
> >>
> >> And, I believe that add_subplot -> add_axes is a only change you
> made?
> >>
> >> Unless the problem is persistent among other backends, I hope other
> >> developers who use qt4 backend step in and help.
> >>
> >> Regards,
> >>
> >> -JJ
> >>
> >>
> >> On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou
> >>  wrote:
> >> > Hello,
> >> >
> >> >
> >> >
> >> > I’ve just discovered blitting technique to improve performances.
> >> >
> >> > I’m using this example
> >> >
> >>
> http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
> >> .html
> >> >
> >> >
> >> >
> >> > I encounter an issue if instead of using subplot I use add_axes
> >> method to
> >> > hand define where I want my plot.
> >> >
> >> > In this case blitting is no more working like if restore_region
> was
> >> not
> >> > restoring context…
> >> >
> >> >
> >> >
> >> > def __init__(self):
> >> >
> >> >     FigureCanvas.__init__(self, Figure())
> >> >
> >> >
> >> >
> >> >     #self.ax = self.figure.add_subplot(111)
> >> >
> >> >     self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
> >> >
> >> >
> >> >
> >> > Any idea why in this case the example given is not working?
> >> >
> >> >
> >> >
> >> > Cheers,
> >> >
> >> > Laurent
> >> >
> >> > --
> ---
> >> -
> >> > Come build with us! The BlackBerry(R) Developer Conference in SF,
> CA
> >> > is the only developer event you need to attend this year.
> Jumpstart
> >> your
> >> > developing skills, take BlackBerry mobile applications to market
> and
> >> stay
> >> > ahead of the curve. Join us from November 9 - 12, 2009. Register
> now!
> >> > http://p.sf.net/sfu/devconference
> >> > ___
> >> > Matplotlib-users mailing list
> >> > [email protected]
> >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> >
> >> >
> >
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] TR: Cleaver way to do a scrolling imshow?

2009-10-16 Thread Laurent Dufrechou
Hello,

I'm investigating a way to make a sort of imshow that is scrolling from
right to left.

My idea is to copy in a blit buffer from (1,0) to (xmax,ymax).

Blit it @(0,0) (xmax-1,ymax)

And then draw a cmap'ed line @x=xmax.

 

So here are my question:

 

How to draw a line that use a cmap=jet (for example)?

I've taken a look at Line2D but it has no cmap argument. The only thing I've
found is drawing a line with only one color.

 

Any idea appreciated!

 

Cheers,

Laurent

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Cleaver way to do a scrolling imshow?

2009-10-16 Thread Laurent Dufrechou
Hello,

I'm investigating a way to make a sort of imshow that is scrolling from
right to left.

My idea is to copy in a blit buffer from (1,0) to (xmax,ymax).

Blit it @(0,0) (xmax-1,ymax)

And then draw a cmap'ed line @x=xmax.

 

So here are my question:

 

How to draw a line that use a cmap=jet (for example)?

I've taken a look at Line2D but it has no cmap argument. The only thing
I've found is drawing a line with only one color...

 

Any idea appreciated!

 

Cheers,

Laurent

 

 

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Little issue with blitting

2009-10-24 Thread Laurent Dufréchou
Hello Auré and  Jae-joon,

Hi all,

 

First thx for you help.

I’ve taken your example, modified a little to use QT loop. (it was not
working on my machine manager.window.after(100, run) was unknown)

 

The bad thing is that first it didn’t work BUT I’ve almost found why.

 

If I call two times blit only one figure was drawn L

First I’ve tried to compute a bbox myself that was the size of the addition
of two figures bbox.

It worked.

 

Next I modified the Qtimer from 0 to 100.

And it worked (slower) but it worked.

 

So there is something missing like an event not posted or something like
this.

 

Any GUI guru help welcomed, I’ll dig this further, but I think something is
missing there.

Perhaps I should force a repaint of the widget immediately?

 

Anyway, I’m near the end J

 

Cheers, 

Laurent

 

 

 

De : Auré Gourrier [mailto:[email protected]] 
Envoyé : mercredi 21 octobre 2009 13:55
À : [email protected]
Cc : Laurent Dufr?chou
Objet : Re : Re: Little issue with blitting

 

Hi Laurent,

I think I might have found a way to solve your problem: instead of creating
your axes using pylab.suplot, you should create the axes using the class
way. I modified your code below and it works fine without loosing speed in
the frame rate. Only thing is, I have no clue as to what is really the
underlying problem... my best guess is that there is a conflict between
pylab and the general class. I very rearely use pylab directly unless the
problem is really simple, because I saw several posts mentioning possible
conflicts.

Hope this helps you.

Cheers,

Aurélien

-
import sys
import pylab as p
import matplotlib as mpl
import numpy as npy
import time

 
fig = p.figure(figsize=(8.,4.))

#ax = p.subplot(212)
ax = fig.add_axes((.05,.55,.9,.4))
#ax2 = p.subplot(211)
ax2 = fig.add_axes((.05,.05,.9,.4))

canvas = ax.figure.canvas

# create the initial line
x = npy.arange(0,2*npy.pi,0.01)
#line, = p.plot(x, npy.sin(x), animated=True, lw=2)
line, = ax.plot(x, npy.sin(x), animated=True, lw=2)
line2, = ax2.plot(x, npy.cos(x), animated=True, lw=2)

def run(*args):

background = canvas.copy_from_bbox(ax.bbox)
background2 = canvas.copy_from_bbox(ax2.bbox)

# for profiling
tstart = time.time()
while 1:

# restore the clean slate background
canvas.restore_region(background)
canvas.restore_region(background2)

# update the data
line.set_ydata(npy.sin(x+run.cnt/10.0))
line2.set_ydata(npy.cos(x+run.cnt/10.0))

# just draw the animated artist
ax.draw_artist(line)
ax2.draw_artist(line2)

# just redraw the axes rectangle
canvas.blit(ax.bbox)
canvas.blit(ax2.bbox)
#canvas.blit(ax.get_figure().bbox) 

if run.cnt==100:

# print the timing info and quit
print 'FPS:' , 100/(time.time()-tstart)

#return
sys.exit() 

run.cnt += 1

run.cnt = 0

#no need for the following since it is done directly when creating the axes
#p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs

#p.grid() # to ensure proper background restore
ax.grid() # to ensure proper background restore
ax2.grid() # to ensure proper background restore

manager = p.get_current_fig_manager()

manager.window.after(100, run)

p.show()






--

Message: 2
Date: Thu, 15 Oct 2009 18:40:22 +0200
From: Laurent Dufr?chou 
Subject: Re: [Matplotlib-users] [Solved] Little issue with blitting
technique
To: 'Aur? Gourrier' ,

Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi Aur?,



Taking this example (FPS is computed at the end of the loop each 100
frames):

(this is the same example as you but not using FileUtils10)





import sys

import pylab as p

import numpy as npy

import time



ax2 = p.subplot(212)

ax = p.subplot(211)

canvas = ax.figure.canvas





# create the initial line

x = npy.arange(0,2*npy.pi,0.01)

line, = p.plot(x, npy.sin(x), animated=True, lw=2)



def run(*args):

background = canvas.copy_from_bbox(ax.bbox)

# for profiling

tstart = time.time()



while 1:

# restore the clean slate background

canvas.restore_region(background)

# update the data

line.set_ydata(npy.sin(x+run.cnt/10.0))

# just draw the animated artist

ax.draw_artist(line)

# just redraw the axes rectangle

canvas.blit(ax.bbox)



if run.cnt==100:

# print the timing info and quit

print 'FPS:' , 100/(time.time()-tstart)

return



run.cnt += 1

run.cnt = 0





p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs

p.grid() # to ensure proper background restore

manager = p.get_current_fig_manag

Re: [Matplotlib-users] Little issue with blitting

2009-10-24 Thread Laurent Dufréchou
Ha, ok finally i’ve solved the issue.

In fact each time you call blit method you must force a repaint.

This what v4 does.

 

I’ve also removed self.repaint() in my script and modified backend_qt4agg:

 

def blit(self, bbox=None):

"""

Blit the region in bbox

"""

 

self.replot = bbox

l, b, w, h = bbox.bounds

t = b + h

#self.update(l, self.renderer.height-t, w, h) ß before

self.repaint(l, self.renderer.height-t, w, h)

 

And it work like a charm.

 

I got 72 FPS that it way better than the old 7 FPS I go without blitting.

 

I’m not sure it is the ideal solution.

 

Any thought?

 

Laurent

 

De : Auré Gourrier [mailto:[email protected]] 
Envoyé : mercredi 21 octobre 2009 13:55
À : [email protected]
Cc : Laurent Dufr?chou
Objet : Re : Re: Little issue with blitting

 

Hi Laurent,

I think I might have found a way to solve your problem: instead of creating
your axes using pylab.suplot, you should create the axes using the class
way. I modified your code below and it works fine without loosing speed in
the frame rate. Only thing is, I have no clue as to what is really the
underlying problem... my best guess is that there is a conflict between
pylab and the general class. I very rearely use pylab directly unless the
problem is really simple, because I saw several posts mentioning possible
conflicts.

Hope this helps you.

Cheers,

Aurélien

-
import sys
import pylab as p
import matplotlib as mpl
import numpy as npy
import time

 
fig = p.figure(figsize=(8.,4.))

#ax = p.subplot(212)
ax = fig.add_axes((.05,.55,.9,.4))
#ax2 = p.subplot(211)
ax2 = fig.add_axes((.05,.05,.9,.4))

canvas = ax.figure.canvas

# create the initial line
x = npy.arange(0,2*npy.pi,0.01)
#line, = p.plot(x, npy.sin(x), animated=True, lw=2)
line, = ax.plot(x, npy.sin(x), animated=True, lw=2)
line2, = ax2.plot(x, npy.cos(x), animated=True, lw=2)

def run(*args):

background = canvas.copy_from_bbox(ax.bbox)
background2 = canvas.copy_from_bbox(ax2.bbox)

# for profiling
tstart = time.time()
while 1:

# restore the clean slate background
canvas.restore_region(background)
canvas.restore_region(background2)

# update the data
line.set_ydata(npy.sin(x+run.cnt/10.0))
line2.set_ydata(npy.cos(x+run.cnt/10.0))

# just draw the animated artist
ax.draw_artist(line)
ax2.draw_artist(line2)

# just redraw the axes rectangle
canvas.blit(ax.bbox)
canvas.blit(ax2.bbox)
#canvas.blit(ax.get_figure().bbox) 

if run.cnt==100:

# print the timing info and quit
print 'FPS:' , 100/(time.time()-tstart)

#return
sys.exit() 

run.cnt += 1

run.cnt = 0

#no need for the following since it is done directly when creating the axes
#p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs

#p.grid() # to ensure proper background restore
ax.grid() # to ensure proper background restore
ax2.grid() # to ensure proper background restore

manager = p.get_current_fig_manager()

manager.window.after(100, run)

p.show()






--

Message: 2
Date: Thu, 15 Oct 2009 18:40:22 +0200
From: Laurent Dufr?chou 
Subject: Re: [Matplotlib-users] [Solved] Little issue with blitting
technique
To: 'Aur? Gourrier' ,

Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi Aur?,



Taking this example (FPS is computed at the end of the loop each 100
frames):

(this is the same example as you but not using FileUtils10)





import sys

import pylab as p

import numpy as npy

import time



ax2 = p.subplot(212)

ax = p.subplot(211)

canvas = ax.figure.canvas





# create the initial line

x = npy.arange(0,2*npy.pi,0.01)

line, = p.plot(x, npy.sin(x), animated=True, lw=2)



def run(*args):

background = canvas.copy_from_bbox(ax.bbox)

# for profiling

tstart = time.time()



while 1:

# restore the clean slate background

canvas.restore_region(background)

# update the data

line.set_ydata(npy.sin(x+run.cnt/10.0))

# just draw the animated artist

ax.draw_artist(line)

# just redraw the axes rectangle

canvas.blit(ax.bbox)



if run.cnt==100:

# print the timing info and quit

print 'FPS:' , 100/(time.time()-tstart)

return



run.cnt += 1

run.cnt = 0





p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs

p.grid() # to ensure proper background restore

manager = p.get_current_fig_manager()

manager.window.after(100, run)



p.show()





This example will work on my machine @99FPS.

Now 

Re: [Matplotlib-users] set figure position

2009-11-22 Thread Laurent Dufrechou
Hi marie,

You can define exactly the size and position of your plot like this:

fig = Figure()
axe = fig.add_axes([pos_x,pos_y,size_x,size_y])
axe.plot(x, y, 'b')

where pos_x,pos_y is a number (0mailto:[email protected]] 
Envoyé : dimanche 22 novembre 2009 18:05
À : [email protected]
Objet : [Matplotlib-users] set figure position

We have recently switched to matplotlib after having done all plotting with
pure wxPython for years.

There is one problem we cannot solve. With wxPython we are free to set the
geometry (position and size) of each Frame anywhere on the screen. We have
developed a heuristic solution which packs the Frames automatically
according to a pattern that can be recognized after a user has manually
repositioned a few Frames on the screen. For example, some users tend to
align their figures in a row, others subdivide the available space for
different groups of figures, and so on. Please let us know if anyone is
interested to integrate this heuristic packing into matplotlib.

The important question is:
How can we set the position of a Figure on the screen using matplotlib?
There is a function Figure.set_size_inches, but no function to move the
Figure to a new position. Please help.

Regards,
Marie


__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
gegen Massenmails. 
http://mail.yahoo.com 



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Bliting speed improvment patch (QT4Agg backend) + example of sliding demo

2009-11-30 Thread Laurent Dufrechou
Hi there,

Finally with lot of try I've finally managed to make blitting of a cmap
working.
I've also patched QT4agg backend, to make a redraw immediately.
(replaced self.draw by self.repaint)
In my current project I was able to stream a 655KB network stream, do
demodulation of an IQ stream and display the spectrogram in real time (4096
pixel per 1024) with matplotlib and QT4 backend, thx to the patch + blitting
example attached.

Without patch, the refrech was veeery long. (waiting for QT loop to execute
code wen it wanted.)
And do NOT always work. If you've got a powerfull pc you've got chance to
see only white background...
(or simply the loop timer to 0, you will see that without patch blit does
not work).

Only tested under windows currently, 'cause my project is on windows
currently...

There is one bug in the example, that I didn't manage to correct yet.
Depending on screen resolution, the color of the cmap blitted area can be
kind of alpha'ed. (that is look like a little bit transparent...) , Any idea
on the root of this issue?

By the way to make the example work I needed to do this:
self.ax2.draw_artist(self.line2)
self.blit(self.ax2.bbox)
self.restore_region(self.background2)

that is blit before restore... don't understand why yet.

Any comment welcomed.

Is there any chance, after review, to find a way to include this in main
trunk?
What do think about this?

Cheers,
Laurent
"""
Render to qt from agg
"""
from __future__ import division

import os, sys

import matplotlib
from matplotlib.figure import Figure

from backend_agg import FigureCanvasAgg
from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
 show, draw_if_interactive, backend_version, \
 NavigationToolbar2QT

DEBUG = False


def new_figure_manager( num, *args, **kwargs ):
"""
Create a new figure manager instance
"""
if DEBUG: print 'backend_qtagg.new_figure_manager'
FigureClass = kwargs.pop('FigureClass', Figure)
thisFig = FigureClass( *args, **kwargs )
canvas = FigureCanvasQTAgg( thisFig )
return FigureManagerQT( canvas, num )

class NavigationToolbar2QTAgg(NavigationToolbar2QT):
def _get_canvas(self, fig):
return FigureCanvasQTAgg(fig)

class FigureManagerQTAgg(FigureManagerQT):
def _get_toolbar(self, canvas, parent):
# must be inited after the window, drawingArea and figure
# attrs are set
if matplotlib.rcParams['toolbar']=='classic':
print "Classic toolbar is not supported"
elif matplotlib.rcParams['toolbar']=='toolbar2':
toolbar = NavigationToolbar2QTAgg(canvas, parent)
else:
toolbar = None
return toolbar

class FigureCanvasQTAgg( FigureCanvasQT, FigureCanvasAgg ):
"""
The canvas the figure renders into.  Calls the draw and print fig
methods, creates the renderers, etc...

Public attribute

  figure - A Figure instance
   """

def __init__( self, figure ):
if DEBUG: print 'FigureCanvasQtAgg: ', figure
FigureCanvasQT.__init__( self, figure )
FigureCanvasAgg.__init__( self, figure )
self.drawRect = False
self.rect = []
self.replot = True
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)

def drawRectangle( self, rect ):
self.rect = rect
self.drawRect = True
self.repaint( )

def paintEvent( self, e ):
"""
Draw to the Agg backend and then copy the image to the qt.drawable.
In Qt, all drawing should be done inside of here when a widget is
shown onscreen.
"""

#FigureCanvasQT.paintEvent( self, e )
if DEBUG: print 'FigureCanvasQtAgg.paintEvent: ', self, \
   self.get_width_height()

# only replot data when needed
if type(self.replot) is bool: # might be a bbox for blitting
if self.replot:
FigureCanvasAgg.draw(self)

# matplotlib is in rgba byte order.  QImage wants to put the bytes
# into argb format and is in a 4 byte unsigned int.  Little endian
# system is LSB first and expects the bytes in reverse order
# (bgra).
if QtCore.QSysInfo.ByteOrder == QtCore.QSysInfo.LittleEndian:
stringBuffer = self.renderer._renderer.tostring_bgra()
else:
stringBuffer = self.renderer._renderer.tostring_argb()

qImage = QtGui.QImage(stringBuffer, self.renderer.width,
  self.renderer.height,
  QtGui.QImage.Format_ARGB32)
p = QtGui.QPainter(self)
p.drawPixmap(QtCore.QPoint(0, 0), QtGui.QPixmap.fromImage(qImage

Re: [Matplotlib-users] Colorbar embedding in qt4

2010-01-03 Thread Laurent Dufrechou
Hello,

You are using the TK backend.
Add this at the top of your script:

import matplotlib
matplotlib.use('QT4Agg')

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as
NavigationToolbar

Should work.
(Or at least will no more show errors related to TK backend...)

Laurent
--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev ___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Colorbar embedding in qt4

2010-01-07 Thread Laurent Dufrechou
Hi alexander,

 

I tryed yesterday to play a little with your script.

I suspect that in fact each time you draw a figure, it is added to a pool of
figure to be rendered.

Thus it goes slower and slower.

 

What I do in my scritpt is either update the datas or if the drawing is a
completely new one (like a polar ionstaed of log previously) I delete the
figure.

 

To update data use:

 

1/self._plot, = axe.plot(x, y, 'b', animated=self._animated)

 

Later:

Loop:

2/self._plot.set_ydata(self._value)



 

If you need to delete your figure (that is not your case, but who knows for
the future):

axe = fig.add_axes(self.getPosition())

…

self._fig.delaxes(self._axe)



To go even faster(x10) you have the blitting method, but set_ydata should be
sufficent.

 

Laurent

 

De : Alexander Hupfer [mailto:[email protected]] 
Envoyé : jeudi 7 janvier 2010 03:36
Cc : [email protected]
Objet : Re: [Matplotlib-users] Colorbar embedding in qt4

 

I isolated the problem a bit more. For some reason drawing gets slower and
slower with each plot drawn.

from os import sys
from time import time
from PyQt4 import QtGui, QtCore

import matplotlib

matplotlib.use('QT4Agg')

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
FigureCanvas
from matplotlib.figure import Figure


class MyMplCanvas(FigureCanvas):
"""Ultimately, this is a QWidget (as well as a FigureCanvasAgg,
etc.)."""
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
self.axes = fig.add_subplot(111)
# We want the axes cleared every time plot() is called
self.axes.hold(False)

self.compute_initial_figure()

#
FigureCanvas.__init__(self, fig)
self.setParent(parent)

FigureCanvas.setSizePolicy(self,
   QtGui.QSizePolicy.Expanding,
   QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)

def compute_initial_figure(self):
pass

class MyDynamicMplCanvas(MyMplCanvas):
"""A canvas that updates itself every second with a new plot."""
def __init__(self, *args, **kwargs):
MyMplCanvas.__init__(self, *args, **kwargs)
timer = QtCore.QTimer(self)
QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"),
self.update_figure)
timer.start(0)
self.firstrun = True
self.colorbar = None
self.time = time()
self.p = None
def compute_initial_figure(self):
pass

def update_figure(self):
self.p = self.axes.scatter([1,2,3],[4,5,6], c = range(3),
animated=True)
self.axes.set_xlabel('psi')
self.axes.set_ylabel('delta')
if self.firstrun == True:
self.colorbar = self.axes.figure.colorbar(self.p)
self.firstrun = False
self.colorbar.set_clim(vmin=0,vmax=2) 
self.colorbar.draw_all()
self.colorbar.set_label('time [abtr. ]')
self.draw()
newtime = time()
print newtime - self.time
self.time = newtime

class ApplicationWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

self.main_widget = QtGui.QWidget(self)

l = QtGui.QVBoxLayout(self.main_widget)

dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4,
dpi=100)

l.addWidget(dc)

self.main_widget.setFocus()
self.setCentralWidget(self.main_widget)


qApp = QtGui.QApplication(sys.argv)

aw = ApplicationWindow()
aw.setWindowTitle("%s" % "Slow!")
aw.setGeometry(100,100,800,600)
aw.show()
sys.exit(qApp.exec_())

On Mon, Jan 4, 2010 at 3:36 PM, Alexander Hupfer  wrote:

Ok, here is the code as a whole. I think it's still short enough to
ilustrate the problem. Just start it with the datafile "elips" as an
argument

http://dl.dropbox.com/u/226980/elipsometry.tar.gz

The timer shows how long each render cycle takes. The time seems to grow
with number of cycles rendered even when no more points are added (the
points are calculated with a continous rate in a background thread and are
about 300 total).

 

On Sun, Jan 3, 2010 at 8:16 PM, John Hunter  wrote:

On Sun, Jan 3, 2010 at 7:02 PM, Alexander Hupfer  wrote:
> Thanks I got it fixed.
> This leads to the follow up question:
> What is the right way to keep an application responsive while the graph is
> drawn?
> Drawing a scatter plot with 300 points seems to take a while. I guess I
need
> to launch the drawing in another thread but don't know exactly how to do
> this and only find examples of doing calculations in the background and
not
> actual widget interaction.

You posted some real code 

[Matplotlib-users] best way to produce many charts

2008-07-02 Thread laurent oget
I am using matplotlib to produce a big number(16000) of charts and am facing
a steady memory leak. my code sofar looks like:

while(1):
fig=PL.figure(1)
..plot some things..
fig.clf()
PL.close()


am i missing something?

Laurent
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problem with wxAgg toolbar and py2exe

2008-07-07 Thread Laurent Dufrechou
Hello,

I've recently used the toolbar from wxAgg backend:

from matplotlib.backends.backend_wx import NavigationToolbar2Wx

 

I've got a problem when trying to freeze my app now because I get this
message when trying to invoke the toolbar:

 

Traceback (most recent call last):

  File "CommandPanel.pyo", line 80, in OnOpenFile

  File "AnalystPanel.pyo", line 33, in addPanel

  File "Filter.pyo", line 50, in createWidget

  File "A1Filter.pyo", line 70, in fillWidget

  File "matplotlib\backends\backend_wx.pyo", line 1548, in __init__

  File "matplotlib\backend_bases.pyo", line 1524, in __init__

  File "matplotlib\backends\backend_wx.pyo", line 1570, in _init_toolbar

  File "matplotlib\backends\backend_wx.pyo", line 1405, in _load_bitmap

IOError: Could not find bitmap file "mpl-data\images\home.png"; dying

 

It is really strange because I've put this in my setup.py:

import matplotlib

data_files = matplotlib.get_py2exe_datafiles()

 

So there is a directory mpl-data/images so should work.

(other files are well found like fonts etc.)

Any guys has had this issue? (Matplotlib 0.98.1)

 

Laurent

 

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] twinx memory leak

2008-07-11 Thread laurent oget
I think i narrowed down the memory leak i have been chasing for a while.
If i remove the call to twinx i get a slow leak, which would cause me
trouble
after a very long time. With the call to  twinx, however i am losing
thousands of objects
at each loop.

Thanks,

Laurent


>>>>>>>>>>>>>>>>>>>>>>>>>
import pylab as PL
def looptest():
while(1):
fig=PL.figure(1)
ax=fig.add_subplot(211)
ax.set_position((0,0,0.9,0.45))
ax1=PL.twinx(ax)
t=range(1000)
st=[math.sin(x*0.01) for x in t]
ax.plot(t,st)
fig.clf()
PL.close(1)
gc.collect()
print "GC"
print len(gc.get_objects())
print len(gc.garbage)
looptest()
>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] twinx memory leak

2008-07-11 Thread laurent oget
i forgot two imports.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
import math
import gc
import pylab as PL


def looptest():
while(1):
fig=PL.figure(1)
ax=fig.add_subplot(211)
ax.set_position((0,0,0.9,0.45))
ax1=PL.twinx(ax)
t=range(1000)
st=[math.sin(x*0.01) for x in t]
ax.plot(t,st)
fig.clf()
PL.close(1)
gc.collect()
print "GC"
print len(gc.get_objects())
print len(gc.garbage)
looptest()
>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2008/7/11 laurent oget <[EMAIL PROTECTED]>:

> I think i narrowed down the memory leak i have been chasing for a while.
> If i remove the call to twinx i get a slow leak, which would cause me
> trouble
> after a very long time. With the call to  twinx, however i am losing
> thousands of objects
> at each loop.
>
> Thanks,
>
> Laurent
>
>
> >>>>>>>>>>>>>>>>>>>>>>>>>
> import pylab as PL
> def looptest():
> while(1):
> fig=PL.figure(1)
> ax=fig.add_subplot(211)
> ax.set_position((0,0,0.9,0.45))
> ax1=PL.twinx(ax)
> t=range(1000)
> st=[math.sin(x*0.01) for x in t]
> ax.plot(t,st)
> fig.clf()
> PL.close(1)
> gc.collect()
> print "GC"
> print len(gc.get_objects())
> print len(gc.garbage)
> looptest()
> >>>>>>>>>>>>>>>>>>>>>>>>>>>
>
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] twinx memory leak

2008-07-15 Thread laurent oget
I am puzzled. Wasn't the whole point of close() to avoid memory leaks?

Laurent

2008/7/15 Michael Droettboom <[EMAIL PROTECTED]>:

> Yes, as of r5747 twinx (well, shared axes specifically) no longer leaks.
>
> Manuel has discovered a seemingly generic leak that occurs when
> pyplot.close() is called and running a GUI backend.  I can confirm his
> results with the script he last sent.
>
> Cheers,
> Mike
>
> Manuel Metz wrote:
> > John Hunter wrote:
> >> On Mon, Jul 14, 2008 at 3:05 PM, Michael Droettboom <[EMAIL PROTECTED]>
> >> wrote:
> >>> I can confirm this.
> >>>
> >>> Commenting out "del Gcf.figs[num]" in Gcf.destroy (in
> >>> _pylab_helpers.py)
> >>> also seems to resolve the leak.  But I have no idea why, so I won't
> >>> commit it just yet.  I don't have much time to look deeper now.  Does
> >>> anyone (who probably understands figure management better than me) have
> >>> an idea what might cause this?
> >>
> >> Can you post the script you are using to test -- I am a little
> >> confused from reading this thread by whether or not twinx is
> >> implicated.  Also, I saw that you committed some changes vis-a-vis the
> >> twinx leak
> >>
> >>   r5747 | mdboom | 2008-07-11 13:21:53 -0500 (Fri, 11 Jul 2008) | 2
> >> lines
> >>
> >>   Fix memory leak when using shared axes.
> >>
> >> so I thought that part was resolved already...
> >>
> >> JDH
> >
> > I use a modified version of the script Laurent Oget posted (see
> > attachment). Here is the output if I don't comment out PL.close(1).
> >
> > ~/python/test$ python looptest.py -dGTK
> > 0 GC 69354 69354 0 13854
> > 100 GC 84354 150 0 15163
> > 200 GC 99354 150 0 16306
> > 300 GC 114354 150 0 17364
> > 400 GC 129354 150 0 18576
> > ~/python/test$ python looptest.py -dTK
> > 0 GC 69521 69521 0 14065
> > 100 GC 84521 150 0 15444
> > 200 GC 99521 150 0 16581
> > 300 GC 114521 150 0 17719
> > 400 GC 129521 150 0 18715
> > ~/python/test$ python looptest.py -dPS
> > 0 GC 59307 59307 0 7705
> > 100 GC 59307 0 0 8037
> > 200 GC 59307 0 0 8038
> > 300 GC 59307 0 0 8038
> > 400 GC 59307 0 0 8038
> >
> > (so for the window-less backend PS no objects are left)
> >
> > And now I commented out the line PL.close(1):
> >
> > ~/python/test$ python looptest.py -dGTK
> > 0 GC 69379 69379 0 13855
> > 100 GC 69379 0 0 14253
> > 200 GC 69379 0 0 14253
> > 300 GC 69379 0 0 14253
> > 400 GC 69379 0 0 14252
> >
> > Manuel
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Colormap cluttering?

2008-07-28 Thread Laurent Dufrechou
Hello,

 

I would like to have a cluttering functionality to colorbar.

http://en.wikipedia.org/wiki/Clutter_(radar)

 

Before writing it, I would like to know if there is a way to doing it with
matplotlib.

What I mean by cluttering is:

 

You've got a colormap associated with a graphic where value goes from 0 to
255 for example.

Assigning a classical colormap (for example cm.jet) 0 value will be blue and
255 one will be red.

What I need is a low  clutter and max clutter, if I set low clutter to 10
and ax cluter to 250 then:

Blue will be for value from 0 to 10

Then the colormap do his job from 10 to 250 and finally 

>From 250 to 255 colr will be set to max one = red.

 

Is it ever done in matplotlib, if not what could be the strategy here.?

I was thinking of set_over/set_under but seems not be exactly what I need
because I want to recreate the colormap from 10 to 250 with N segments.

(moreover I don't understand how you set the over/under value.)

 

Laurent

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Colormap cluttering?

2008-07-29 Thread Laurent Dufréchou
Hi andrew, eric,

Excellent that is exactly what I was looking for :)

Laurent

> -Message d'origine-
> De : Eric Firing [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 29 juillet 2008 02:39
> À : Laurent Dufrechou
> Cc : [email protected]
> Objet : Re: [Matplotlib-users] Colormap cluttering?
> 
> Laurent Dufrechou wrote:
> > Hello,
> >
> >
> >
> > I would like to have a cluttering functionality to colorbar.
> >
> > http://en.wikipedia.org/wiki/Clutter_(radar)
> >
> >
> >
> > Before writing it, I would like to know if there is a way to doing it
> > with matplotlib.
> >
> > What I mean by cluttering is:
> >
> >
> >
> > You’ve got a colormap associated with a graphic where value goes from
> 0
> > to 255 for example.
> >
> > Assigning a classical colormap (for example cm.jet) 0 value will be
> blue
> > and 255 one will be red.
> >
> > What I need is a low  clutter and max clutter, if I set low clutter
> to
> > 10 and ax cluter to 250 then:
> >
> > Blue will be for value from 0 to 10
> >
> > Then the colormap do his job from 10 to 250 and finally
> >
> >  From 250 to 255 colr will be set to max one = red.
> >
> >
> >
> > Is it ever done in matplotlib, if not what could be the strategy
> here…?
> >
> > I was thinking of set_over/set_under but seems not be exactly what I
> > need because I want to recreate the colormap from 10 to 250 with N
> segments.
> >
> > (moreover I don’t understand how you set the over/under value…)
> 
> If you don't really care how many colors are in the map, then for your
> 0-255 example, try this:
> 
> import numpy as np
> import matplotlib.pyplot as plt
> fakedata = np.random.rand(10,20) * 255.0
> cmap = plt.cm.jet
> norm = plt.Normalize(vmin=100, vmax=150)
> plt.imshow(fakedata, cmap=cmap, norm=norm, interpolation="nearest")
> plt.colorbar(extend="both")
> plt.show()
> 
> I made the colored range small to emphasize what you call the
> "cluttering" effect.
> 
> We are taking advantage of the default, which is that the over and
> under
> values are the top and bottom ends of the colormap.  If you want other
> colors for the ends, then after defining your cmap, use, e.g.:
> 
> cmap.set_under('w')
> cmap.set_over('k')
> 
> If you want to use a smaller number of colors in your colormap, then
> you
> need to make the colormap this way, for example:
> 
> from matplotlib.colors import LinearSegmentedColormap
> from matplotlib._cm import _jet_data
> cmap = LinearSegmentedColormap("yourname", _jet_data, N=10)
> 
> (I should add a helper function to make this more obvious and
> straightforward.)
> 
> Eric


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] imshow update norm make my app crash.

2008-07-29 Thread Laurent Dufrechou
Hi guys, continuing exploring matplotlib capabilities J

 

I've applied the idea you've said later about colormap.

Now I would like on an event to refresh my view so I've written this code:

 

   .

 

   def InitCode(self):

.

self.norm = plt.Normalize(vmin=0, vmax=255)

self.cmap = cm.jet

im_full = full_sonar.imshow( z, aspect= 'auto', cmap=self.cmap,
norm=self.norm, interpolation='quadric')

im_zoom = zoomed_sonar.imshow( z, aspect= 'auto',cmap=self.cmap,
norm=self.norm, interpolation='quadric')

 
self.fig.colorbar(im_full,cax=cax,orientation='vertical',extend='both')

self.im_full = im_full

self.im_zoom = im_zoom

.



def updateSonarView(self):

self.im_full.set_cmap(self.cmap)

self.im_zoom.set_cmap(self.cmap)

self.im_full.set_norm(self.norm)

self.im_zoom.set_norm(self.norm)

self.fig.canvas.draw()



def OnUpdateButton(self, event):

self.low_clutter_val = self.clutter_low.GetPosition()

self.high_clutter_val = self.clutter_high.GetPosition()

self.norm = plt.Normalize(vmin=self.low_clutter_val,
vmax=self.high_clutter_val)

self.updateSonarView()

 

But I get this error from the lib :

 

Traceback (most recent call last):

  File "./Filters\A1Filter.py", line 183, in OnUpdateButton

self.updateSonarView()

  File "./Filters\A1Filter.py", line 157, in updateSonarView

self.im_full.set_norm(self.norm)

  File "C:\Python25\Lib\site-packages\matplotlib\cm.py", line 129, in
set_norm

self.changed()

  File "C:\Python25\Lib\site-packages\matplotlib\image.py", line 123, in
changed

cm.ScalarMappable.changed(self)

  File "C:\Python25\Lib\site-packages\matplotlib\cm.py", line 174, in
changed

self.callbacksSM.process('changed', self)

  File "C:\Python25\Lib\site-packages\matplotlib\cbook.py", line 152, in
process

func(*args, **kwargs)

  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 1028, in
on_changed

cb.update_bruteforce(m)

  File "C:\Python25\Lib\site-packages\matplotlib\colorbar.py", line 649, in
update_bruteforce

self.draw_all()

  File "C:\Python25\Lib\site-packages\matplotlib\colorbar.py", line 221, in
draw_all

self._process_values()

  File "C:\Python25\Lib\site-packages\matplotlib\colorbar.py", line 458, in
_process_values

b = self.norm.inverse(self._uniform_y(self.cmap.N+1))

  File "C:\Python25\Lib\site-packages\matplotlib\colors.py", line 652, in
inverse

return vmin + val * (vmax - vmin)

  File "C:\Python25\Lib\site-packages\numpy\ma\core.py", line 1686, in
__mul__

return multiply(self, other)

  File "C:\Python25\Lib\site-packages\numpy\ma\core.py", line 503, in
__call__

result = self.f(d1, d2, *args, **kwargs).view(get_masked_subclass(a,b))

ValueError: shape mismatch: objects cannot be broadcast to a single shape

 

UpdateSonarview works flawlessly if I modify the colormap (self.cmap) and
call it then.

If I modify self.norm and call UpdateSonarView I get this crash.

 

Is it a bug from my bad usage of the lib? If not, I can perhaps send you a
stripped down file showing the problem?

Using matplotlib 0.98.1 under windows.

 

Laurent

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow update norm make my app crash.

2008-07-30 Thread Laurent Dufréchou
Ho you got the point...
self.clutter_low.GetPosition() didn't returned an int...
self.clutter_low.GetValue return an int an it works now.
I missed this because I thought that 
self.norm = plt.Normalize(vmin=self.low_clutter_val,
vmax=self.high_clutter_val)
would have crashed before in this case, but seems it does not do any
computation on Normalize call.

Anyhow, thank you a lot, sorry to have send this error, I could have read my
code deeper first.

Regards,
Lauent

> -Message d'origine-
> De : John Hunter [mailto:[EMAIL PROTECTED]
> Envoyé : mercredi 30 juillet 2008 02:04
> À : Laurent Dufrechou
> Cc : [email protected]
> Objet : Re: [Matplotlib-users] imshow update norm make my app crash.
> 
> On Tue, Jul 29, 2008 at 6:52 PM, Laurent Dufrechou
> <[EMAIL PROTECTED]> wrote:
> 
> > I've applied the idea you've said later about colormap.
> >
> > Now I would like on an event to refresh my view so I've written this
> code:
> 
> 
> I would like to see what
> 
> self.low_clutter_val = self.clutter_low.GetPosition()
> 
> self.high_clutter_val = self.clutter_high.GetPosition()
> 
> low and high clutter val are (can you print them, as well as their
> type, eg
> 
>   print low', type(self.low_clutter_val), self.low_clutter_val
> 
> and likewise for the high val.  From the error, it looks lik they are
> not scalars.
> 
> JDH


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Multiple plots, interactivity, wx etc

2008-08-12 Thread Laurent Dufréchou
Hello,

>How can I do this using mpl and wx backend? Do you recommend using
>threading or forking plots as separate processes ?

None of the above is necessary. 

Add this to imports:
import matplotlib
matplotlib.use('WXAgg')

import matplotlib.cm as cm
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure
from pylab import *

Just instanciate some wx.panel with inside

self.sizer = wx.BoxSizer(wx.VERTICAL)
fig = Figure()
self.figure = FigureCanvasWxAgg(self.widget, -1, fig)
self.sizer.Add(self.figure, 1, wx.EXPAND)

x1 = array(var1['data'])
y1 = array(var1['data'])

axes = fig.add_subplot(111)#211)
axes.yaxis.tick_left()
axes.plot(x1,y1,alpha=1)
   

And should be OK.
Personnaly I use wx.aui to manage multpile wx.panel inside an App, but it
depends what you want to do with your app.

Laurent


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with label displaying

2008-09-20 Thread Laurent Dufrechou
Excellent!
That's was EXACTLY what I needed!
Thanks a lot Friedrich!

:)

2008/9/20 Friedrich Hagedorn <[EMAIL PROTECTED]>:
> On Sat, Sep 20, 2008 at 04:06:36PM +0200, Laurent Dufrechou wrote:
>> Hello all,
>> I'm trying to show to  a friend matplotlib features via pylab interface.
>> (thus to replace matlab/scilab)
>> I've a little problem while I'm trying to display plots into subplots here
>> under vista.
>> If I add a pylab.xlabel to the subplots they are masked by the underlying
>> subplot.
>> To workaround it I need to change the window size.
>> I used for myself add_axes([0.1,0.8,0.75,.15]) but that's not that easy.
>
> That's right (but sometimes I did the same :-)
>
>> Do I miss one important thing or must I go trought add_axes functions each
>> time I call pylab.subplot?
>
> Yes, you can adjust the space between the subplot with
>
>  subplots_adjust()
>
> Look at the docstring with
>
>  In [1]: subplots-adjust?
>
> in ipython shell. Try to see the difference between
>
>  figure()
>  subplot(211)
>  subplot(212)
>  show()
>
> and
>
>  figure()
>  subplots_adjust(hspace=0.4)  # standard: 0.2
>  subplot(211)
>  subplot(212)
>  show()
>
> By,
>
>  Friedrich
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] py2exe with pylab

2008-09-21 Thread Laurent Dufréchou
Had the same problem, solved with the setup.py attached ;)
Just modify it to fit your needs, should be a good start.
Works under vista + matplotlib 0.98.3
Cheers
Laurent

> -Message d'origine-
> De : Ron Adelman [mailto:[EMAIL PROTECTED]
> Envoyé : samedi 20 septembre 2008 23:17
> À : [email protected]
> Objet : [Matplotlib-users] py2exe with pylab
> 
> I followed the thread in Sept 2007 that covers the same problem I am
> having, but it seems to just end without a solution.
> 
> I have attached the setup file I am using.  When my application is
> packaged, installed and I try to get my graph I get the following
> message.  The graph works fine while I am working from just the python
> script in idle.
> 
> Traceback (most recent call last):
>   File "WxPyETn.py", line 4070, in GetRevGraph
>   File "matplotlib\__init__.pyc", line 677, in 
>   File "matplotlib\__init__.pyc", line 598, in rc_params
>   File "matplotlib\__init__.pyc", line 552, in matplotlib_fname
>   File "matplotlib\__init__.pyc", line 242, in wrapper
>   File "matplotlib\__init__.pyc", line 482, in _get_data_path_cached
>   File "matplotlib\__init__.pyc", line 478, in _get_data_path
> RuntimeError: Could not find the matplotlib data files
> 
> I really try to avoid posting and believe me, I have spent hours trying
> to figure a solution, but I am just plain ignorant with this and I
> feel there is a common solution out there someplace.
> 
> 
> Ron Adelman, CGFM
> Fiscal Consultant
> Dept. of Education (SouthWest District)
> 314 E. Main
> Jackson, TN   38301
> Phone: 731-927-8787
> State Cell:  615-306-4062
> Cell:  731-697-0967
> Fax: 731-422-1406
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
##---
__version__ = 0.3
__author__  = "Laurent Dufrechou"
__email__   = "[EMAIL PROTECTED]"
__license__ = "BSD"
##---

manifest = """



myProgram






"""

import os
import sys
sys.stdout = open('screen.txt','w',0)
sys.stderr = open('errors.txt','w',0)

sys.path.insert(0, "../Filters")
sys.path.insert(0, "../SysFiles")

def rmdir_recursive(dir, keep=[]):
"""Remove a directory, and all its contents if it is not already empty."""

print >>sys.__stdout__,'> Removing files in directory :' + dir + ',keeping 
protected files...'
print '> Removing files in directory :' + dir + ',keeping protected 
files...'
for name in os.listdir(dir):
if name not in keep:
full_name = os.path.join(dir, name)
# on Windows, if we don't have write permission we can't remove
# the file/directory either, so turn that on
if not os.access(full_name, os.W_OK):
os.chmod(full_name, 0600)
if os.path.isdir(full_name):
rmdir_recursive(full_name, keep=keep)
else:
os.remove(full_name)
else:
print >>sys.__stdout__,'> keeping ' + name + ' in ' + dir
print '> keeping ' + name + ' in ' + dir
if keep == []:
print >>sys.__stdout__,'> Removing directory :' + dir + 'because no 
file asked to be kept.'
print '> Removing directory :' + dir + 'because no file asked to be 
kept.'
os.rmdir(dir)

try:
rmdir_recursive('./dist', keep=".svn")
except:
print >>sys.__stdout__,'./dist: nothing to remove.'
print './dist: nothing to remove.'
 
# setup.py

# Used successfully in Python2.5 with matplotlib 0.91.2 and PyQt4 (and Qt 
4.3.3) 
from distutils.core import setup
import py2exe

# We need to exclude matplotlib backends not being used by this executable.  
You may find
# that you need different excludes to create a working executable with your 
chosen backend.
# We also need to include include various numerix libraries that the other 
functions call.

opts = {
'py2exe': { "compressed": 1,
"optimize": 1,
#"ascii": 1,
"bundle_files": 1,
'packages' : ["matplotlib.backends.backend_wxagg",
  "matplotlib.numerix.fft",
  "matplotlib.numerix.linear_algebra",

Re: [Matplotlib-users] Problem in mlab.py while creating .exe

2009-01-12 Thread Laurent Dufréchou
Thx you john, for you fast reply (as always).
You're true seems to be a py2exe optimization problem. I've got the good
origin of the problem.
So your true you don't have to include my ugly patch :)

Thx for the link, will write a little tuto on making .exe!

Regards,
Laurent

> -Message d'origine-
> De : John Hunter [mailto:[email protected]]
> Envoyé : lundi 12 janvier 2009 15:34
> À : Laurent Dufrechou
> Cc : [email protected]
> Objet : Re: [Matplotlib-users] Problem in mlab.py while creating .exe
> 
> On Mon, Jan 12, 2009 at 5:04 AM, Laurent Dufrechou
>  wrote:
> 
> > I've created a little software for data analysis with your fantastic
> > library.
> >
> > I've made .exe with py2exe and since I've upgraded to last revision
> my .exe
> > was no more working.
> > I know this is a quick ugly fix, but I had to do a release so… J
> >
> > I don't use mlab.py but  making a  .exe seems to include it and
> import it…
> >
> > Any idea what should be THE good solution to correct mlab.py, and do
> you
> > mind to commit a patch for this issue?
> 
> I don't think we'll take a patch of the form you have provided.  But
> I'm pretty sure there is a solution on the py2exe end that requires no
> changes to mpl.  py2exe is removing the doc, probably as a space
> optimization.  If you disable optimization in py2exe, the problem
> should go away, eg
> 
>   http://lists.wxwidgets.org/pipermail/wxpython-users/2005-
> May/039506.html
> 
> > On the website there is no doc to make a .exe.
> >
> > I've spent a lot of time making a setup.py script to do a .exe. Have
> some
> > interest in it?
> >
> > Perhaps adding a section in the doc?
> 
> Yes, definitely, I would be very interested in a FAQ with some example
> code we could put in the examples dir.  See
> 
>   http://matplotlib.sourceforge.net/faq/howto_faq.html#submit-a-patch
>   http://matplotlib.sourceforge.net/faq/howto_faq.html#contribute-to-
> matplotlib-documentation
> 
> for instructions on how to contribute.
> 
> JDH


--
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Polar bars and matplotlib 0.98.5

2009-02-19 Thread Laurent Mychkine
hi,

I'm using polar bars to plot windroses. Since the 0.98.5 version i have
some issues with the plots.
The 0° bar is not displayed in the good way. This bar is
located between -0.26 radian and 0.26 radian but it is printed
counterclockwise.
It was working perfectly with matplotlib version 0.98.3. I just switched to
version 0.98.5 because of the NaN bug of the previous version.

Any idea how i could make it work again ?
Ty!!

from pylab import *
nb_secteur=12

fig = figure(2,figsize=(8,8))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True,)

thetagrids([90,45,0,315,270,225,180,135],
labels=["N","NE","E","SE","S","SO","O","NO"])
theta = arange(0.0-pi/nb_secteur, 2*pi-pi/nb_secteur, 2*pi/nb_secteur)

radii = [10.,20,10,5,3,4,3,4,6,4,2,9]

width = 2*pi/nb_secteur

bars = ax.bar(theta, radii, width=width, bottom=0.0 )
for r,bar in zip(radii, bars):
bar.set_facecolor( 'blue')
bar.set_alpha(0.3)

text(1,0.69,"%",transform = ax.transAxes)
show()
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [PyQt] Pydee v0.3.0

2009-03-11 Thread Laurent Dufrechou
Hey pierre,
Wow that's fantastic!

One week ago I started (not sent) a mail that was intended for you on
python(x,y)
I explained that the main issue I get with users I want to convert to python
is:
1) "Hey there is so lot packages, each time I need to install a new package
to get your feature."
2) "Python is bad for my dumb users, scilab is better, when they double
click on the .sce it open the script, they edit the parameters in the script
file and run the script clicking on run."

Python(x,y) solved point 1. Pydee could solve point 2! 
Perhaps I will be able to trash these ## install of scilab!

Have you planed to integrate it into python(x,y)? If yes, an excellent idea
could be to be able to create file extension like .pyp that are python
script but that open Pydee!

Wow I had seen your pyqtshell I was really impressed by all the surrounding
widgets. 
Wow ;)

Good job! :)



--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] text annotation

2010-11-26 Thread Benoist Laurent
Hi,

I'm a new matplotlib user and I'm already impressed by matplotlib's  
features!
But I can't find how to do something that looks quite easy.

I have several points making something that looks like a circle.
I would like to anotate these point.
How can I manage the annotation of points forming a circle if I have  
their coordinates?

Any help would be appreciate.
Thank you.
Ben

--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] text annotation

2010-11-26 Thread Benoist Laurent
Thank you for your answer.
I read the text and annotate manual pages.

I don't understand how the "polar"  xycoords/textcoords works.
I guess I should use this but its not clear to me.




Le 26 nov. 10 à 14:13, Alan G Isaac a écrit :

> On 11/26/2010 8:12 AM, Benoist Laurent wrote:
>> How can I manage the annotation of points forming a circle if I have
>> their coordinates?
>
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.annotate
>
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.text
>
> http://matplotlib.sourceforge.net/examples/api/joinstyle.html
>
> hth,
> Alan Isaac
>
> --
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with  
> the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for  
> grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] text annotation

2010-12-16 Thread Benoist Laurent
1981201]



# plot ligand data
fig = pyplot.figure(figsize=(6,6))
pyplot.scatter(lx, ly, c=lz, s=50, alpha=0.75)

# plot cavity data
pyplot.scatter(cx, cy, marker='+', edgecolor='r', s=100, linewidth=2)

# plot a circle that fits the center of the cavities
cavdata = zip(cx, cy)
center = getCenter(cavdata)
radius = getMeanDist(center, cavdata)
circle = patches.Circle(center, radius, fill=False, linestyle='dashed')
fig.gca().add_patch(circle)

# set the axis range to obtain a square plot
x1, x2 = pyplot.xlim()
y1, y2 = pyplot.ylim()
bounds = (min(x1,y1), max(x2,y2))
pyplot.xlim(bounds)
pyplot.ylim(bounds)

for i in xrange(5):
theta = i*1.3+1.5
    pyplot.annotate(str(i+1), (theta, radius-4), textcoords='polar', color='g')


pyplot.show()
Le 15 déc. 10 à 16:50, Benjamin Root a écrit :On Wed, Dec 15, 2010 at 9:46 AM, Benoist Laurent <[email protected]> wrote: Hi all,I'm still a bit stuck with this probleme of polar annotation.Let me present the problem in a different way.I've got the center of my circle, its radius and even some points on the circle. Actually, I'd like to annotate these points (red crosses in the joined picture).How would you do that?My best try gave me the green numbers.Thanks in advance, BenCan you include the source code (if it is simple) that you used to generate this example, and we could probably help you out.Ben Root --
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] text annotation

2010-12-21 Thread Benoist Laurent
Nice!
Still some stuff to enhance but got it!

Thanks a lot.
Ben

Le 19 déc. 10 à 05:30, Jae-Joon Lee a écrit :

> I don't think "polar" is a good fit for your case. Instead, you can
> simply use "data" coordinate with explicit coordinate transformation.
> Try something like;
>
>for i in xrange(5):
>theta = i*1.3+1.5
>xx = center[0]+(radius-4)*math.cos(theta)
>yy = center[1]+(radius-4)*math.sin(theta)
>pyplot.annotate(str(i+1), (xx, yy), color='g', va="center",  
> ha="center")
>
> -JJ
>
>
>
> On Thu, Dec 16, 2010 at 5:27 PM, Benoist Laurent   
> wrote:
>> Sorry for the delay.
>> This is the script is used (modified so that it include the data).
>>
>>
>>
>> Le 15 déc. 10 à 16:50, Benjamin Root a écrit :
>>
>> On Wed, Dec 15, 2010 at 9:46 AM, Benoist Laurent   
>> wrote:
>>>
>>> Hi all,
>>> I'm still a bit stuck with this probleme of polar annotation.
>>> Let me present the problem in a different way.
>>> I've got the center of my circle, its radius and even some points  
>>> on the
>>> circle.
>>> Actually, I'd like to annotate these points (red crosses in the  
>>> joined
>>> picture).
>>> How would you do that?
>>> My best try gave me the green numbers.
>>> Thanks in advance,
>>> Ben
>>>
>>
>> Can you include the source code (if it is simple) that you used to  
>> generate
>> this example, and we could probably help you out.
>>
>> Ben Root
>>
>>
>>
>> --
>> Lotusphere 2011
>> Register now for Lotusphere 2011 and learn how
>> to connect the dots, take your collaborative environment
>> to the next level, and enter the era of Social Business.
>> http://p.sf.net/sfu/lotusphere-d2d
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>


--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [wxpython-users] Controlling the wxpython matplotlib-frame

2008-03-27 Thread Laurent Dufrechou
Have you tryied : ipython -pylab ?
It launch an ipython shell that support mathplotlib gui loop.

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] De la part de Wolfgang Kerzendorf
Envoyé : mercredi 26 mars 2008 08:31
À : [email protected];
[EMAIL PROTECTED]
Objet : [wxpython-users] Controlling the wxpython matplotlib-frame

Hello all,
I have trouble with one of my scripts that uses matplotlib when using  
python or ipython. The first time it opens, it does not hand the  
control back o the shell and can be used to work on the matplotlib  
figure interactively (I use an event handler and picker objects to  
change my plots) so it works really well. After I close the window the  
control is given back to the shell. This is how I want it to work,  
however at the second time the matplotlib plot opens the shell does  
not stop anymore, the script continues. When I used GTKAgg on my old  
linux box I had the same issue and bound a key to  
pylab.get_current_figure_manager().destroy(), which looked like a hack  
to me but  worked. This does not work anymore with wxPython, because  
the next time I open a plot I get an exception:

PyDeadObjectError: The C++ part of the FigureFrameWxAgg object has  
been deleted, attribute access no longer allowed.

I also think destroying the figure_manager is not the right way to do  
that. Whats a goog solution for this?
Thanks in advance
 Wolfgang

P.S.: I know I posted a similar thing yesterday, but I thought  
rephrasing the question might help with finding the solution
___
wxpython-users mailing list
[EMAIL PROTECTED]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users