Re: [Matplotlib-users] save or pickle figure object

2008-09-17 Thread Ted Drain
I agree completely - I was just pointing that it is possible.  I think what
people might not be aware of is that it's really an all or nothing
proposition.  You either jump in completely and pay the large cost to handle
this in a maintainable, scalable way or don't do it at all.  All of the
quick and easy solutions have too many problems and aren't really
maintainable.

Ted

 -Original Message-
 From: Eric Firing [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 17, 2008 12:01 PM
 To: Ted Drain
 Cc: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] save or pickle figure object
 
 Ted Drain wrote:
  We have some experience maintaining persistent object storage over
 long
  periods of time.  The best solution we've found is to do something
 like
  this:
 
  - create a read/write method on each class.  Every class that needs
 to be
  stored must have this.  This includes class you would store (eg
 Figure) and
  things that are member variables of those classes.
 
  - Each class stores a version number along with it's data which
 represents
  the version of the persistent representation for that class.  So each
 class
  has its own, internal versioning scheme that represents a specific
 set of
  variables with specific types.
 
  - The read method on each class must check the version number and
 then read
  the appropriate data for that version of itself.  Whenever the
 persistent
  representation of the class changes (usually if the member variables
  change), you increment the version number.  Implicit in this is that
 if you
  change the member variables of a class, the class read method must be
 able
  to convert the variables that existed in the older version of itself
 into
  the new member variables (since that's what the new methods on that
 class
  will be using)
 
  FYI It is possible to use pickle to do this but you can't rely on
 pickle to
  automatically save the member dictionary.  You need to implement
  __getstate__ and __setstate__ and have them incorporate a version
 number in
  the dictionary they return.  In addition, you shouldn't blindly save
 every
  member variable.  If member variables can be constructed in terms of
 other
  data, it may be better to store that data and then reconstruct the
 member
  variables in the __setstate__ method.
 
  Using this type of system, you get a hierarchy of objects that each
 have
  their own, internal versioning system.  This lets you make changes to
 a
  single class, increment it's version, and update its save/load
 methods and
  it won't affect any other part of the system and still retains
 backwards
  reading capability.
 
  Ted
 
 Sounds good--for some applications--but I would strongly oppose adding
 this additional level of complexity to mpl.  It's just not worth it.
 If
 you want to be able to work with a plot, then generate it with a
 script,
 and save the data and the script.  That is the user's responsibility,
 not mpl's.
 
 Unless mpl is taken over by a cadre of full-time professional
 programmers, we have to try to keep it accessible to people who can
 only
 work on it sporadically.  That means we need to try to keep it
 simple--indeed, to work on simplifying it and cleaning up the rough
 edges, and to work on maintaining a design that makes it easy to
 improve
 the real plotting capabilities and ease-of-use.
 
 Eric
 
 
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of
  Eric Firing
  Sent: Tuesday, September 16, 2008 7:04 PM
  To: John Hunter
  Cc: Josef Koller; matplotlib-users@lists.sourceforge.net
  Subject: Re: [Matplotlib-users] save or pickle figure object
 
  John Hunter wrote:
  On Tue, Sep 16, 2008 at 5:06 PM, Josef Koller [EMAIL PROTECTED]
  wrote:
  Hi folks,
   I would like to save preliminary figures for later processing and
  refinement with matplotlib. Is there a way to save or pickle a
  figure
  object and later reload it. Matlab has a feature like that and and
 I
  was
  wondering if matplotlib has it too.
  No, it doesn't exist.  We've taken a stab at it once or twice, but
  have been stymied because we make extensive use of a python
 extension
  libray CXX, and these objects have resisted our attempts to pickle
  them.  With our recent transforms refactoring, which removes the
  hairiest CXX dependency, it may be worth taking another look, but
  noone is currently working on it.
  My sense, based on very little experience, is that pickles of
  complicated objects are very fragile, so even if we could pickle
  figures, I fear it might cause more trouble (I can't load this
  absolutely critical figure I pickled 6 months ago) than it would be
  worth.
 
  Eric
 
  
 ---
  --
  This SF.Net email is sponsored by the Moblin Your Move Developer's
  challenge
  Build the coolest Linux based applications with Moblin SDK  win
 great
  prizes
  Grand prize is a trip for two

Re: [Matplotlib-users] Toolbar in QT

2008-05-08 Thread Ted Drain
The toolbar is just a widget  so you can do that the same way you show any
other widget in Qt.  Something along the lines of:

 

-  build a widget

-  add a layout

-  add the figure widget to the layout

-  add the toolbar to the layout

