Re: [Matplotlib-users] imshow memory problem

2010-05-18 Thread Tomáš Faragó
Thanks for replying Mike,
I tried it on Linux as well but I ran into the same problem. Perhaps it has 
something to do with other needed libraries (GTK+, etc.). Can you please tell 
me your libraries versions? I mean GTK+, pygtk, etc. Also output produced by 
--verbose-helpful could be useful. Thank you.
Tomas.



  Pôvodná správa 
 Od: Michael Droettboom md...@stsci.edu
 Predmet: Re: [Matplotlib-users] imshow memory problem
 Dátum: 17.5.2010 16:48:55
 
 On Linux, I only see about an extra 24kb being used when the canvas is 
 added to a window vs. not adding it (i.e. commenting out the 
 window.add(canvas) line).
 
 In general, here's the memory usage to be expected from imshow (if it's 
 a floating-point, not-rgb(a) array as you have here):
 
 The original data: 4-bytes-per-pixel for float32 or 8-bytes-per-pixel 
 for float64 (in your example the array is float64).
 Intermediate float data: *if* the original is not float64, then an 
 intermediate float64 is created (not the case here)
 The colorized data: 4-bytes-per-pixel at original array size
 The sized data: 4-bytes-per-pixel at the scaled figure size
 
 I hope I'm not forgetting anything, but the point is that to support 
 high-speed rendering of plots, the memory usage is much greater than the 
 data itself.  If your data is truly large, the usual technique is to 
 decimate or downsample it before passing it to matplotlib, as you're not 
 going to see more data points than pixels on your display anyway.
 
 Mike
 
 Tomáš Faragó wrote:
  Hello,
  I am writing a GUI using GTK+ library. I have a question about axes class
 imshow method memory consumtion. If I pass the imshow an array, the resulting
 memory consuption is approximatelly 46 times greater than the array size. If I
 do not add the canvas to a window (in a code below), the memory consuption is
 only 8 times greater. Any tips on how to reduce the memory consuption would 
 be
 very appreciated and any explanation of how much memmory imshow allocates too.
 Configuration and script are below.
 
  os: Windowx XP
  matplotlib version: 0.99.1
  downloaded from: sourceforge.net
 
  script:
  from matplotlib.figure import Figure
  from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
  from pylab import rand
  import gtk
 
  window = gtk.Window()
  window.connect(destroy, gtk.main_quit)
 
  figure = Figure(figsize=(8,6), dpi=72)
  canvas = FigureCanvasGTKAgg(figure)
  axes = figure.add_subplot(111)
 
  window.add(canvas)
 
  axes.imshow(rand(1024,1024))
  canvas.draw()
  window.show_all()
 
  gtk.main()
 
  verbose-helpful output:
  $HOME=C:\Documents and Settings\Sensej
  CONFIGDIR=C:\Documents and Settings\Sensej\.matplotlib
  matplotlib data path C:\Python26\lib\site-packages\matplotlib\mpl-data
  loaded rc file 
  C:\Python26\lib\site-packages\matplotlib\mpl-data\matplotlibrc
  matplotlib version 0.99.1
  verbose.level helpful
  interactive is False
  units is False
  platform is win32
  Using fontManager instance from C:\Documents and
 Settings\Sensej\.matplotlib\fontList.cache
  backend GTKAgg version 2.12.1
  findfont: Matching
 :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
 to Bitstream Vera Sans
 (C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf) with
 score of 0.00
 
  Thank you,
  Tomas.
 
 
 --
 
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 
 -- 
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA
 
 
 
 

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] py2exe and matplotlib errors when executing exe

2010-05-18 Thread New2Python

Thanks, must have skipped over that one - I added the statements and it has
fixed it :) however now there is an issue elsewhere. I get the message

  File matplotlib\backends\__init__.pyo, line 25, in pylab_setup
ImportError: No module named backend_tkagg

and the traceback call this

from pylab import *

I have _tkagg as an exclude

looks like somebody else had this problem but nobody solved it
http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html

any one know how to solve this?

I tried to include matplotlib.backends.backend_tkagg, then this popped up
with a tkinter import error.

Regards

Marco






