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






Showing 14 results of 14

From: Will G. <wg...@mi...> - 2009年05月26日 21:39:06
Hello matplotlib users,
I'm using matplotlib to plot some large data sets (1 million x,y
pairs) and I've noticed that, when zoomed out to view the whole plot,
it looks as if only every Nth point is being plotted, maybe in an
attempt to improve plotting performance in complex plots. When I zoom
in I can see points that were clearly missing in the zoomed-out view.
Is there any way to override this so that the plot really does show
all the points, regardless of zoom? I've included my really simple
plotting code below, and I'm using the "scipy superpack" (python 2.5,
matplotlib-0.98.6) on an OS X 10.5.7 Mac.
Many thanks for any help!
 --Will
import pylab
import smr
import sys
for freqs, stats, chronos in smr.loadData(sys.argv[1:]): # loads data
into numpy.arrays
	pylab.plot(chronos, freqs)
	pylab.show()
From: Ryan M. <rm...@gm...> - 2009年05月26日 20:45:38
On Tue, May 26, 2009 at 1:50 PM, william ratcliff <
wil...@gm...> wrote:
> Hi! I just tried the draggable rectangle "extra credit" example from:
> http://matplotlib.sourceforge.net/users/event_handling.html
> and as it is, it doesn't work. In the on_press method, I had to change:
>
> x0,y0=self.rect.xy to:
> x0=self.rect.get_x()
> y0=selft.rect.get_y()
The rect.xy attribute was already put back into SVN head.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: william r. <wil...@gm...> - 2009年05月26日 19:22:09
Hi! I just tried the draggable rectangle "extra credit" example from:
http://matplotlib.sourceforge.net/users/event_handling.html
and as it is, it doesn't work. In the on_press method, I had to change:
x0,y0=self.rect.xy to:
x0=self.rect.get_x()
y0=selft.rect.get_y()
which then works, but I find that despite using the blitting technique,
there is a significant lag in the redraws...
Thanks,
William
(I am using the QT4Agg backend and version 0.98.3, revision 5941)
From: Eric F. <ef...@ha...> - 2009年05月26日 16:26:03
Jean-Christophe Penalva wrote:
> Hello,
> 
> i've a figure and a colorbar, but i can't put my ticks on the colorbar. The
> colorbar is display without any values.
> 
> exemple of my code :
> ...
> plt.colorbar(c, orientation='horizontal', ticks=[int(valmin), int(valmax)])
> ...
> In my example, valmin can be 0.0 and valmax 243.0, but there's no display only
> a beautiful colorbar !
I think you are having the same problem that was discussed in this thread:
http://www.mail-archive.com/mat...@li.../msg11799.html
with the key point being made here:
http://www.mail-archive.com/mat...@li.../msg11801.html
Eric
> 
> thank you.
> 
> ###################################################################### 
> Jean-Christophe Penalva 
> Centre Informatique National de l'Enseignement Superieur (CINES) 
> Montpellier, FRANCE
> Tel : 33 4 67 141 414 Fax : 33 4 67 523 763
> http://www.cines.fr/
> 
> 
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, & 
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Robert K. <rob...@gm...> - 2009年05月26日 16:03:50
On 2009年05月23日 21:35, Eric Carlson wrote:
> Hello Robert,
> I studied delaunay and mlab.griddata a bit while converting tinterp and
> saw the
>
> """
> tri = delaunay.Triangulation(x,y)
> # interpolate data
> interp = tri.nn_interpolator(z)
> zo = interp(xi,yi)
> """
> stuff. In studying delaunay, however, it was/is not clear to me how to
> set up the "triangulation" for
>
> delaunay.LinearInterpolator(triangulation, z, default_value=-1.#IND)
>
> without going through delaunay. Any chance you could give an example of
> using delaunay to linearly interpolate on mesh x,y assuming data_pts,
> triangles, f_at_data_points are already given?
Hmm, true. I violated my own principle of trying not to do too much in the 
constructor. However, you should be able to figure out how to use the underlying 
utility functions compute_planes() and linear_interpolate_grid() from the 
LinearInterpolator code and Triangulation's docstring to describe its attributes.
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Esmail <eb...@ho...> - 2009年05月26日 14:43:55
John Hunter wrote:
> 
> OK, I can confirm this on my side. 
Hi John,
thanks for confirming this. I tried on my office machine too,
XP SP3 instead of SP2 and I had exactly the same problem with
the fresh install here too.
Esmail
From: John H. <jd...@gm...> - 2009年05月26日 14:32:01
On Tue, May 26, 2009 at 7:30 AM, Esmail <eb...@ho...> wrote:
> Christoph Gohlke wrote:
>> Hi,
>>
>> I can confirm the crash of python.exe when saving PNG files using
>> matplotlib 0.98.5.3 under Python 2.5.4 and 2.6.2 (32 bit binaries from
>> python.org) on Windows Vista 64 bit. Saving to a PDF file works
>
> Ah .. that's disappointing, but good to know .. just wanted to make
> sure that I didn't have some installation issue at my end. Be interesting
> to know if others too have run into problems with XP.
>
> Thanks for sharing your information,
OK, I can confirm this on my side. Do you see this problem as well
Charlie (I can import matplotlib._png but an actual call to savefig
with png output triggers the segfault). What version of libpng did
you use for these builds? Was it different than the last?
JDH
From: Jean-Christophe P. <jea...@ci...> - 2009年05月26日 14:19:52
 Hello,
 i've a figure and a colorbar, but i can't put my ticks on the colorbar. The
colorbar is display without any values.
exemple of my code :
...
 plt.colorbar(c, orientation='horizontal', ticks=[int(valmin), int(valmax)])
...
 In my example, valmin can be 0.0 and valmax 243.0, but there's no display only
a beautiful colorbar !
 thank you.
###################################################################### 
Jean-Christophe Penalva 
Centre Informatique National de l'Enseignement Superieur (CINES) 
Montpellier, FRANCE
Tel : 33 4 67 141 414 Fax : 33 4 67 523 763
http://www.cines.fr/
From: John H. <jd...@gm...> - 2009年05月26日 13:23:45
On Tue, May 26, 2009 at 7:39 AM, Michael Droettboom <md...@st...> wrote:
> Does it help if you add a call to "plt.clf()" to the bottom of the loop?
>
> The pyplot interface keeps a reference around to every figure created
> until they are destroyed so that it can be obtained again by number
> (this is functionality inspired by matlab). Alternatively, you can use
> the object-oriented interface to create the figure, which does not have
> this behavior, e.g., replace
>
> fig = plt.figure()
>
> with
>
> from matplotlib import figure
> fig = figure.Figure()
>
> If all this doesn't help, let me know and I'll look further.
>
> Cheers,
> Mike
>
> iCy-fLaME wrote:
>> I was trying to use matplotlib to plot a series of 2D images, but
>> python was using up a large amount of RAM very quickly. I don't know
>> matplotlib that well, so the chance are I am missing something, would
>> appreciate it if anyone can point me to the right direction.
>>
>> I am using:
>> Python 2.4.3 (#1, Jan 21 2009, 01:11:33)
>> [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
>>
>> Example code to run in interpreter mode:
>>
>> ########################################
>> from numpy import zeros
>>
>> x = 1651
>> y = 452
>> page = zeros((x, y)).astype('float')
>>
>> import matplotlib
>> matplotlib.use('Agg')
>> import matplotlib.pyplot as plt
>>
>> for i in range(1000):
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>> cax = ax.imshow(page, cmap=plt.cm.spectral_r, extent=(-44, 176, -30,
>> 30), interpolation = 'bicubic', vmin = -0.003, vmax = 0.003)
>> title = "Time = %(i)0.3es)" % {'i':i}
>> ax.set_title(title,fontsize=14)
>>
>> fig.colorbar(cax, ticks=[-2e-3, -1e-3, 0, 1e-3, 2e-3],
>> orientation='horizontal')
>>
>> fig.savefig('_tmp.' + str(i) + ".png", dpi=300)
This code creates 1000 different figures -- either reuse the same
figure and clear it as Michael suggests
 fig = plt.figure(1) # by putting 1 here you reuse the same fig
 fig.clf() # and clear it
or close the figure in the loop
 fig = plt.figure()
 # draw and save here
 plt.close(fig)
JDH
From: Esmail <eb...@ho...> - 2009年05月26日 13:05:11
Christoph Gohlke wrote:
> Hi,
> 
> I can confirm the crash of python.exe when saving PNG files using 
> matplotlib 0.98.5.3 under Python 2.5.4 and 2.6.2 (32 bit binaries from 
> python.org) on Windows Vista 64 bit. Saving to a PDF file works
Ah .. that's disappointing, but good to know .. just wanted to make
sure that I didn't have some installation issue at my end. Be interesting
to know if others too have run into problems with XP.
Thanks for sharing your information,
Esmail
From: Michael D. <md...@st...> - 2009年05月26日 12:45:15
Does it help if you add a call to "plt.clf()" to the bottom of the loop?
The pyplot interface keeps a reference around to every figure created 
until they are destroyed so that it can be obtained again by number 
(this is functionality inspired by matlab). Alternatively, you can use 
the object-oriented interface to create the figure, which does not have 
this behavior, e.g., replace
 fig = plt.figure()
with
 from matplotlib import figure
 fig = figure.Figure()
If all this doesn't help, let me know and I'll look further.
Cheers,
Mike
iCy-fLaME wrote:
> I was trying to use matplotlib to plot a series of 2D images, but
> python was using up a large amount of RAM very quickly. I don't know
> matplotlib that well, so the chance are I am missing something, would
> appreciate it if anyone can point me to the right direction.
>
> I am using:
> Python 2.4.3 (#1, Jan 21 2009, 01:11:33)
> [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
>
> Example code to run in interpreter mode:
>
> ########################################
> from numpy import zeros
>
> x = 1651
> y = 452
> page = zeros((x, y)).astype('float')
>
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
>
> for i in range(1000):
> 	fig = plt.figure()
> 	ax = fig.add_subplot(111)
> 	cax = ax.imshow(page, cmap=plt.cm.spectral_r, extent=(-44, 176, -30,
> 30), interpolation = 'bicubic', vmin = -0.003, vmax = 0.003)
> 	title = "Time = %(i)0.3es)" % {'i':i}
> 	ax.set_title(title,fontsize=14)
> 	
> 	fig.colorbar(cax, ticks=[-2e-3, -1e-3, 0, 1e-3, 2e-3],
> orientation='horizontal')
> 	
> 	fig.savefig('_tmp.' + str(i) + ".png", dpi=300)
> 	
> ############### EOF ################
>
>
> I tired to delete everything in the namespace, but the only way I can
> release the ram is by killing the python session.
>
>
>
> Thanks for all the helps in advance.
>
>
>
> iCy
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, & 
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> 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
From: iCy-fLaME <icy...@gm...> - 2009年05月26日 11:44:19
I was trying to use matplotlib to plot a series of 2D images, but
python was using up a large amount of RAM very quickly. I don't know
matplotlib that well, so the chance are I am missing something, would
appreciate it if anyone can point me to the right direction.
I am using:
Python 2.4.3 (#1, Jan 21 2009, 01:11:33)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Example code to run in interpreter mode:
########################################
from numpy import zeros
x = 1651
y = 452
page = zeros((x, y)).astype('float')
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
for i in range(1000):
	fig = plt.figure()
	ax = fig.add_subplot(111)
	cax = ax.imshow(page, cmap=plt.cm.spectral_r, extent=(-44, 176, -30,
30), interpolation = 'bicubic', vmin = -0.003, vmax = 0.003)
	title = "Time = %(i)0.3es)" % {'i':i}
	ax.set_title(title,fontsize=14)
	
	fig.colorbar(cax, ticks=[-2e-3, -1e-3, 0, 1e-3, 2e-3],
orientation='horizontal')
	
	fig.savefig('_tmp.' + str(i) + ".png", dpi=300)
	
############### EOF ################
I tired to delete everything in the namespace, but the only way I can
release the ram is by killing the python session.
Thanks for all the helps in advance.
iCy
From: Damien L. <dam...@in...> - 2009年05月26日 08:57:36
Hi all,
I'm new to this list so I hope somebody hasn't 
just posted about the same topic.
I'm using matplotlib 0.98.5.2 (rev 6660) with 
python 2.5 under windows, and ran across an old 
bug which was (supposedly) fixed in rev 5922.
(http://www.mailinglistarchive.com/mat...@li.../msg00271.html)
I'm displaying two plots in one frame (split 
horizontally, first plot is 211 and second is 
212). Whenever I hover the plot frame (at any 
position), I get this annoying LinAlgError exception.
The fix (in patches.py) is testing in a Rectangle 
if self._height==0 or self._width==0, then return 
false. But when I add a print statement in the 
contains() methos, I see that the rectangle has 
indeed self._height=1.0 and self._width=1.0. So I 
changed the code into a try-catch :
 def contains(self, mouseevent):
## # special case the degenerate rectangle
## if self._width==0 or self._height==0:
## return False, {}
 try :
 x, y = self.get_transform().inverted().transform_point(
 (mouseevent.x, mouseevent.y))
 except np.linalg.LinAlgError, lae :
 return False, {}
 return (x >= 0.0 and x <= 1.0 and y >= 0.0 and y <= 1.0), {}
it now runs smoothly. Is there any case where a 
LinAlgError *should* be legitimately raised here 
? Otherwise I believe this try-catch is enough to get rid of the bug.
dl.
===================================
Damien Leroux
Responsable Informatique plate-forme anexplo
Hôpital de Rangueil / Inserm-IFR 150
BP 84 225
31432 - Toulouse - Cedex 04
tel 05 61 32 56 45
mobile 06 82 92 31 78 
From: <jor...@ya...> - 2009年05月26日 04:40:22
> It looks like you found a pretty significant bug -- the Artist.pick
> method forwards the event to all of it's children, whether or not the
> pick event happened in the same Axes as the event being queried. Not
> only is this inefficient, it can create false positives when the two
> axes share a similar coord system. I just committed a fix to svn, to
> make sure the artist axes instance is the same as the pick event
> inaxes attribute before forwarding on the call. artist.Artist.pick
> now reads:
> 
> # Pick children
> for a in self.get_children():
> # make sure the event happened in the same axes
> ax = getattr(a, 'axes', None)
> if mouseevent.inaxes==ax:
> a.pick(mouseevent)
> 
> This seems to fix the problem you identified -- give svn r7141 or
> later a test drive if you have access
> 
> http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
> 
> JDH
Thanks! Your solution works for me. I haven't actually tested the svn, only patched the current version provided by my distribution (0.98.5.2) with the modification you posted.
Jorges
 

Showing 14 results of 14

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