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



Showing 11 results of 11

From: Jeff W. <js...@fa...> - 2005年08月25日 23:13:31
I've created matplotlib colormaps from all the color tables at 
http://colorbrewer.org, and 
http://geography.uoregon.edu/datagraphics/color_scales.htm. You can 
grab them at 
http://www.cdc.noaa.gov/people/jeffrey.s.whitaker/python/extracmaps.py.gz. 
Also included are the Generic Mapping Tools colormaps (at least the ones 
that are different from the built in mpl colormaps), for a total of 60. 
You can just paste the contents of that file into cm.py just above the 
"def get_cmap" line (although this will not make them available via 
pylab calls like 'jet()' and 'hot()'). To get a quick view of what the 
colormaps look like, I use this little script:
import matplotlib.cm as cm
import pylab as p
names = cm.datad.keys()
print len(names),'total color maps'
def plot_colorbar(cmapname,nsteps=None):
 colormap = cm.__dict__[cmapname]
 fig=p.figure(figsize=(8,1))
 ax = fig.add_axes([0.05,0.05,0.9,0.70])
 if nsteps == None:
 nsteps = colormap.N+1
 clevs = p.linspace(0,1,nsteps+1)
 C = p.array([clevs,clevs])
 X,Y = p.meshgrid(clevs,[0,1])
 levs,coll = ax.contourf(C, Y, X, nsteps-1, cmap=colormap)
 ax.set_xticks([])
 ax.set_yticks([])
 p.title(cmapname)
 p.show()
if __name__ == "__main__":
 cmapname = raw_input('color map name:')
 if cmapname not in names:
 raise KeyError, 'invalid colormap name, valid names are 
'+repr(names)
 plot_colorbar(cmapname)
Enjoy!
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/CDC R/CDC1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Sascha <sas...@gm...> - 2005年08月25日 17:51:20
> And the answer, for the archives.... ?
Sorry, I should have included this in my last email. 
It's quite easy:
from MA import set_print_limit
set_print_limit(NEW_LIMIT_HERE)
Regards,
Sascha
From: Ryan K. <rya...@co...> - 2005年08月25日 17:38:40
Don't I feel silly. --verbose-helpful is quite helpful. I was loading 
an rc file I didn't know I had saved in the directory where another test 
 script was saved. I deleted that other rc file with the bad backend 
string and everything is fine.
Ryan
John Hunter wrote:
>>>>>>"Ryan" == Ryan Krauss <rya...@co...> writes:
> 
> 
> Ryan> I have an interesting problem importing pylab. Most of my
> Ryan> work is stored on a FAT32 partition so I can access it from
> Ryan> windows or linux. If I run python from a dos command open
> Ryan> on that partition I get:
> 
> Ryan> E:\pythonscripts>python Enthought Edition build 1069 Python
> Ryan> 2.3.5 (#62, Mar 22 2005, 21:53:13) [MSC v.1200 32 bit
> Ryan> (Intel)] on win32 Type "help", "copyright", "credits" or
> Ryan> "license" for more information.
> >>>> import pylab
> Ryan> Traceback (most recent call last): File "<stdin>", line 1,
> Ryan> in ? File "C:\Python23\Lib\site-packages\pylab.py", line 1,
> Ryan> in ? from matplotlib.pylab import * File
> Ryan> "C:\Python23\Lib\site-packages\matplotlib\pylab.py", line
> Ryan> 199, in ? import backends File
> Ryan> "C:\Python23\Lib\site-packages\matplotlib\backends\__init__.py",
> Ryan> line 15, in ? raise ValueError, 'Unrecognized backend %s' %
> Ryan> backend ValueError: Unrecognized backend WxAgg
> 
> My guess is that this has nothing to do with partitions and that you
> may be reading two different rc files. One has 
> 
> backend : WxAgg
> 
> which is erroneous (should be WXAgg)
> 
> and the other has the win32 default
> 
> backend : TkAgg
> 
> which is working for you.
> 
> To test, create a script test.py
> 
> import pylab
> 
> and run it on both partitions with
> 
> python test.py --verbose-helpful
> 
> This will tell you which rc file is being loaded, what backend is
> chosen, etc.
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: John H. <jdh...@ac...> - 2005年08月25日 16:01:13
>>>>> "Schindler" == Schindler Benjamin <bsc...@st...> writes:
 Schindler> Hi - I'm having problems - I don't get any line
 Schindler> displayed on my screen. My code looks as follows
 Schindler> (Init):