New2Python wrote:
 
 Hi All,
 
 I hope someone can help, I have run into a few problems when trying to
 execute an exe file created when I use py2exe with matplotlib.
 I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
 optimisation is python -OO
 the files compile correctly however when I execute the exe I get an error
 as shown below
 this is an extract
 
   File matplotlib\mlab.pyo, line 380, in module
 TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
 
 the traceback points to this line of my code
 
 from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
 
 does anyone know how to solve this, i have seen references made to numpy
 but not matplotlib
 
 Regards
 
 Marco
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/py2exe-and-matplotlib-errors-when-executing-exe-tp28589875p28595304.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] draw coastlines without lakes

2010-05-18 Thread Richard Hofmeister
Hi,

I wanted to plot a coastline of Scandinavia with basemap in intermediate 
resolution without lakes.
The method i found was to draw the coastlines with the plot command 
using the coastline polygons from the projection.
(see example below, the lakes are filled with a slightly darker gray for 
illustration).
Please reply, if a more condensed version (e.g. 
proj.drawcoastlines(draw_lakes=False ?) is existing.

from pylab import *
from mpl_toolkits.basemap import Basemap

proj = Basemap(projection='lcc',
resolution='i',
llcrnrlon=9.0,
llcrnrlat=53.0,
urcrnrlon=35.0,
urcrnrlat=65.3,
lat_0=55.0,
lon_0=14.0)

figure()
for i,cp in enumerate(proj.coastpolygons):
 if proj.coastpolygontypes[i]2:
 proj.plot(cp[0],cp[1],'k-')

proj.fillcontinents([0.8,0.8,0.8],lake_color=[0.75,0.75,0.75])
proj.drawmeridians(arange(12,30,4),linewidth=0.3,labels=[0,0,0,1])
proj.drawparallels(arange(54,67,2),linewidth=0.3,labels=[1,0,0,0])
show()

Richard

(i am using basemap v0.99.5)

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hist question...

2010-05-18 Thread Nick Schurch
Hi all,

Is there anyway of re-ploting the distribution generated by hist at a
later point? I want to call it in a subroutine and have the resulting
distributions returned so I can plot them without having to
recalculate them each time. I couldn't find anything int he online
documentation but I figured it'd be something like:

import matplotlib.pyplot as plt
hplot=plt.hist(data, bins=1000)

plt.hist(hplot)
or
plt.hist(hplot[0],bins=hplot[1])
or
plt.plot(hist)


etc, but nothing works.

-- 
Cheers,

Nick Schurch

Data Analysis Group (The Barton Group),
School of Life Sciences,
University of Dundee,
Dow St,
Dundee,
DD1 5EH,
Scotland,
UK

Tel: +44 1382 388707
Fax: +44 1382 345 893

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib font in cairo

2010-05-18 Thread Michael Droettboom
We went through this a few years ago on the Cairo mailing list. 

The short answer is you need to copy the fonts from mpl-data to 
C:\Windows\Fonts to correctly use Cairo.

The long answer: Cairo uses fontconfig for font lookup, which by default 
searches the system font directory (C:\Windows\Fonts).  There is an 
fontconfig API to add another font directory to search, but it is not 
exposed to Python.  The cairo guys don't want to expose it in pycairo 
because that API is not technically part of cairo, but there isn't a 
proper Python wrapper to fontconfig, so until one is created we're sort 
of left with our hands tied.

This is probably worthy of a FAQ in the docs.

Mike

copyrig...@gmx.de wrote:
 Hallo,

 I'm try to use MathTextParser output for cairo in my wxpython gui. Works well 
 under ubunutu linux (maybe dublicated font) but fails under windows 
 (screenshot: http://www.ubuntu-pics.de/bild/62985/auswahl_017_RC86gk.png ).

 How to tell cairo to use the font file from mpl-data?

 Here some code:

 from matplotlib.mathtext import MathTextParser
 from matplotlib.font_manager import ttfFontProperty
 import wx
 import wx.lib.wxcairo
 import cairo

 #...
 MPC = MathTextParser(Cairo)
 dc = wx.BufferedPaintDC(self)
 ctx = wx.lib.wxcairo.ContextFromDC(dc)
 #...
 width, height, descent, glyphs, rects = 
 self.mathtext_parser.parse(r$a_0+a_1\xi+a_2\xi^2+a_3\xi^3$,dpi,prop)
 #...

 for font, fontsize, s, ox, oy in glyphs:
#...
fontProp = ttfFontProperty(font)
#...
ctx.select_font_face (fontProp.name,
  self.fontangles [fontProp.style],
  self.fontweights[fontProp.weight])

#...
ctx.show_text(s.encode(utf-8))
#...
 #...

 greetz

 Frank

 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] crop white space of image

2010-05-18 Thread Ryan May
On Mon, May 17, 2010 at 6:07 AM, Ruben Moor ruben.m...@gmail.com wrote:
 Hello,
 I plot views of 3D data without axis. The plotting results usually in plenty
 of surrounding white space. Is there an easy way to get rid of it (easy
 meaning without having to keep track of the spacial extension of my 3D data)
 ?

figure.subplots_adjust() can be used to control various margins within
the figure. When saving with savefig(), you can also specify
bbox_inches='tight' which tells it to figure out the actual bounding
box of you plot for saving, which eliminates a lot of whitespace.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] py2exe and matplotlib errors when executing exe

