What is your matplotlib workflow?

Maybe workflow may not be the appropriate term. Essentially, when I want to plot something using matplotlib, I find myself having to look up the api docs or examples online because quite frankly, matplotlib’s syntax is very hard to remember. I use ipython and use tab browsing, help(), dir(), etc, and that seem to help to some extent. I absolutely love matplotlib, but when I want to put a chart up quickly, matplotlib is just a “hassle” depending on what chart you want to create. I do expect this since plotting with matplotlib, you are essentially creating a chart “programmatically”, instead of GUI interface environment. But still, I feel like an improvement could still be made in making charts simpler with matplotlib.

While surfing the web, I ran into this module called Canvas: https://github.com/mdipierro/canvas

Canvas appears to be what I am after or what I wish matplotlib’s future syntax should strive for.

Currently, I store my matplotlib chart source code in folders with the file name describing what chart it creates (for example, “box_plot.py” or “control_chart.py”, etc.) and use them as “cheat sheets” when I need to make a chart. I am curious what other matplotlib users do? Otherwise, I do find myself sometimes just creating the chart in Excel as a 1st option, and make charts in matplotlib if it is something Excel can’t handle.

Thanks in advance,
Daniel

I think this is worth discussing. But I have only 1.3 years experience with
matplotlib and python. Basically, I do the same as you. But I think there
are few tips I would like to follow:

1. I would agree to make one major theme plot one script file. Avoid make
very long scripts with many plots. It's much more difficult to revisit.
2. I would avoid writing too much fancy loops as it takes much more time
when you want to make some change later.
3. I would like to divide complex figures into simple ones. like I would use
scatter to plot only scatter, and plot for only plotting lines. but not use
plot to plot both. I think this allows more flexible way in the future to
make necessary modifications.

But I still don't manage to find a good way for efficiently modifying
scripts and interactive plotting. It's very nice to have interactive
plotting (with --pylab) using ipython notebook, but when you want to make
some substitutions, it's much more tedious than in an editor like vim/emacs.
While in emacs or vim, you cannot simple select lines and execute them, so
you have to frequently copy and code and use %cpaste or %paste to paste the
code. And....., a lot lot windows shifting....

Chao

pybokeh wrote:

···

Maybe workflow may not be the appropriate term. Essentially, when I want
to plot something using matplotlib, I find myself having to look up the
api
docs or examples online because quite frankly, matplotlib's syntax is very
hard to remember. I use ipython and use tab browsing, help(), dir(), etc,
and that seem to help to some extent. I absolutely love matplotlib, but
when I want to put a chart up quickly, matplotlib is just a "hassle"
depending on what chart you want to create. I do expect this since
plotting with matplotlib, you are essentially creating a chart
"programmatically", instead of GUI interface environment. But still, I
feel like an improvement could still be made in making charts simpler with
matplotlib.

While surfing the web, I ran into this module called Canvas:
https://github.com/mdipierro/canvas

Canvas appears to be what I am after or what I wish matplotlib's future
syntax should strive for.

Currently, I store my matplotlib chart source code in folders with the
file
name describing what chart it creates (for example, "box_plot.py" or
"control_chart.py", etc.) and use them as "cheat sheets" when I need to
make a chart. I am curious what other matplotlib users do? Otherwise, I
do find myself sometimes just creating the chart in Excel as a 1st option,
and make charts in matplotlib if it is something Excel can't handle.

Thanks in advance,
Daniel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


View this message in context: http://old.nabble.com/What-is-your-matplotlib-workflow--tp33987463p33996351.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

