backend with edition capabilities

Dear all

I am a long time matplotlib user (under linux) but new to the list (second post).

On of the things that bothers me the most is the inability of the standard backend to change simple things (line color, labels, etc…).

I resorted to create a simple FrankeinBackend (based on the GtkAgg)
I guess I am not the only one missing this kind of features or experimenting with similar ideas.

Some points comes to my mind:
Is there any special place where we can share and discuss this?

Is it better if I just open a googlecode place for my code.?
This is a recurring question and I have no idea what I am talking about
This is already done I am reinventing the wheel

Thanks
Federico

···


Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?

– Antonio Alducin –

Dear all

I am a long time matplotlib user (under linux) but new to the list (second post).

On of the things that bothers me the most is the inability of the standard backend to change simple things (line color, labels, etc…).

There was a feature a couple of us were hacking on a while back that would allow for live switching between color and black&white modes. Is this sort of stuff what you are speaking of? The changes were too invasive to be included, but it was an interesting experiment.

I resorted to create a simple FrankeinBackend (based on the GtkAgg)
I guess I am not the only one missing this kind of features or experimenting with similar ideas.

Some points comes to my mind:
Is there any special place where we can share and discuss this?

GitHub

Is it better if I just open a googlecode place for my code.?

No, GitHub (or any other git-compatible place that could interact with mpl’s github repo.)

This is a recurring question and I have no idea what I am talking about

If it is what I think you mean, it is not an often asked-for-feature, but it has been discussed. It is a very difficult problem to tackle and significant refactoring work would be needed to even begin to address it. Note, however, such refactor work by itself would be extremely valuable. Along with that work should also be efforts towards improved documentation, code comments, examples and tests. This way, when as work is done, we can make sure that nothing is breaking (or make breaks well documented).

This is already done I am reinventing the wheel

Nope, more like re-drawing the wheel. The wheel itself has yet to be made to everyone’s satisfaction.

Cheers!
Ben Root

···

On Wed, Feb 29, 2012 at 4:02 PM, Federico Ariza <ariza.federico@…287…> wrote:

Dear all

I am a long time matplotlib user (under linux) but new to the list
(second post).

On of the things that bothers me the most is the inability of the standard
backend to change simple things (line color, labels, etc...).

There was a feature a couple of us were hacking on a while back that would
allow for live switching between color and black&white modes. Is this sort
of stuff what you are speaking of? The changes were too invasive to be
included, but it was an interesting experiment.

I thought the OP's original question was something like the Matlab
"plot editor" (or whatever is its name), which allows you to edit line
colours, styles, gridlines styles, this kind of stuff on a "live" plot
(mind you, it's been 6 years since I used Matlab for the last time and
I may have forgotten what the "plot editor" does).

Anyway, if I am not completely off-track, this is something I had been
looking for as well in matplotlib a while back (3, 4 years ago), but
at that time I was told it would have been complicated to implement it
for all the "live" backend (I can't recall the exact reason).

I would say that, at least for the backends based on wxPython, this
kind of modify-the-live-plot-via-GUI-interaction should be relatively
straightforward, at least for the GUI part and for the basics (line
styles, colours, markers and so on). However I am not sure what are
the implications on the core matplotlib code.

But if I have misunderstood, I apologize for the noise :slight_smile: .

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

···

On 1 March 2012 21:37, Benjamin Root wrote:

On Wed, Feb 29, 2012 at 4:02 PM, Federico Ariza <ariza.federico@...287...> > wrote:

import wx

Dear all

I am a long time matplotlib user (under linux) but new to the list

(second post).

On of the things that bothers me the most is the inability of the standard

backend to change simple things (line color, labels, etc…).

There was a feature a couple of us were hacking on a while back that would

allow for live switching between color and black&white modes. Is this sort

of stuff what you are speaking of? The changes were too invasive to be

included, but it was an interesting experiment.

I thought the OP’s original question was something like the Matlab

“plot editor” (or whatever is its name), which allows you to edit line

colours, styles, gridlines styles, this kind of stuff on a “live” plot

(mind you, it’s been 6 years since I used Matlab for the last time and

I may have forgotten what the “plot editor” does).

Anyway, if I am not completely off-track, this is something I had been

looking for as well in matplotlib a while back (3, 4 years ago), but

at that time I was told it would have been complicated to implement it

for all the “live” backend (I can’t recall the exact reason).

Actually, it isn’t that complicated, if you restrict yourself to a subset of mpl. I can’t imagine being able to modify “any and all” aspects of a figure, such as transforms or filters, but certainly could modify various artists, for the most part. Also, this shouldn’t be a “backend” in the same sense that GTKAgg is a backend. Merely a very advanced collection of widgets.

Also, in many sense, this actually already has been done. It is called “Inkscape”. Just save your figures as svg and edit them in Inkscape. (I know, it is a cop-out.)

I would say that, at least for the backends based on wxPython, this

kind of modify-the-live-plot-via-GUI-interaction should be relatively

straightforward, at least for the GUI part and for the basics (line

styles, colours, markers and so on). However I am not sure what are

the implications on the core matplotlib code.

Just about everything displayed is an “Artist” and therefore there is a uniform, standard interface for all of them. Widgets could still intelligently interact with subclassed Artists as well. There is nothing preventing that from happening.

Ben Root

···

On Thu, Mar 1, 2012 at 3:31 PM, Andrea Gavana <andrea.gavana@…287…> wrote:

On 1 March 2012 21:37, Benjamin Root wrote:

On Wed, Feb 29, 2012 at 4:02 PM, Federico Ariza <ariza.federico@…287…> > > > wrote:

Andrea Gavana :

Anyway, if I am not completely off-track, this is something I had been
looking for as well in matplotlib a while back (3, 4 years ago), but
at that time I was told it would have been complicated to implement it
for all the "live" backend (I can't recall the exact reason).

I would say that, at least for the backends based on wxPython, this
kind of modify-the-live-plot-via-GUI-interaction should be relatively
straightforward, at least for the GUI part and for the basics (line
styles, colours, markers and so on).

There is one non-trivial difference between Matplotlib and Matlab.
Matplotlib is "just" a library, and not an integrated package with its own event processing loop, multithreading, etc. When you plot() something under Matlab or Scilab, you generate some objecs (gcf, gca) and other stuff, accessible from outside. Your program turns normally, your console works. So, you may launch a procedure which analyses all the plotted data and change the "patches", "lines", "collections", etc., using the matplotlib jargon.

In matplotlib, upon show(), you relinquish the control. The interaction becomes clumsy, the animation becomes clumsy, since matplotlib doesn't give you the full access to the event loop.
OF COURSE you may do it, but it will require some work.
One possibility is to use an interface which by design works (I presume...) in a separate, non-blocking thread. I mean: IPython. If you launch IPython --pylab, then you may, e.g. construct:

x=linspace(0.0,25.0,300); y=sin(x)
plot(x,y)

and the figure is created without show().
Then, write:

a=gca(); p=a.lines[0]

and nothing more difficult than:

p.set_lw(3); p.set_color('red'); draw()

You have edited your line. No need to change the code of matplotlib.

Good luck.

Jerzy Karczmarczuk

Just to be clear, you are speaking of the difference between interactive and non-interactive modes, which is entirely switchable in matplotlib. However, widgets can be used in either mode. mpl can do what matlab can do, and more – in theory. We simply do not have all the widgets and tools made.

Ipython uses mpl with interactive mode turned on. All artists are available for editing at any time until the figure is destroyed (in either mode). It just happens that the execution moves past show() in non-interactive mode only when the figures are destroyed.

As for any clumsiness for animations, it is because the feature is still new and Ryan May and I would greatly welcome additional viewpoints in the design discussions.

Ben Root

···

On Thursday, March 1, 2012, Jerzy Karczmarczuk <jerzy.karczmarczuk@…3937…> wrote:

Andrea Gavana :

Anyway, if I am not completely off-track, this is something I had been

looking for as well in matplotlib a while back (3, 4 years ago), but
at that time I was told it would have been complicated to implement it
for all the “live” backend (I can’t recall the exact reason).

I would say that, at least for the backends based on wxPython, this
kind of modify-the-live-plot-via-GUI-interaction should be relatively
straightforward, at least for the GUI part and for the basics (line

styles, colours, markers and so on).
There is one non-trivial difference between Matplotlib and Matlab.
Matplotlib is “just” a library, and not an integrated package with its
own event processing loop, multithreading, etc. When you plot()

something under Matlab or Scilab, you generate some objecs (gcf, gca)
and other stuff, accessible from outside. Your program turns normally,
your console works. So, you may launch a procedure which analyses all

the plotted data and change the “patches”, “lines”, “collections”, etc.,
using the matplotlib jargon.

In matplotlib, upon show(), you relinquish the control. The interaction

becomes clumsy, the animation becomes clumsy, since matplotlib doesn’t
give you the full access to the event loop.
OF COURSE you may do it, but it will require some work.
One possibility is to use an interface which by design works (I

presume…) in a separate, non-blocking thread. I mean: IPython. If you
launch IPython --pylab, then you may, e.g. construct:

x=linspace(0.0,25.0,300); y=sin(x)
plot(x,y)

and the figure is created without show().
Then, write:

a=gca(); p=a.lines[0]

and nothing more difficult than:

p.set_lw(3); p.set_color(‘red’); draw()

You have edited your line. No need to change the code of matplotlib.

Good luck.

Jerzy Karczmarczuk

Hi

As I thought, this is a tricky subject.

So far I just opened a github account and added the three files that I am using.
https://github.com/fariza/MPL-Experimental-Backend

I have tested this on linux, I do not know if it works on windows.

I know glade is not the right way to do it if I want this to be taken serously.
So far the only thing I want is to experiment and see what subset of actions are needed by most people.

The code is ugly but if this is something that more people find useful, I will do something about that, if not I will keep it to myself and my personal use.

Thanks
Federico

P.S. The group expander is because I have personal need of line group management

P.S.2. The toolbar will be modified to be unified among all the figures
P.S.3. The figures are arranged in a notebook because I hate having multiple open windows from the same source.
P.S.4. I am thinking on adding a “shell” with all the figure and line instances ready to be modified by hand.

···

On Wed, Feb 29, 2012 at 5:02 PM, Federico Ariza <ariza.federico@…287…> wrote:

Dear all

I am a long time matplotlib user (under linux) but new to the list (second post).

On of the things that bothers me the most is the inability of the standard backend to change simple things (line color, labels, etc…).

I resorted to create a simple FrankeinBackend (based on the GtkAgg)
I guess I am not the only one missing this kind of features or experimenting with similar ideas.

Some points comes to my mind:
Is there any special place where we can share and discuss this?

Is it better if I just open a googlecode place for my code.?
This is a recurring question and I have no idea what I am talking about
This is already done I am reinventing the wheel

Thanks

Federico


Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?

– Antonio Alducin –


Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?

– Antonio Alducin –

Hi,

Great project and addition to matplotlib ! Something that was

missing for me … thanks !

I've tried to use your backend with editions capabilities but i'm

stick with this erro:

python test.py

Traceback (most recent call last):

  File "test.py", line 4, in <module>

    import matplotlib.pyplot as plt

  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 95,

in

    new_figure_manager, draw_if_interactive, show = pylab_setup()

  File

“/usr/lib/pymodules/python2.7/matplotlib/backends/init.py”, line
25, in pylab_setup

    globals(),locals(),[backend_name])

  File

“/home/beaubert/Téléchargements/fariza-MPL-Experimental-Backend-aa7ce4a/experimentalbackend.py”,
line 34, in

    settings.props.gtk_button_images = True

AttributeError: 'gobject.GProps' object has no attribute

‘gtk_button_images’

I'm on Kubuntu 11.10.

Thank's

Cheers

Francois
···

http://p.sf.net/sfu/learndevnow-dev2Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users