2010-05-18 Thread Michael Droettboom
It should only try to import that backend when configured to do so.  You 
may need to change your matplotlibrc to point to your desired backend.

Mike

New2Python wrote:
 Thanks, must have skipped over that one - I added the statements and it has
 fixed it :) however now there is an issue elsewhere. I get the message

   File matplotlib\backends\__init__.pyo, line 25, in pylab_setup
 ImportError: No module named backend_tkagg

 and the traceback call this

 from pylab import *

 I have _tkagg as an exclude

 looks like somebody else had this problem but nobody solved it
 http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html

 any one know how to solve this?

 I tried to include matplotlib.backends.backend_tkagg, then this popped up
 with a tkinter import error.

 Regards

 Marco






 New2Python wrote:
   
 Hi All,

 I hope someone can help, I have run into a few problems when trying to
 execute an exe file created when I use py2exe with matplotlib.
 I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
 optimisation is python -OO
 the files compile correctly however when I execute the exe I get an error
 as shown below
 this is an extract

   File matplotlib\mlab.pyo, line 380, in module
 TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'

 the traceback points to this line of my code

 from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg

 does anyone know how to solve this, i have seen references made to numpy
 but not matplotlib

 Regards

 Marco




 

   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] align title of subplot with ylabel

2010-05-18 Thread Ryan May
On Mon, May 17, 2010 at 10:08 AM, hettling hettl...@few.vu.nl wrote:
 Dear all,

 I'm struggling with the following problem plotting my data:

 I have a figure with two panels next to each other, which I want to
 label 'A' and 'B'. I want to left-justify my panel labels, but not to
 the box that contains the plot, but to the y-axis label. I played around
 with 'text()' and 'title()', but did not find a good solution except for
 giving the coordinates manually to 'text()'. This would be very
 inconvenient though, because I have many different plots on different
 scales.
 Here is what I tried:

 ###Code
 import scipy
 import matplotlib.pyplot as plt

 fig = plt.figure()
 ax = fig.add_subplot(121)
 plt.plot(scipy.sin(scipy.arange(1,100, 0.001)))
 plt.xlabel('xlabel')
 plt.ylabel(ylabel)
 plt.text(0,1,A, fontsize=14, transform=ax.transAxes)

 ax = fig.add_subplot(122)
 plt.plot(scipy.cos(scipy.arange(1,100, 0.001)))
 plt.text(0,1,B, fontsize=14, transform=ax.transAxes)
 plt.xlabel('xlabel')
 ###End Code

 So the texts 'A' and 'B' should be a little bit higher and more to the
 left. The 'A' I want to align with the y-axis label of the left plot,
 the 'B' with the values of the y-axis of the right plot.

I haven't thought through the solution completely, but my intuition
says that this might be helpful:

http://matplotlib.sourceforge.net/examples/pylab_examples/anchored_artists.html
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#anchoredartists

These examples show ways of anchoring artists (like Text) to certain
locations. It's probably your best bet for getting what you want.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow memory problem

2010-05-18 Thread Tomáš Faragó
I am using pmap -pid on Linux and Task manager on Windows. Memory usage is 
comparable on both operating systems so I think the memory consumption 
information is accurate.



  Pôvodná správa 
 Od: Michael Droettboom md...@stsci.edu
 Predmet: Re: [Matplotlib-users] imshow memory problem
 Dátum: 18.5.2010 16:18:23
 
 What are you using to calculate memory usage?  I feel the only truly 
 reliable tool is something instrumented like valgrind --tool=massif.
 
 
 BUILDING MATPLOTLIB
 matplotlib: 1.0.svn
 python: 2.5.2 (r252:60911, May  7 2008, 12:40:32)  [GCC
 3.4.6 20060404 (Red Hat 3.4.6-9)]
   platform: linux2
 
 REQUIRED DEPENDENCIES
  numpy: 2.0.0.dev8055
  freetype2: 9.16.3
 
 OPTIONAL BACKEND DEPENDENCIES
 libpng: 1.2.37
Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
   wxPython: 2.8.6.1
 * WxAgg extension not required for wxPython = 2.8
   Gtk+: gtk+: 2.10.9, glib: 2.16.1, pygtk: 2.10.4,
 pygobject: 2.13.1
