SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S





1
(10)
2
(3)
3
(5)
4
(7)
5
(18)
6
(4)
7
(15)
8
(7)
9
(10)
10
(4)
11
(18)
12
(15)
13
(11)
14
(11)
15
(4)
16
(28)
17
(17)
18
(22)
19
(12)
20
(19)
21
(17)
22
(14)
23
(4)
24
(3)
25
(6)
26
(8)
27
(13)
28
(11)
29
(21)
30
(3)
31
(5)






Showing 17 results of 17

From: Darren D. <dd...@co...> - 2006年12月21日 18:47:55
On Thursday 21 December 2006 13:43, Jeff Whitaker wrote:
> Paul Novak wrote:
> > I have a problem that arose when I tried to run the gridding irregularly
> > spaced data demo on the wiki
> > http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
> >
> > When I run the attached script, which sets one value of an array to
> > nan, masks the array where there are nan, and tries to plot it using
> > contour(), I get the following errors:
> >
> > /usr/lib/python2.4/site-packages/numpy/core/ma.py:604: UserWarning:
> > Cannot automatically convert masked array to numeric because data
> > is masked in one or more locations.
> > warnings.warn("Cannot automatically convert masked array to "\
> > Traceback (most recent call last):
> > File "masked_nan.py", line 18, in ?
> > contour(x, y, z)
> > File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
> > 1754, in contour
> > ret = gca().contour(*args, **kwargs)
> > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
> > 4092, in contour
> > return ContourSet(self, *args, **kwargs)
> > File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line
> > 429, in __init__
> > x, y, z = self._contour_args(*args) # also sets self.levels,
> > File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line
> > 614, in _contour_args
> > lev = self._autolev(z, 7)
> > File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line
> > 517, in _autolev
> > zmargin = (zmax - zmin) * 0.001 # so z < (zmax + zmargin)
> > TypeError: unsupported operand type(s) for -: 'str' and 'str'
> >
> > I am using
> >
> > >>> numpy.__version__
> >
> > '1.0'
> >
> > >>> matplotlib.__version__
> >
> > '0.87.7'
> >
> > Is there a way to use contour() and plot arrays whose elements may be
> > nan?
> >
> > Thanks,
> > Paul
>
> Paul: Your test script works for me (numpy 1.0, matplotlib 0.87.7,
> python2.5 on macos x).
It worked fine for me too. Do you happen to have numerix : Numeric in your 
matplotlibrc file?
Darren
From: Jeff W. <js...@fa...> - 2006年12月21日 18:43:57
Paul Novak wrote:
> I have a problem that arose when I tried to run the gridding irregularly
> spaced data demo on the wiki
> http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
>
> When I run the attached script, which sets one value of an array to 
> nan, masks the array where there are nan, and tries to plot it using 
> contour(), I get the following errors:
>
> /usr/lib/python2.4/site-packages/numpy/core/ma.py:604: UserWarning: 
> Cannot automatically convert masked array to numeric because data
> is masked in one or more locations.
> warnings.warn("Cannot automatically convert masked array to "\
> Traceback (most recent call last):
> File "masked_nan.py", line 18, in ?
> contour(x, y, z)
> File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 
> 1754, in contour
> ret = gca().contour(*args, **kwargs)
> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 
> 4092, in contour
> return ContourSet(self, *args, **kwargs)
> File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
> 429, in __init__
> x, y, z = self._contour_args(*args) # also sets self.levels,
> File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
> 614, in _contour_args
> lev = self._autolev(z, 7)
> File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
> 517, in _autolev
> zmargin = (zmax - zmin) * 0.001 # so z < (zmax + zmargin)
> TypeError: unsupported operand type(s) for -: 'str' and 'str'
>
> I am using
> >>> numpy.__version__
> '1.0'
> >>> matplotlib.__version__
> '0.87.7'
>
> Is there a way to use contour() and plot arrays whose elements may be 
> nan?
>
> Thanks,
> Paul
Paul: Your test script works for me (numpy 1.0, matplotlib 0.87.7, 
python2.5 on macos x).
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Paul N. <pn...@ui...> - 2006年12月21日 18:22:59
Attachments: masked_nan.py
I have a problem that arose when I tried to run the gridding irregularly
spaced data demo on the wiki
http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
When I run the attached script, which sets one value of an array to nan, 
masks the array where there are nan, and tries to plot it using 
contour(), I get the following errors:
/usr/lib/python2.4/site-packages/numpy/core/ma.py:604: UserWarning: 
Cannot automatically convert masked array to numeric because data
 is masked in one or more locations.
 warnings.warn("Cannot automatically convert masked array to "\
Traceback (most recent call last):
 File "masked_nan.py", line 18, in ?
 contour(x, y, z)
 File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 
1754, in contour
 ret = gca().contour(*args, **kwargs)
 File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 
4092, in contour
 return ContourSet(self, *args, **kwargs)
 File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
429, in __init__
 x, y, z = self._contour_args(*args) # also sets self.levels,
 File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
614, in _contour_args
 lev = self._autolev(z, 7)
 File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
517, in _autolev
 zmargin = (zmax - zmin) * 0.001 # so z < (zmax + zmargin)
TypeError: unsupported operand type(s) for -: 'str' and 'str'
I am using
 >>> numpy.__version__
'1.0'
 >>> matplotlib.__version__
'0.87.7'
Is there a way to use contour() and plot arrays whose elements may be nan?
Thanks,
Paul
From: Paul N. <pn...@ui...> - 2006年12月21日 18:22:59
I don't know if this is right place to post this, but there are several
missing links on the matplotlib website. For example, all the links from
the http://matplotlib.sourceforge.net/matplotlib.numerix.html page are
missing. Those links include
http://matplotlib.sourceforge.net/matplotlib.numerix.linear_algebra.html
http://matplotlib.sourceforge.net/matplotlib.numerix.ma.html
among others.
Thanks,
Paul
From: Nicolas B. <big...@em...> - 2006年12月21日 16:28:54
Hi,
I've been using matplotlib for 2D graphing since two years. Data (3D
array) is created with a Fortran program and ploted using imshow() at a
particular plane.
3D data is created at each time iteration and saved in a file. For the
plotting part, a first imshow() is called with zero values to create the
graph and some text is displayed to describe the graph. Then the python
script read the 3D data and update the graphic using set_data(). That
way, only the "background" image is updated and not the entire graph,
resulting in a faster drawing. At each iteration, a png is saved, giving
the possibility to create a movie of the time evolution.
I would like now to replace the 2D imshow() with the 3D surface_plot().
Saddly, I cannot find a 3D equivalent to set_data(). I get the following
error :
> Traceback (most recent call last):
> File "./src/affichage/affichage_3DE.py", line 450, in updatefig
> im_ez.set_data(Z)
> File "/usr/lib/python2.4/site-packages/matplotlib/art3d.py", line 47, in __getattr__
> return getattr(self.__dict__['_wrapped'], k)
> AttributeError: PolyCollection instance has no attribute 'set_data'
So my question is:
Is there a equivalent of set_data() for surface_plot()?
Thank you very much.
Nicolas
From: Jeff W. <js...@fa...> - 2006年12月21日 15:59:22
John Hunter wrote:
>>>>>> "Paul" == Paul Cristini <pau...@un...> writes:
>>>>>> 
>
> Paul> Hi everybody, I am trying to perform interpolation on 2d
> Paul> data ( irregular or not) and I am wondering if there is a
> Paul> way to get the interpolated results which are obtained with
> Paul> the imshow command. This would allow a very complete
> Paul> interpolation command with many options. The available
> Paul> functions ( griddata, interp2d..) only provides few
> Paul> possibilities for the interpolation process.
>
> They are not readily exposed (but with a little work can be accessed
> using the existing framework) but I could write some helper methods to
> make them more easily usable. 
>
> What are your typical use cases. You do want to turn 2D grayscale
> into interpolated 2D grayscale, or 2D->interpolated RGB[A] or RGBA ->
> interpolated RGBA?
>
> The 2nd and 3rd cases can mostly be done with the existing tools,
> though some helper methods would facilitate it.
>
> JDH
> 
There's also the scipy.ndimage 
(http://www.scipy.org/SciPyPackages/Ndimage - see the Interpolate section).
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: andrea z. <qui...@gm...> - 2006年12月21日 15:02:45
Hi there,
I'm new to matplotlib...here is the problem, probably trivial:
I've 44 figures handles, and I want to show 1 only, how can I set
show() to display one of this instances?
if I call show() it opens all the 44 figures.
I'm using matplotlib 0.87.7 on ipython 0.7.1 under ubuntu dapper
thanks
a
From: John H. <jdh...@ac...> - 2006年12月21日 14:37:41
>>>>> "Paul" == Paul Cristini <pau...@un...> writes:
 Paul> Hi everybody, I am trying to perform interpolation on 2d
 Paul> data ( irregular or not) and I am wondering if there is a
 Paul> way to get the interpolated results which are obtained with
 Paul> the imshow command. This would allow a very complete
 Paul> interpolation command with many options. The available
 Paul> functions ( griddata, interp2d..) only provides few
 Paul> possibilities for the interpolation process.
They are not readily exposed (but with a little work can be accessed
using the existing framework) but I could write some helper methods to
make them more easily usable. 
What are your typical use cases. You do want to turn 2D grayscale
into interpolated 2D grayscale, or 2D->interpolated RGB[A] or RGBA ->
interpolated RGBA?
The 2nd and 3rd cases can mostly be done with the existing tools,
though some helper methods would facilitate it.
JDH
From: Darren D. <dd...@co...> - 2006年12月21日 13:45:43
On Thursday 21 December 2006 08:16, Giorgio Luciano wrote:
> I've created a shortcut in the desktop to start idle-n
> unsing C:\Python25\Lib\idlelib\idle.bat -n
> then I changed matplotlibrc and set interactive: True
> then started Idle, loaded the module and run.
> At first I had this error message...
>
> Traceback (most recent call last):
> =A0 File "C:\Python25\Lib\site-packages\prove\demo.py", line 1, in <modul=
e>
> =A0 =A0 from pylab import *
> =A0 File "C:\Python25\lib\site-packages\pylab.py", line 1, in <module>
> =A0 =A0 from matplotlib.pylab import *
> =A0 File "C:\Python25\lib\site-packages\matplotlib\pylab.py", line 220, in
> <module>
> =A0 =A0 new_figure_manager, draw_if_interactive, show =3D pylab_setup()
> =A0 File "C:\Python25\lib\site-packages\matplotlib\backends\__init__.py",
> line 23, in pylab_setup
> =A0 =A0 globals(),locals(),[backend_name])
> =A0 File
> "C:\Python25\lib\site-packages\matplotlib\backends\backend_wxagg.py",
> line 19, in <module>
> =A0 =A0 import wx
> ImportError: No module named wx
>
> naturally I installed WX wxPython2.8-win32-unicode-2.8.0.1-py25
>
> and restart the demo. plots load faster (and I needed to use show). but
> then I recalculated and restart and everything crashed again :(
> I'm frustrated .. any hints :(
> And sorry for bother I dont' want to get back to matlab
I see. When you use idle, you should set backend : TkAgg in your rc setting=
s.=20
The reason for this is discussed in the matplotlib users manual, see=20
http://matplotlib.sourceforge.net/users_guide_0.87.7.pdf.
Darren
From: Giorgio L. <gio...@ch...> - 2006年12月21日 13:27:30
It worked !!!!
I dont' know why , probably i dind't restart correctly after changing 
config but with the setting you suggest it went fine.
THANKS !! You SAVED my DAY !!
Giorgio
From: Sebastian B. <seb...@gm...> - 2006年12月21日 13:25:09
Giorgio Luciano wrote:
> ... when I restart the function ... all plots freeze.
can you give an example?
In [1]: from pylab import *
In [2]: def f(x):
 ...: return 2*x
 ...:
In [8]: plot f(array(range(10)))
------> plot(f(array(range(10))))
Out[8]: [<matplotlib.lines.Line2D instance at 0x41f41ecc>]
In [9]: show
------> show()
In [10]: def f(x):
 ....: return x*x
 ....:
In [11]: plot f(array(range(10)))
-------> plot(f(array(range(10))))
Out[11]: [<matplotlib.lines.Line2D instance at 0x43e0ea8c>]
In [12]: show
-------> show()
works here...
sebastian.
From: Giorgio L. <gio...@ch...> - 2006年12月21日 13:16:41
I've created a shortcut in the desktop to start idle-n
unsing C:\Python25\Lib\idlelib\idle.bat -n
then I changed matplotlibrc and set interactive: True
then started Idle, loaded the module and run.
At first I had this error message...
Traceback (most recent call last):
 File "C:\Python25\Lib\site-packages\prove\demo.py", line 1, in <module>
 from pylab import *
 File "C:\Python25\lib\site-packages\pylab.py", line 1, in <module>
 from matplotlib.pylab import *
 File "C:\Python25\lib\site-packages\matplotlib\pylab.py", line 220, in 
<module>
 new_figure_manager, draw_if_interactive, show = pylab_setup()
 File "C:\Python25\lib\site-packages\matplotlib\backends\__init__.py", 
line 23, in pylab_setup
 globals(),locals(),[backend_name])
 File 
"C:\Python25\lib\site-packages\matplotlib\backends\backend_wxagg.py", 
line 19, in <module>
 import wx
ImportError: No module named wx
naturally I installed WX wxPython2.8-win32-unicode-2.8.0.1-py25
and restart the demo. plots load faster (and I needed to use show). but 
then I recalculated and restart and everything crashed again :(
I'm frustrated .. any hints :(
And sorry for bother I dont' want to get back to matlab
Giorgio
From: Darren D. <dd...@co...> - 2006年12月21日 11:03:55
On Thursday 21 December 2006 5:04 am, Giorgio Luciano wrote:
> I've searched a bit in the FAQ, since in the last days I'm struggling
> with the show and close command.
> I've got a function that calculate values to plot. I calculate plot, use
> show command and everything goes fine.
> I close the figure recalculate values and then replot and everything
> freezes because the show command seems still active.
> I've tried to start IDLE using -n option but no solution. the plots
> freezes and I loose all calculations, and then I have to restart. reload
> etc..
> I tried also to turn interactive off but no way of solving.
>
> I'm using WIN XP
> python 2.5
> numpy 1.01
> scipy 0.52
> matplotlib 0.87.7
>
> and I don't want to come back to matlab :) Since in matlab it's very
> common to calculate something, recalculate, plot etc. etc.
Try setting interactive : True in your matplotlibrc file, and restart your 
idle -n session. Then you shouldn't even need to use the show() command, the 
behavior will be very similar to matlab.
Darren
From: Giorgio L. <gio...@ch...> - 2006年12月21日 10:04:13
I've searched a bit in the FAQ, since in the last days I'm struggling 
with the show and close command.
I've got a function that calculate values to plot. I calculate plot, use 
show command and everything goes fine.
I close the figure recalculate values and then replot and everything 
freezes because the show command seems still active.
I've tried to start IDLE using -n option but no solution. the plots 
freezes and I loose all calculations, and then I have to restart. reload 
etc..
I tried also to turn interactive off but no way of solving.
I'm using WIN XP
python 2.5
numpy 1.01
scipy 0.52
matplotlib 0.87.7
and I don't want to come back to matlab :) Since in matlab it's very 
common to calculate something, recalculate, plot etc. etc.
Any help would be very appreciated.
If needed I can post function and file I'm using in .tar
Giorgio
From: Paul C. <pau...@un...> - 2006年12月21日 08:36:17
Hi everybody,
I am trying to perform interpolation on 2d data ( irregular or not) and=20
I am wondering if there is a way to get the interpolated results which=20
are obtained with the imshow command. This would allow a very complete=20
interpolation command with many options. The available functions (=20
griddata, interp2d..) only provides few possibilities for the=20
interpolation process.
Thanks
--=20
Paul Cristini
Charg=E9 de recherche CNRS
UMR5212-Mod=E9lisation et Imagerie en G=E9osciences
Universit=E9 de Pau et des Pays de l'Adour
BP 1155 -- 64013 PAU Cedex
Tel: (33) (0)5 59 40 76 27
Fax: (33) (0)5 59 40 74 15
From: Eric F. <ef...@ha...> - 2006年12月21日 07:24:53
Ganesh V wrote:
> Hi!
> 
> I have a problem with contour plots. See the two plots at
> 
> http://www.ae.iitm.ac.in/~ae03b007/downloads/matlab.jpg
> http://www.ae.iitm.ac.in/~ae03b007/downloads/matplotlib.jpg
> 
> The names show how they are generated. It's the same data obviously. Why 
> the difference. I am dealing with a 161*241 grid and followed 
> instructions given in the 3D plotting with matplotlib cookbook page of 
> scipy.org <http://scipy.org>. Any parameter to be changed ? MATLAB keeps 
> crashing like hell.. I want to get rid of it asap !!
Offhand, it looks like maybe you reshaped your 161*241 into a 241*161 so 
that it is all scrambled up. Are you taking into account the fact that 
Matlab stores matrices in Fortran order (first index increases fastest) 
and numpy by default in C order (last index increases fastest)? One way 
to check your array is by plotting slices through it: e.g., 
"plot(A[:,100])" and "plot(A[60,:])". But you really have not provided 
much information to go on. The best way to get help on something like 
this is to provide a small self-contained script, generating its own 
data, that shows the problem. Specify what matplotlib version you are 
using and on what kind of machine. Update matplotlib if it is not 
current (although in the present case I am pretty sure that the problem 
is the input you are giving contourf, not a problem with any past 
version of it). Also please look at examples/contour_demo.py and 
examples/contourf_demo.py from the matplotlib distribution, and verify 
that you can run them and understand them.
Eric
From: Ganesh V <gan...@gm...> - 2006年12月21日 05:44:29
Hi!
 I have a problem with contour plots. See the two plots at
http://www.ae.iitm.ac.in/~ae03b007/downloads/matlab.jpg
http://www.ae.iitm.ac.in/~ae03b007/downloads/matplotlib.jpg
The names show how they are generated. It's the same data obviously. Why the
difference. I am dealing with a 161*241 grid and followed instructions given
in the 3D plotting with matplotlib cookbook page of scipy.org. Any parameter
to be changed ? MATLAB keeps crashing like hell.. I want to get rid of it
asap !!
bye !
ganesh
-- 
Ganesh V
Undergraduate student,
Department of Aerospace Engineering,
IIT Madras, Chennai-36.
My homepage --> http://www.ae.iitm.ac.in/~ae03b007
My blog --> http://gantech.wordpress.com

Showing 17 results of 17

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /