Creating new type of plot

Hi everyone,

I am trying to create some brand new types of plots for a unique data set that I have. My question basically boils down to getting some advice on what is the proper way to set up a function that will act like one of the matplotlib pyplot functions (e.g., have all the same behavior regarding interactive stuff, resizing, etc.).

I have been looking through some of the code for the major functions like plot, but have been having trouble parsing it. I think that some of this is obfuscated in the complexity of the functions.

At some level, I would also like to be able to draw on the canvas in a very explicit way, like in Processing (http://processing.org/); what is the best way to approach this?

Another thing that could be really nice is to have some boilerplate framework that someone could start with to quickly write functions that integrate well into the rest of matplotlib.

(And sorry if I am sounding critical of the package. I actually love it, and have been quite the MPL evangelist in my little section of Boston.)

Any suggestions are welcome.

Uri

···


Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
laserson@…1166…

Hi everyone,

I am trying to create some brand new types of plots for a unique data set
that I have. My question basically boils down to getting some advice on
what is the proper way to set up a function that will act like one of the
matplotlib pyplot functions (e.g., have all the same behavior regarding
interactive stuff, resizing, etc.).

Most of the pyplot functions are wrapper around the method in the Axes class.
For example, pyplot.plot is basically

ax = gca()
ax.plot()
draw_if_interactive()

And the basic role of the plotting method in the Axes class is to
create appropriate
matplotlib artists and add them to the axes. If your plot can be
created with matplotlib's currently existing artists, you can simply
reuse them. Otherwise, you need to create your own artist, but this
requires some understandings of internals.

For example,

def ax_my_plot(ax, *kl, **ka):
    # create artists and add them to ax

def my_plot(*kl, **ka):
    ax = gca()
    ax_my_plot(ax, *kl, **ka)
    draw_if_interactive()

"my_plot" will behave similar to other pyplot command.

I have been looking through some of the code for the major functions like
plot, but have been having trouble parsing it. I think that some of this is
obfuscated in the complexity of the functions.

At some level, I would also like to be able to draw on the canvas in a very
explicit way, like in Processing (http://processing.org/); what is the best
way to approach this?

You can draw something in the canvas coordinate. But what you can do
is limited by the matplotlib's backend api, which is more like a
vector drawing tool. So things like a pixel manipulation is not
suitable.

Regards,

-JJ

···

On Mon, Jul 13, 2009 at 4:56 PM, Uri Laserson<laserson@...1166...> wrote:

Another thing that could be really nice is to have some boilerplate
framework that someone could start with to quickly write functions that
integrate well into the rest of matplotlib.

(And sorry if I am sounding critical of the package. I actually love it,
and have been quite the MPL evangelist in my little section of Boston.)

Any suggestions are welcome.

Uri

--
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
laserson@...1166...

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users