Mac OS X native: no
 Qt: Qt: 3.3.3, PyQt: 3.17.2
Qt4: Qt: 4.6.2, PyQt4: 4.7.3
  Cairo: 1.4.0
 
 OPTIONAL DATE/TIMEZONE DEPENDENCIES
   datetime: present, version unknown
   dateutil: 1.4.1
   pytz: 2008c
 
 OPTIONAL USETEX DEPENDENCIES
 dvipng: 1.12
ghostscript: 7.07
  latex: 3.1415926
pdftops: 3.00
 
 verbose-helpful:
 
 $HOME=/home/mdroe
 CONFIGDIR=/home/mdroe/.matplotlib
 matplotlib data path 
 /home/mdroe/usr/lib/python2.5/site-packages/matplotlib/mpl-data
 loaded rc file /home/mdroe/.matplotlib/matplotlibrc
 matplotlib version 1.0.svn
 verbose.level helpful
 interactive is False
 units is False
 platform is linux2
 Using fontManager instance from /home/mdroe/.matplotlib/fontList.cache
 backend GTKAgg version 2.10.4
 findfont: Matching 
 :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
 
 to Bitstream Vera Sans 
 (/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
 
 with score of 0.00
 
 
 Tomáš Faragó wrote:
  Thanks for replying Mike,
  I tried it on Linux as well but I ran into the same problem. Perhaps 
  it has something to do with other needed libraries (GTK+, etc.). Can 
  you please tell me your libraries versions? I mean GTK+, pygtk, etc. 
  Also output produced by --verbose-helpful could be useful. Thank you.
  Tomas.
 
 
   Pôvodná správa 
  Od: Michael Droettboom md...@stsci.edu
  Predmet: Re: [Matplotlib-users] imshow memory problem
  Dátum: 17.5.2010 16:48:55
  
  On Linux, I only see about an extra 24kb being used when the canvas 
  is added to a window vs. not adding it (i.e. commenting out the 
  window.add(canvas) line).
 
  In general, here's the memory usage to be expected from imshow (if 
  it's a floating-point, not-rgb(a) array as you have here):
 
  The original data: 4-bytes-per-pixel for float32 or 8-bytes-per-pixel 
  for float64 (in your example the array is float64).
  Intermediate float data: *if* the original is not float64, then an 
  intermediate float64 is created (not the case here)
  The colorized data: 4-bytes-per-pixel at original array size
  The sized data: 4-bytes-per-pixel at the scaled figure size
 
  I hope I'm not forgetting anything, but the point is that to support 
  high-speed rendering of plots, the memory usage is much greater than 
  the data itself.  If your data is truly large, the usual technique is 
  to decimate or downsample it before passing it to matplotlib, as 
  you're not going to see more data points than pixels on your display 
  anyway.
 
  Mike
 
  Tomáš Faragó wrote:
   Hello,
   I am writing a GUI using GTK+ library. I have a question about axes 
  class
  imshow method memory consumtion. If I pass the imshow an array, the 
  resulting
  memory consuption is approximatelly 46 times greater than the array 
  size. If I
  do not add the canvas to a window (in a code below), the memory 
  consuption is
  only 8 times greater. Any tips on how to reduce the memory 
  consuption would be
  very appreciated and any explanation of how much memmory imshow 
  allocates too.
  Configuration and script are below.
  
   os: Windowx XP
   matplotlib version: 0.99.1
   downloaded from: sourceforge.net
  
   script:
   from matplotlib.figure import Figure
   from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
   from pylab import rand
   import gtk
  
   window = gtk.Window()
   window.connect(destroy, gtk.main_quit)
  
   figure = Figure(figsize=(8,6), dpi=72)
   canvas = FigureCanvasGTKAgg(figure)
  

Re: [Matplotlib-users] align title of subplot with ylabel

2010-05-18 Thread Jae-Joon Lee
This can be done relatively easily with the current svn version of
matplotlib (r8319).
Below is the modified version of your code.

See

http://matplotlib.sourceforge.net/trunk-docs/users/annotations_guide.html#using-complex-coordinate-with-annotation

for how the annotation works.

While this is certainly possible with the released version, but it
will require you to write a few tens of lines of code. Basically, you
need create a custom Text class that update its position during the
drawing time.

Regards,

-JJ

###Code
import scipy
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(121)
plt.plot(scipy.sin(scipy.arange(1,100, 0.001)))
plt.xlabel('xlabel')
yl = plt.ylabel(ylabel)

plt.annotate(A, (0,1.), xycoords=(yl, axes fraction),
 xytext=(0, 14), textcoords=offset points,
 fontsize=14)

ax = fig.add_subplot(122)
plt.plot(scipy.cos(scipy.arange(1,100, 0.001)))
plt.xlabel('xlabel')

my_ticklabel = ax.get_yticklabels()[-2]
# Note that there is no guarantee that all ticklabels are drawn.
plt.annotate(B, (0,1.), xycoords=(my_ticklabel, axes fraction),
 xytext=(0, 14), textcoords=offset points,
 fontsize=14)

###End Code


On Mon, May 17, 2010 at 11:08 AM, hettling hettl...@few.vu.nl wrote:
 Dear all,

 I'm struggling with the following problem plotting my data:

 I have a figure with two panels next to each other, which I want to
 label 'A' and 'B'. I want to left-justify my panel labels, but not to
 the box that contains the plot, but to the y-axis label. I played around
 with 'text()' and 'title()', but did not find a good solution except for
 giving the coordinates manually to 'text()'. This would be very
 inconvenient though, because I have many different plots on different
 scales.
 Here is what I tried:

 ###Code
 import scipy
 import matplotlib.pyplot as plt

 fig = plt.figure()
 ax = fig.add_subplot(121)
 plt.plot(scipy.sin(scipy.arange(1,100, 0.001)))
 plt.xlabel('xlabel')
 plt.ylabel(ylabel)
 plt.text(0,1,A, fontsize=14, transform=ax.transAxes)

 ax = fig.add_subplot(122)
 plt.plot(scipy.cos(scipy.arange(1,100, 0.001)))
 plt.text(0,1,B, fontsize=14, transform=ax.transAxes)
 plt.xlabel('xlabel')
 ###End Code

 So the texts 'A' and 'B' should be a little bit higher and more to the
 left. The 'A' I want to align with the y-axis label of the left plot,
 the 'B' with the values of the y-axis of the right plot.

 I hope my question is clear, I will appreciate any help!

 Thanks in advance,

 Hannes


 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to remove an element from a graph?

2010-05-18 Thread Jae-Joon Lee
On Sun, May 16, 2010 at 3:19 PM, Philipp K. Janert
pyt...@beyondcode.org wrote:
 Is this the best way to do this, or is there another way
 (or one that does not require an explicit draw()?). Also,

Any change in your figure is realized when you draw() the figure. So
there is no way that does not require an explicit draw.

An alternative is to make the artist invisible (use set_visible method).

 what if I have failed to save the text instance - do I have
 to walk the object tree using findobj()?


All the artists that are drawn are kept in the figure instance, so you
can inspect the figure instance.
And you may use findobj for that if you want.
On the other hand, Axes.texts keeps a list of text instances in the
axes (e.g., gca().texts).

Regards,

-JJ

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to remove an element from a graph?

2010-05-18 Thread John Hunter
On Tue, May 18, 2010 at 12:58 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:

 All the artists that are drawn are kept in the figure instance, so you
 can inspect the figure instance.
 And you may use findobj for that if you want.
 On the other hand, Axes.texts keeps a list of text instances in the
 axes (e.g., gca().texts).


For more detail see the artist tutorial which describes the various
containers and how to remove objects from them


http://matplotlib.sourceforge.net/users/artists.html#axes-container

JDH

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to remove an element from a graph?

2010-05-18 Thread Philipp K. Janert

Thanks.

On Tuesday 18 May 2010 12:13:27 pm John Hunter wrote:
 On Tue, May 18, 2010 at 12:58 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:
  All the artists that are drawn are kept in the figure instance, so you
  can inspect the figure instance.
  And you may use findobj for that if you want.
  On the other hand, Axes.texts keeps a list of text instances in the
  axes (e.g., gca().texts).

 For more detail see the artist tutorial which describes the various
 containers and how to remove objects from them


 http://matplotlib.sourceforge.net/users/artists.html#axes-container

 JDH

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] is it possible to continue to Debug when figure is created??