-  connect them together  (I forget exactly how but backend_qt.py
has all the code that does this)

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Behnam
Kamrani
Sent: Thursday, May 08, 2008 11:19 AM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Toolbar in QT

 

Hi, 
First I want to thanks for this amazing Matplotlib. It's fantastic!

My newbie question is how I can show the (zoom, pan, etc) toolbar in
embedding_in_qt.py example?

I have noticed that in animation_blit_qt.py the toolbar is available, but it
seems to be done in a different way. 

Appreciate your help! 
Thank you,
/Ben

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PNG filesize

2008-03-21 Thread Ted Drain
I'd guess PNG won't get much smaller because you have a lot of different
colored pixels.  PNG compresses most when you have a sparser plot.  I'd
suggest that you try using JPG.  It will compress the multi-colored portion
of your plot way down.  You may see a few artifacts if you look carefully at
the axes: instead of pixels white,black,white you might get
white,grey,black,grey,white.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
 Einar M. Einarsson
 Sent: Monday, March 17, 2008 5:08 AM
 To: matplotlib-users@lists.sourceforge.net
 Subject: [Matplotlib-users] PNG filesize
 
 
 Hi all,
 
 I'm trying to find ways to make the file-size of my PNG images smaller.
 
 When I generate my 660*440px image I get a big 168kb file.
 (8bit RGB color model, has  an alpha channel (need that) but no
 interlacing scheme)
 
 Here it is:
 http://metphys.org/eme/T05.png
 
 I'm using the savefig method of-course.
 
 
 To see how much I could compress it I used pngcrush (the best tool
 according to the interwebs) and got it down to 128kb.
 
 But thats still way to large for my intended use. (plotting results
 from an operational weather model, see. www.belgingur.is
 We are currently using IDL.)
 
  From what I've read about PNG files, which is supposed to be rather
 compact image format, it seems to me that the most effective way is
 to have an indexed color table.
 
 So to cut it short:
 
 Is there any way to save a PNG file with an indexed color table?
 
 Or do you see any other way to shrink the files?
 
 
 Best regards.
 Einar M. Einarsson
 www.belgingur.is
 
 ---
 --
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2008.
 http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Efficient scatter() w/ markers from plot()?

2008-03-20 Thread Ted Drain
Thanks!  I had originally just tried it (ignoring the docs) but my plot just
showed dots instead of markers for both 'x' and '+'.  Then I read the docs
which seemed to indicate they wouldn't work.

Late last night I was digging through axes.py and noticed that they should
be supported (and I found the scatter example that uses them).  My problem
was that the point scale input needed to be 3-4 times larger than the
default value for the marker to be visible.  Once I changed that, everything
worked fine.

Thanks for the doc patch - that will help everyone else in the future...

Ted

 -Original Message-
 From: Manuel Metz [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 20, 2008 1:13 AM
 To: Ted Drain
 Cc: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] Efficient scatter() w/ markers from
 plot()?
 
 Ted Drain wrote:
  I need to efficiently plot a set of x,y points where each point has a
  different color.  I tried multiple calls to plot() with a single
 point each
  but that is way too slow.  I switched to using scatter() and passing
 in a
  list of colors which works great.  However, I'd really like to have
 the
  marker options from plot() (things like '+' and 'x') which don't work
 w/
  scatter.
 
  What's the easiest way to get the markers from plot() with the
 efficiency
  (and multi-colors) from scatter?
 
  Thanks,
  Ted
 
 
 Hi Ted,
 oh - you can use '+' and 'x' and many more markers with scatter. It's
 unfortunately just not documented in the current release but is fixed
 in
 the repository.
 
pylab.scatter(x,y, marker=(4,2))
 
 gives a '+', and
 
pylab.scatter(x,y, marker=(4,2,math.pi/4.))
 
 gives a 'x'. The logic is a follows:
 
marker(numside, type, angle)
 
 numside is the number of edges, i.e. 4 for a plus or a cross.
 
 type : 0 - a filled symbol,
 1 - a star-like symbol,
 2 - a asterisk like symbol
 
 angle: the symbol gets rotated by this angle
 
 So in principle with this you can produce an endless number of
 different
 markers... :-)
 
 Manuel
 
 --
 ---
Manuel Metz    [EMAIL PROTECTED]
Argelander Institut fuer Astronomie
Auf dem Huegel 71 (room 3.06)
D - 53121 Bonn
 
E-Mail: [EMAIL PROTECTED]
Web:www.astro.uni-bonn.de/~mmetz
Phone:  (+49) 228 / 73-3660
Fax:(+49) 228 / 73-3672
 ---


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Efficient scatter() w/ markers from plot()?