Make sure you are working with the line you think you are
Rather than doing this
 self.axes.add_line(Line2D([],[])
do this
 self.line = Line2D([],[]
 self.axes.add_line(self.line)
After you do this
 line = self.data[source][0] # Retreive the line
check to make sure that id(line) and id(self.line) are the same.
Here is a simple example that binds events to adding line data.
Perhaps you can follow this (in wx you need to click on the figure
once before the keypress events will be processed)
from matplotlib.lines import Line2D
import matplotlib.numerix as nx
from pylab import figure, show
xdata = []
ydata = []
line = Line2D(xdata, ydata)
def add_data(event):
 if event.key!='a': return
 xdata.extend(nx.mlab.rand(10))
 ydata.extend(nx.mlab.rand(10))
 line.set_data(xdata, ydata)
 fig.canvas.draw()
 
fig = figure()
ax = fig.add_subplot(111)
ax.add_line(line)
ax.set_title("Press 'a' to add more data")
fig.canvas.mpl_connect('key_press_event', add_data)
show()
From: John H. <jdh...@ac...> - 2005年08月25日 15:51:12
>>>>> "Ryan" == Ryan Krauss <rya...@co...> writes:
 Ryan> I have an interesting problem importing pylab. Most of my
 Ryan> work is stored on a FAT32 partition so I can access it from
 Ryan> windows or linux. If I run python from a dos command open
 Ryan> on that partition I get:
 Ryan> E:\pythonscripts>python Enthought Edition build 1069 Python
 Ryan> 2.3.5 (#62, Mar 22 2005, 21:53:13) [MSC v.1200 32 bit
 Ryan> (Intel)] on win32 Type "help", "copyright", "credits" or
 Ryan> "license" for more information.
 >>>> import pylab
 Ryan> Traceback (most recent call last): File "<stdin>", line 1,
 Ryan> in ? File "C:\Python23\Lib\site-packages\pylab.py", line 1,
 Ryan> in ? from matplotlib.pylab import * File
 Ryan> "C:\Python23\Lib\site-packages\matplotlib\pylab.py", line
 Ryan> 199, in ? import backends File
 Ryan> "C:\Python23\Lib\site-packages\matplotlib\backends\__init__.py",
 Ryan> line 15, in ? raise ValueError, 'Unrecognized backend %s' %
 Ryan> backend ValueError: Unrecognized backend WxAgg
My guess is that this has nothing to do with partitions and that you
may be reading two different rc files. One has 
 backend : WxAgg
which is erroneous (should be WXAgg)
and the other has the win32 default
 backend : TkAgg
which is working for you.
To test, create a script test.py
 import pylab
and run it on both partitions with
 python test.py --verbose-helpful
This will tell you which rc file is being loaded, what backend is
chosen, etc.
From: Ken M. <km...@gm...> - 2005年08月25日 15:11:03
On Aug 25, 2005, at 10:02 AM, Schindler Benjamin wrote:
> Since I have to leave from here I cannot yet produce a sample app that 
> would show this behaviour.
It doesn't have to be anything complex, just the bare functionality of 
whatever you're working on. I'll be happy to take a look at it 
tomorrow.
> However, I tried to have a non-empty list at the beginning. I replaced 
> Line2D([],[]) with Line2D([1,2],[1,2]) just for the sake of trying - 
> with no luck apparently.
I'm sorry if I gave you the impression that that was the problem... 
it's a potential problem, but I didn't mean to suggest that it's why 
your plot isn't being draw.
Ken
From: Schindler B. <bsc...@st...> - 2005年08月25日 15:04:58
Since I have to leave from here I cannot yet produce a sample app that =
would show this behaviour. However, I tried to have a non-empty list at =
the beginning. I replaced Line2D([],[]) with Line2D([1,2],[1,2]) just =
for the sake of trying - with no luck apparently.=20
I'll post a sample app tomorrow asap
-----Urspr=FCngliche Nachricht-----
Von: Ken McIvor [mailto:km...@gm...]
Gesendet: Do 25.08.2005 16:54
An: Schindler Benjamin
Cc: mat...@li...
Betreff: Re: [Matplotlib-users] Line2D and wx Backend
=20
On Aug 25, 2005, at 9:33 AM, Schindler Benjamin wrote:
> Some event will occur and do the following (it does):
> self.axes.add_line(Line2D([],[])
You really don't want to plot empty lines, as it will end up making 0,0=20
part of the total data range. If your data points are on the positive=20
side of the origin and are a long way from zero you'll end up with a=20
lot of empty space on the axis and a little squiggle of a plot off to=20
the right. I've been meaning to file a bug report about this behavior,=20
which I believe is caused by Numeric.array([]) returning=20
Numeric.zeros((0,), 'l').
> I do receive data, I see that I have lines in self.axes, but I never=20
> achieved to have a line on my display. What am I missing?
I can think of a few possible problems but wouldn't care to hazard a=20
guess without knowing how things like event generation and handling are=20
implemented I. If you could send an example program which exhibits=20
this problem, I will be happy to look into it.
Ken
From: Ken M. <km...@gm...> - 2005年08月25日 14:53:54
On Aug 25, 2005, at 9:33 AM, Schindler Benjamin wrote:
> Some event will occur and do the following (it does):
> self.axes.add_line(Line2D([],[])
You really don't want to plot empty lines, as it will end up making 0,0 
part of the total data range. If your data points are on the positive 
side of the origin and are a long way from zero you'll end up with a 
lot of empty space on the axis and a little squiggle of a plot off to 
the right. I've been meaning to file a bug report about this behavior, 
which I believe is caused by Numeric.array([]) returning 
Numeric.zeros((0,), 'l').
> I do receive data, I see that I have lines in self.axes, but I never 
> achieved to have a line on my display. What am I missing?
I can think of a few possible problems but wouldn't care to hazard a 
guess without knowing how things like event generation and handling are 
implemented I. If you could send an example program which exhibits 
this problem, I will be happy to look into it.
Ken
From: Ryan K. <rya...@co...> - 2005年08月25日 14:48:44
I have an interesting problem importing pylab. Most of my work is 
stored on a FAT32 partition so I can access it from windows or linux. 
If I run python from a dos command open on that partition I get:
E:\pythonscripts>python
Enthought Edition build 1069
Python 2.3.5 (#62, Mar 22 2005, 21:53:13) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pylab
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "C:\Python23\Lib\site-packages\pylab.py", line 1, in ?
 from matplotlib.pylab import *
 File "C:\Python23\Lib\site-packages\matplotlib\pylab.py", line 199, in ?
 import backends
 File "C:\Python23\Lib\site-packages\matplotlib\backends\__init__.py", 
line 15,
 in ?
 raise ValueError, 'Unrecognized backend %s' % backend
ValueError: Unrecognized backend WxAgg
 >>>
But if I do the same things from a dos prompt open on the C partition it 
works fine:
C:\Documents and Settings\Ryan Krauss>python
Enthought Edition build 1069
Python 2.3.5 (#62, Mar 22 2005, 21:53:13) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pylab
 >>>
How can this be fixed?
Thanks,
Ryan
From: Schindler B. <bsc...@st...> - 2005年08月25日 14:34:53
Hi - I'm having problems - I don't get any line displayed on my screen. =
My code looks as follows (Init):
 self.figure =3D Figure()
 self.axes =3D self.figure.add_subplot(111)
 self.canvas =3D FigureCanvas(self.Panel, -1, self.figure)
 self.sizer =3D wx.BoxSizer(wx.VERTICAL)
 =20
 self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
 self.Panel.SetSizer(self.sizer)
Some event will occur and do the following (it does):
 self.axes.add_line(Line2D([],[])
As soon this event arrives, I'll receive data:
 def receive(self, data, source):
 line =3D self.data[source][0] # Retreive the line
 xdata =3D line.get_xdata()
 ydata =3D line.get_ydata()
 for x in data:
 xdata.append(x[2]) # The data I've received
 ydata.append(x[0])
 =20
 self.data[source][0].set_data(xdata, ydata) # Set the data
 self.canvas.draw()
 self.canvas.gui_repaint()
I do receive data, I see that I have lines in self.axes, but I never =
achieved to have a line on my display. What am I missing?
Thanks
Benjamin Schindler
From: Menno S. <m.s...@ge...> - 2005年08月25日 13:21:09
Hello all
I used to work with python 2.2 and with that version I was able to 
make multiple plots in one script like the example below:
from pylab import *
x = arange(10)
plot(x, c = 'b')
print isinteractive()
show()
plot(x, c = 'r')
print isinteractive()
show()
plot(x[::-1], c = 'g')
print isinteractive()
show()
The script would stop running during the visualisation of the plot 
and continue after I manually closed the plotting window.
However, with the newest python (2.4.1) and matplotlib.pylab version 
0.83.2, only the first window can be closed manually. Python then 
goes into interactive mode and all the plotting commands are plotted 
into one new window, which can not be accessed anymore by windows, 
the window hangs.
How can I make make multiple plots within one script using the newest 
python version?
thanks
Menno Straatsma

Showing 11 results of 11

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 によって変換されたページ (->オリジナル) /