In emacs you can activate ipython in your emacs.el file and then you
can send arbitrary snippets you highlight, with C-c |. In vim, Paul
Ivanov's vim-ipython integration
(https://github.com/ivanov/vim-ipython) gives even more powerful and
detailed control.

Not saying the issues being discussed don't exist, but we do have some
tools to partially address them (the questions about the MPL api are
obviously beyond IPython's control).

Cheers,

f

···

On Mon, Jun 11, 2012 at 2:05 PM, wiswit <chaoyuejoy@...287...> wrote:

While in emacs or vim, you cannot simple select lines and execute them, so
you have to frequently copy and code and use %cpaste or %paste to paste the
code.

Hi, Thanks Fernando! I am using vim and I checked a little bit the tool and
it seems of great help!
I am not saying that we need something perfect. It's already great to have
these tools (ipython, matplotlib). Just imagine what's kind of feeling
working within pure python shell... thanks for these great work.

Chao

Fernando Perez wrote:

···

On Mon, Jun 11, 2012 at 2:05 PM, wiswit <chaoyuejoy@...287...> wrote:

While in emacs or vim, you cannot simple select lines and execute them,
so
you have to frequently copy and code and use %cpaste or %paste to paste
the
code.

In emacs you can activate ipython in your emacs.el file and then you
can send arbitrary snippets you highlight, with C-c |. In vim, Paul
Ivanov's vim-ipython integration
(https://github.com/ivanov/vim-ipython) gives even more powerful and
detailed control.

Not saying the issues being discussed don't exist, but we do have some
tools to partially address them (the questions about the MPL api are
obviously beyond IPython's control).

Cheers,

f

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


View this message in context: http://old.nabble.com/What-is-your-matplotlib-workflow--tp33987463p34000000.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Hi, Thanks Fernando! I am using vim and I checked a little bit the tool and

it seems of great help!

I am not saying that we need something perfect. It’s already great to have

these tools (ipython, matplotlib). Just imagine what’s kind of feeling

working within pure python shell… thanks for these great work.

Chao

Do a search for modern python IDE in vim. I found some of the tools in there to be exceptionally useful for creating scripts. Note that I usually use mpl to display a result generated from a complex script and rarely from an interactive python prompt.

It sounds like you are more in the other camp, and may benefit from a slight rethinking of your overall workflow. I follow the philosophy of making a tool to do one thing and do it well. For example, I made myself a “super ncview” to view 2d netcdf data and placed it in my .local/bin folder. So, when debugging a script that uses a netcdf file, I can quickly check its contents with a simple shell call. Note, though that it is only useful to me because I typically work with netcdf files, and so you would need to make tools suited for your typical data files.

Cheers!

Ben Root

···

On Tuesday, June 12, 2012, wiswit wrote:

Maybe workflow may not be the appropriate term. Essentially, when

I want
> to plot something using matplotlib, I find myself having to look up the api
> docs or examples online because quite frankly, matplotlib's syntax is very
> hard to remember. I use ipython and use tab browsing, help(), dir(), etc,
> and that seem to help to some extent. I absolutely love matplotlib, but
> when I want to put a chart up quickly, matplotlib is just a "hassle"
> depending on what chart you want to create. I do expect this since
> plotting with matplotlib, you are essentially creating a chart
> "programmatically", instead of GUI interface environment. But still, I
> feel like an improvement could still be made in making charts simpler with
> matplotlib.

  Just wanted to mention that I've managed to get a good workflow going using DreamPie. I haven't seen much talk about DreamPie on here, but it's really useful for working with matplotlib. Although I haven't used ipython, I get the impression DreamPie is like a GUI version of that. It provides a two-window interface sort of like a chat or MUD client, with a separate editing window where you can enter code, and an output window where your code and results are displayed.

  Most importantly for present purposes, it's matplotlib-aware so you can use interactive plotting commands and have it "just work" (i.e., not hang the program as with IDLE). It also provides name-completion and docstring tooltips, making it easy to scan the docs for a particular function to refresh my memory about its arguments. DreamPie makes it pretty doable to make iterative tweaks to the same plotting code until I get it into a form that I want, at which point I can copy and paste it into a file for storage.

  I do think there are areas where matplotlib starts to get in its own way, in that its powerful features obscure the path toward simple goals. It seems like wrapper libs that provide a simpler interface (like I guess this Canvas thing you mentioned) could be useful for getting around that.

···

On 2012-06-09 15:18, pybokeh wrote:

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
    --author unknown