2008-03-19 Thread Ted Drain
I need to efficiently plot a set of x,y points where each point has a
different color.  I tried multiple calls to plot() with a single point each
but that is way too slow.  I switched to using scatter() and passing in a
list of colors which works great.  However, I'd really like to have the
marker options from plot() (things like '+' and 'x') which don't work w/
scatter.

What's the easiest way to get the markers from plot() with the efficiency
(and multi-colors) from scatter?

Thanks,
Ted


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Create powerpoint slide and/or presentation from script?

2008-02-11 Thread Ted Drain
Thanks!  Is econpy still under development?

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
 Alan G Isaac
 Sent: Monday, February 11, 2008 10:00 AM
 To: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] Create powerpoint slide and/or
 presentation from script?
 
 On Mon, 11 Feb 2008, Ted Drain apparently wrote:
  Does anyone know of a way to create a powerpoint slide from a plot?
 
 URL:http://code.google.com/p/econpy/source/browse/trunk/utilities/mso.
 py
 
 hth,
 Alan Isaac
 
 
 
 
 ---
 --
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2008.
 http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Create powerpoint slide and/or presentation from script?

2008-02-11 Thread Ted Drain
Does anyone know of a way to create a powerpoint slide from a plot?  I'm
assuming that it's possible to have a script that savse a PNG of the plot
and then use a VB (or preferably python) script to create a slide (or append
that slide to an existing presentation).   

I've google'ed around but I'm having trouble finding a decent example of
doing this on the web.  Any examples would be greatly appreciated.

Thanks,
Ted


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap:'snapback' on line crossing global plot edge

2007-08-02 Thread Ted Drain
I don't think so.  We always manually check for horizontal and 
vertical axis crossings and split the line as many times as necessary.

At 03:31 PM 8/2/2007, James Boyle wrote:
This is probably for Jeff but maybe someone else has an answer.
If I plot a satellite orbit on the globe when the groundtrack passes
the edge of the map - in this case the Greenwich meridian  - the
line  'snaps back ' across the plot where the line picks up on the
other side of the globe.
The attached plot shows the problem, note the line across the
northern polar regions. I have encountered this before. In this case
I can break the ground track into two segments, one up to and
including Greenwich and the other from Greenwich eastward.

My question: Is there a more elegant way to deal with this situation
in Basemap? I have a nagging feeling that Jeff has addressed this
issue but I cannot find anything in the examples.

--Jim



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Replotting inside a while loop

2007-01-23 Thread Ted Drain
See the docs on interactive mode...
http://matplotlib.sourceforge.net/interactive.html

At 10:39 AM 1/23/2007, Tommy Grav wrote:

On Jan 23, 2007, at 1:28 PM, Darren Dale wrote:

  On Tuesday 23 January 2007 13:20, Tommy Grav wrote:
  I have a program that enters a while loop, calculates a bunch of
  arrays and then plots
  a figure. The user then looks at the figure and is asked wether the
  result is ok. If the
  answer is no, then the calculations are redone and the figure
  replotted. If the answer is
  yes then it exits the loop.
 
  import pylab as p
 
  end = False
 
  while not end:
   (x,y,z) = calculate_arrays()
   figure(1)
   subplot(211)
   plot(x,z)
   subplot(212)
   plot(x,y)
   draw()
 
   end = confirm(is the plot ok?)
   clf()
 
  However using the draw() command does not display the figure. How do
  I do this?
 
  try show()

While show() does display the figure it does not work for me as it
will lock
up the script, so it never makes it to the end = confirm() line.

Cheers
 Tommy

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2D Intensity Plots of Titan

2006-07-12 Thread Ted Drain
matplotlib+basemap may do it for you.  I'm not sure how much of it's hard 
coded for the Earth though...

http://www.scipy.org/Cookbook/Matplotlib/Maps



At 08:49 AM 7/12/2006, Jeff Sadino wrote:
I am trying to map the surface of Saturn's largest moon, Titan for a 
summer research project.  As a rough draft, I would like to plot the 
temperature (colored red) at the longitude(x) and latitude(y) 
coordinates.  My data file is tab delimited in three columns (x,y,T).  I 
am also missing some x,y locations, which I would like to leave blank.

As a final report, I would like the data point to be able to take on 
different geometries (circle, hexagon, arbitrary shape, etc) and different 
sizes as well as be able to overlap with neighboring data 
points.  Finally, I would like to be able to plot this not on a 
rectangular cartesion coordinate system, but on a planetographic (global 
projection) coordinate system.

I've spent two days trying everything from gnuplot, matlab, matplotlib and 
others trying to do this, but to no avail.  Any suggestions would be very 
welcomed.



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Ted Drain Jet Propulsion Laboratory   [EMAIL PROTECTED]




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users