2010-05-18 Thread Alan G Isaac
First of all, what are you trying to do?
What does figure is created mean.
Do you need it to be drawn on the monitor?
Why not save your figure(s) to file(s)?

Cheers,
Alan

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hist question...

2010-05-18 Thread PHobson
Nick,

Check out this demo on the MPL website:
http://matplotlib.sourceforge.net/examples/api/histogram_demo.html

This line in particular:
n, bins, patches = ax.hist(x, 50, normed=...)

The variables 'n' and 'bins' can be fed into ax.bar() later on. I could swear 
that this was clear from the docstring, but that's definitely not the case 
anymore. I'll submit a patch to the list tomorrow if I can remember to work on 
it some tonight. 

Do see the docstring for an explanation of what can be done with the 'patches' 
variable.

Hope this helps,
-paul

 -Original Message-
 From: Nick Schurch [mailto:n.schu...@dundee.ac.uk]
 Sent: Tuesday, May 18, 2010 6:56 AM
 To: matplotlib-users@lists.sourceforge.net
 Subject: [Matplotlib-users] hist question...
 
 Hi all,
 
 Is there anyway of re-ploting the distribution generated by hist at a
 later point? I want to call it in a subroutine and have the resulting
 distributions returned so I can plot them without having to
 recalculate them each time. I couldn't find anything int he online
 documentation but I figured it'd be something like:
 
 import matplotlib.pyplot as plt
 hplot=plt.hist(data, bins=1000)
 
 plt.hist(hplot)
 or
 plt.hist(hplot[0],bins=hplot[1])
 or
 plt.plot(hist)
 
 
 etc, but nothing works.
 
 --
 Cheers,
 
 Nick Schurch
 
 Data Analysis Group (The Barton Group),
 School of Life Sciences,
 University of Dundee,
 Dow St,
 Dundee,
 DD1 5EH,
 Scotland,
 UK
 
 Tel: +44 1382 388707
 Fax: +44 1382 345 893
 
 -
 -
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Gnuplot-py-users] is it possible to continue to Debug when figure is created??

