toolbar

Hello,

the following will display a figure with a plot. the figure will embed
the classic toolbar.

import matplotlib.pyplot as plt
import numpy as np
x=np.arange(0, 1, 0.1)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x)
plt.show()

from there, is it possible to add new buttons to the toolbar ? with
new fonction ?
or do I have to embed everythong in wxPython, GTK or others ?

thank you,
Philippe

Hi Pierre Raybaut a nice extension for what you are asking. You will need to use Qt4Agg backend to use it. The code is at http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/

He doesn’t seem like planning to add more onto this extension (http://code.google.com/p/spyderlib/issues/detail?id=136)

This said, his code is easy to read and you should easily be able to extend it according to your need.

···

On Thu, Mar 18, 2010 at 7:01 AM, Philippe Crave <philippe.crave@…287…> wrote:

Hello,

the following will display a figure with a plot. the figure will embed

the classic toolbar.

import matplotlib.pyplot as plt

import numpy as np

x=np.arange(0, 1, 0.1)

fig = plt.figure()

ax = fig.add_subplot(111)

ax.plot(x)

plt.show()

from there, is it possible to add new buttons to the toolbar ? with

new fonction ?

or do I have to embed everythong in wxPython, GTK or others ?

thank you,

Philippe


Gökhan

Is there an minimal example file available showing how to activate this new
plot toolbar ?

changing the backend to Qt4Agg apparently is not sufficient.

Gökhan SEVER-2 wrote:

···

Hi Pierre Raybaut a nice extension for what you are asking. You will need
to
use Qt4Agg backend to use it. The code is at
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/

He doesn't seem like planning to add more onto this extension (
http://code.google.com/p/spyderlib/issues/detail?id=136)

This said, his code is easy to read and you should easily be able to
extend
it according to your need.

--
Gökhan

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

You need to install matplotlib from the svn trunk.

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn

···

On Sat, Mar 20, 2010 at 6:06 PM, butterw <butterw@…985…> wrote:

Is there an minimal example file available showing how to activate this new

plot toolbar ?

changing the backend to Qt4Agg apparently is not sufficient.


Gökhan

I’m using the recent ‘0.99.3rc1’ which does include the qt4_editor code.

Should the new toolbar just appear when you open a plot or is specific code needed to call it ?

···

Le , Gökhan Sever <gokhansever@…287…> a écrit :

On Sat, Mar 20, 2010 at 6:06 PM, butterw butterw@…287…> wrote:

Is there an minimal example file available showing how to activate this new

plot toolbar ?

changing the backend to Qt4Agg apparently is not sufficient.

You need to install matplotlib from the svn trunk.

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn


Gökhan

I’m using the recent ‘0.99.3rc1’ which does include the qt4_editor code.

If you have the qt4_editor code within your installation you are good to go then. Just create a new plot while the Qt4Agg backend is pre-selected you should have an additional icon on the existing navigation toolbar. From there on you should see a window when you fire that icon.

It is migrated from Pierre Raybout’s spyderlib (http://code.google.com/p/spyderlib/)

···

On Sat, Mar 20, 2010 at 7:43 PM, <butterw@…287…> wrote:

Should the new toolbar just appear when you open a plot or is specific code needed to call it ?

Le , Gökhan Sever <gokhansever@…287…> a écrit :

On Sat, Mar 20, 2010 at 6:06 PM, butterw butterw@…287…> wrote:

Is there an minimal example file available showing how to activate this new

plot toolbar ?

changing the backend to Qt4Agg apparently is not sufficient.

You need to install matplotlib from the svn trunk.

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn


Gökhan


Gökhan

Correction: '0.99.3rc1' does not include the qt4_editor code, so you
do need to get the source files from svn.

The feature is a nice addition to matplotlib..

···

On Sun, Mar 21, 2010 at 1:53 AM, Gökhan Sever <gokhansever@...287...> wrote:

On Sat, Mar 20, 2010 at 7:43 PM, <butterw@...287...> wrote:

I'm using the recent '0.99.3rc1' which does include the qt4_editor code.

If you have the qt4_editor code within your installation you are good to go
then. Just create a new plot while the Qt4Agg backend is pre-selected you
should have an additional icon on the existing navigation toolbar. From
there on you should see a window when you fire that icon.

It is migrated from Pierre Raybout's spyderlib
(http://code.google.com/p/spyderlib/)

Should the new toolbar just appear when you open a plot or is specific
code needed to call it ?

Le , Gökhan Sever <gokhansever@...287...> a écrit :
>
>
> On Sat, Mar 20, 2010 at 6:06 PM, butterw butterw@...287...> wrote:
>
>
>
> Is there an minimal example file available showing how to activate this
> new
>
> plot toolbar ?
>
>
>
> changing the backend to Qt4Agg apparently is not sufficient.
>
>
>
>
>
> You need to install matplotlib from the svn trunk.
>
> http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn
>
>
> --
> Gökhan

--
Gökhan

without the svn version, you can save both files.
edit figureoptions.py to modify the import:
#import matplotlib.backends.qt4_editor.formlayout as formlayout
import formlayout

then, you can attach the nice dialog box to a Event, something like that works:

import matplotlib.pyplot as plt
import numpy as np
import figureoptions

t = np.arange(0, 1+0.01, 0.01)
y = np.sin(2np.pit)

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(t, y, ‘r-o’)

def onclick(event):
figureoptions.figure_edit(ax)

cid = fig.canvas.mpl_connect(‘button_press_event’, onclick)

plt.show()

click on the figure, you will get the dialog box. less cool than the button, but not too bad.

2010/3/21 Peter Butterworth <butterw@…287…>

···

Correction: ‘0.99.3rc1’ does not include the qt4_editor code, so you

do need to get the source files from svn.

The feature is a nice addition to matplotlib…

On Sun, Mar 21, 2010 at 1:53 AM, Gökhan Sever <gokhansever@…287…> wrote:

On Sat, Mar 20, 2010 at 7:43 PM, <butterw@…287…> wrote:

I’m using the recent ‘0.99.3rc1’ which does include the qt4_editor code.

If you have the qt4_editor code within your installation you are good to go

then. Just create a new plot while the Qt4Agg backend is pre-selected you

should have an additional icon on the existing navigation toolbar. From

there on you should see a window when you fire that icon.

It is migrated from Pierre Raybout’s spyderlib

(http://code.google.com/p/spyderlib/)

Should the new toolbar just appear when you open a plot or is specific

code needed to call it ?

Le , Gökhan Sever <gokhansever@…287…> a écrit :

On Sat, Mar 20, 2010 at 6:06 PM, butterw butterw@…287…> wrote:

Is there an minimal example file available showing how to activate this

new

plot toolbar ?

changing the backend to Qt4Agg apparently is not sufficient.

You need to install matplotlib from the svn trunk.

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn

Gökhan

Gökhan


Download Intel® Parallel Studio Eval

Try the new software tools for yourself. Speed compiling, find bugs

proactively, and fine-tune applications for parallel performance.

See why Intel Parallel Studio got high marks during beta.

http://p.sf.net/sfu/intel-sw-dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I've done a few minor enhancements and corrections to the qt4_editor
(interactive plot options popup). Should I submit them to matplotlib
or directly to the original author Pierre Raybaut ?

What plot options do you think can be added to the qt4_editor ?
I've added a basic Legend option to the Axes tab and a Visible option
to the Curves tab.

formlayout.py:
validate color strings (for matplotlib)

figureoptions.py:
corrected marker=='none' bug
corrected matplotlib green in COLORS ('g': '#008000')
missing ',' and incorrect naming of some MARKERS
LINESTYLES are sorted. 'steps' removed from linestyles

···

On Sun, Mar 21, 2010 at 5:22 AM, Peter Butterworth wrote:

Correction: '0.99.3rc1' does not include the qt4_editor code, so you
do need to get the source files from svn.

The feature is a nice addition to matplotlib..