[Matplotlib-users] 'save file' GUI dialog

2014-06-20 Thread Thomas Robitaille
Hi everyone,

I'm developing a simple GUI tool in Matplotlib that relies on the
event framework to handle buttons/sliders. I am trying to avoid using
a GUI toolkit directly to ensure maximum compatibility for users.

One thing I would like is to be able to have a 'save' button that will
open up a standard 'save file' dialog window (but not necessarily the
plot itself). Matplotlib already has 'save file' GUI dialogs for the
different backends, so I was wondering whether there is an easy and
abstract way of asking matplotlib to open a 'save file' dialog and
capturing the output? Or is this all handled separately in the
different backends?

Thanks!
Tom

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 'save file' GUI dialog

2014-06-20 Thread Chris Beaumont
Hey Tom,

It looks like the only backend-agnostic file save function is save_figure()
(a toolbar method), which conflates choosing a filename and doing the
actual saving. The backend-specific code to choose a filename via a dialog
isn't uniform:

Qt4:
matplotlib.backends.backend_qt4._getSaveFileName

MacOS
matplotlib.backends.backend_osx._macosx.choose_save_file

Wx:
A bunch of code in matplotlib.backends.backend_wx.save_figure

TkAgg:
Tkinter.FileDialog

GtkAgg:
get_filechooser().get_filename_from_user()

It looks like, at a minimum, you would have to write your own wrapper code
to make a backend-agnostic interface for choosing a filename. Of course, if
you did that, it would also be nice to refactor that into MPL itself... :)

chris


On Fri, Jun 20, 2014 at 8:22 AM, Thomas Robitaille 
thomas.robitai...@gmail.com wrote:

 Hi everyone,

 I'm developing a simple GUI tool in Matplotlib that relies on the
 event framework to handle buttons/sliders. I am trying to avoid using
 a GUI toolkit directly to ensure maximum compatibility for users.

 One thing I would like is to be able to have a 'save' button that will
 open up a standard 'save file' dialog window (but not necessarily the
 plot itself). Matplotlib already has 'save file' GUI dialogs for the
 different backends, so I was wondering whether there is an easy and
 abstract way of asking matplotlib to open a 'save file' dialog and
 capturing the output? Or is this all handled separately in the
 different backends?

 Thanks!
 Tom


 --
 HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
 Find What Matters Most in Your Big Data with HPCC Systems
 Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
 Leverages Graph Analysis for Fast Processing  Easy Data Exploration
 http://p.sf.net/sfu/hpccsystems
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 --
 *
 Chris Beaumont
 Senior Software Engineer
 Harvard Center for Astrophysics
 60 Garden Street, MS 42
 Cambridge, MA 02138
 chrisbeaumont.org
 *

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colors

2014-06-20 Thread Bruno Pace
Ok! I'm getting there! I've been trying to figure out, though, how to set
black - for example - for the zero values BUT interpolate also the colors
linearly from black to blue in the linear region (from zero to the linear
threshold). Is there a way to change the colormap like that?

Thanks a lot!
On 2014/06/18, 5:23 AM, Bruno Pace wrote:

 Ok, so using the norm=SymLogNorm I cannot distinguish the values that
 are exactly 0.0 from the really small ones, right? Would it be possible


Correct, the scale is linear for small values.

 to make use of the set_bad method without having to use masked arrays,
 just combining the SymLogNorm and the set_bad?


No, the mask is what identifies a point as bad.  If you want to distinguish
zero from non-zero, no matter how small, then this is the way to do it.

zm = np.ma.masked_equal(z, 0, copy=False)

Now you have a masked array where the points that are exactly zero are
masked.

The bad color won't show up on the colorbar, however.  There is no suitable
place for it.  It can show only the range from vmin to vmax, and a
set_over color for values greater than vmax, and a set_under color for
values less than vmin.

Eric
--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] poor performance scaling in number of tick marks

2014-06-20 Thread Joel B. Mohler
I have observed that the amount of time to draw a figure with a plot
depends heavily on the number of tick marks on the axes.  This appears
to be a major driver of perceived refresh performance on interactive
graphics in PySide (for example).  Somewhat tangentially this makes
log axes appear to perform slowly, but I think that is merely a
side-effect of the fact that log axes come with minor tick marks by
default.  I'm working with built-from-source matplotlib as of Apr 17,
2014; I think the observations here apply to any recent matplotlib.

I've published a full illustration at
https://gist.github.com/jbmohler/7c5c8cca39826ea8ede7 .  This small
PySide application lets you enter the number of points in a scatter
plot and the number of minor tick marks.  You can see for yourself
that increasing the number of points in the scatter plot has little
impact on performance, but increasing the number of tick marks has a
noticeable effect with only moderate increase.

Why does this matter if you have a sane number of tick marks?  It
points to tick marks being simply very expensive -- on my 2 year old
quad core, entirely removing tick marks results in 117 frames per
second, but with 7 (major) tick marks on x  y that drops to 38 frames
per second.  I think 100 tick marks falls with-in sane (in some
cases) and a graph with 100 tick marks has decidedly more lag in a gui
than 10 tick marks.  As mentioned above, log axes are particularly
likely place to have lots of tick marks.

How can I fix this?  I'm not sure, but I think there are reasonable
special cases that could be highly optimized.  The problem seems to me
to be that each tick mark is a Line2D artist and that has a marker
type (in fact, I think there is no line shown, the tick mark is the
single marker of the Line2D).  In the case of uniform sized tick
marks, I believe the tick marks for an axis could be all in one Line2D
with each tick mark being a marker in the single Line2D.  This is a
huge reduction of artists which seems likely to yield a speed up in
quite few places.

I'd love to hear your thoughts and/or fix suggestions on this topic.

Joel

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users