2010-05-18 Thread Alan G Isaac
 http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show


Here is some more detail, that I actually think
should be added to the above link.
http://stackoverflow.com/questions/458209/is-there-a-way-to-detach-matplotlib-plots-so-that-the-computation-can-continue

hth,
Alan Isaac


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] py2exe and matplotlib errors when executing exe

2010-05-18 Thread New2Python

Thanks, I changed the matplotlibrc file to use the WXAgg backend and then had
to copy the file into the mpl.get_configdir() and in my local working dir
for it to work.

The file runs however a python error screen pops up and then closes without
giving me the chance to read it, anybody know how to stop the window from
closing so quickly

Thanks

Marco



Michael Droettboom-3 wrote:
 
 It should only try to import that backend when configured to do so.  You 
 may need to change your matplotlibrc to point to your desired backend.
 
 Mike
 
 New2Python wrote:
 Thanks, must have skipped over that one - I added the statements and it
 has
 fixed it :) however now there is an issue elsewhere. I get the message

   File matplotlib\backends\__init__.pyo, line 25, in pylab_setup
 ImportError: No module named backend_tkagg

 and the traceback call this

 from pylab import *

 I have _tkagg as an exclude

 looks like somebody else had this problem but nobody solved it
 http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html

 any one know how to solve this?

 I tried to include matplotlib.backends.backend_tkagg, then this popped up
 with a tkinter import error.

 Regards

 Marco






 New2Python wrote:
   
 Hi All,

 I hope someone can help, I have run into a few problems when trying to
 execute an exe file created when I use py2exe with matplotlib.
 I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
 optimisation is python -OO
 the files compile correctly however when I execute the exe I get an
 error
 as shown below
 this is an extract

   File matplotlib\mlab.pyo, line 380, in module
 TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'

 the traceback points to this line of my code

 from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg

 does anyone know how to solve this, i have seen references made to numpy
 but not matplotlib

 Regards

 Marco




 

   
 
 -- 
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA
 
 
 --
 
 ___
 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/py2exe-and-matplotlib-errors-when-executing-exe-tp28589875p28602527.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users