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 results of 523

<< < 1 2 3 4 5 6 .. 21 > >> (Page 4 of 21)
From: ninjasmith <hen...@gm...> - 2009年05月27日 11:29:25
Hi,
I'm a bit new to matplotlib and python. I'm running ubuntu 64bit. whenever
I try and do anything with matplotlib I get an error similar to above. it
still works, i.e. when I run the show() command the plot will appear but all
matplotplib commands return an error similar to above. for example
In [15]: plot(a)
Out[15]: [<matplotlib.lines.Line2D object at 0x28487d0>]
In [16]: figure(2)
Out[16]: <matplotlib.figure.Figure object at 0x2ddc150>
Interestingly when I run from SPE and choose 'execute in shell' I get the
following errors. 
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/home.png': file does not exist.
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/back.png': file does not exist.
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/move.png': file does not exist.
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/zoom_to_rect.png': file does not exist.
my simple script is as follows
import numpy, scipy, wave, struct
from pylab import *
from scipy import *
import wavFunctions
print(dir(wavFunctions))
#def readwave(wavfilename):
readwave=wavFunctions.readwave
 
#	w=wave.open(wavfilename,'rb')
#	(nchannel, width, rate, length, comptype, compname) = w.getparams()
#	frames = w.readframes(length)
#	data = numpy.array(struct.unpack("%sh" %length*nchannel,
frames)).reshape(length,nchannel)
#	return data
audio = readwave("/media/LACIE/bfd
rendered/edited_single_hits/ayotte_snare_keplinger_hit.wav")
print audio
print audio.size
plot(audio)
fft_audio=fft(audio)
print fft_audio
figure(2)
plot(abs(fft_audio))
show()
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/subplots.png': file does not exist.
-- 
View this message in context: http://www.nabble.com/matplotlib.lines.Line2D-object-at-0x283d310---strange-error-tp23740597p23740597.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
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
 
From: Alan G I. <ala...@gm...> - 2009年05月25日 21:46:21
> On Mon, May 25, 2009 at 12:35 PM, Alan G Isaac <ala...@gm...> wrote:
>> What is the "right" way to produce date-range bars,
>> like the recession bars in
>> http://research.stlouisfed.org/fred2/series/TB3MS?cid=116
On 5/25/2009 1:45 PM John Hunter apparently wrote:
> axvspan. See
> 
> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.axvspan
> http://matplotlib.sourceforge.net/examples/pylab_examples/axhspan_demo.html
Great!
Thanks,
Alan
From: marcusantonius <mar...@st...> - 2009年05月25日 21:27:45
Thank you very much for your email.
Your example
>imshow(rand(10,10)*8, vmin=0, vmax=8)
>colorbar(ticks=[0,2,4,6,8])
works fine.
>Note also that to get the sequence [0,2,4,6,8] you need arange(0,9,2), 
>not arange(0,8,2). Or you can use linspace(0,8,5) if you prefer.
Thank you for making me aware of that (You see that I don't have a lot of
experience in python and matplotlib).
I now specified the color range via vmin and vmax, and this solved my
problem. Thanks for the fast help
-- 
View this message in context: http://www.nabble.com/Colorbar-Ticks-tp23712716p23713404.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2009年05月25日 21:09:07
marcusantonius wrote:
> I should perhaps mention, that if i try
> cbar=fig.colorbar(p1,orientation='horizontal',ticks=[0.0,2.0,4.0,6.0,8.0])
The ticks that it uses are taken from the list--they are the ones that 
are within the range of numbers mapped to colors. The list of ticks 
does not set that range.
> cbar.ax.set_xticklabels(['0', '2', '4','6','8'])
Setting ticklabels is dangerous unless you do it based on first getting 
the actual ticks and using their values, or if you are otherwise sure of 
their values. But it should be very rare that you have to do this.
> the colorbar is drawn correctly, but I get the label 0 at position 2, the
> label 2 at position 4 and 4 at pos. 6, the labels at the end are not
> drawn...
None of the labels correspond to their ticks in this case.
Eric
From: Eric F. <ef...@ha...> - 2009年05月25日 21:02:35
marcusantonius wrote:
> Hello,
> 
> I have the problem, that sometimes the first and last ticklabel of a
> colorbar is not drawn. E.g. if I create a colorbar through
> fig.colorbar(p3,orientation='horizontal',ticks=np.arange(0.0,8,2))
> I only get ticklabels at 2,4,6, but I would like it to have 0,2,4,6,8 and I
> don't know how to control this behaviour. If I do
> cb=fig.colorbar(p3,orientation='horizontal',ticks=np.arange(0.0,8,2))
> cb.ax.xaxis.set_ticks(np.arange(0,8,2))
> the colorbar vanishes and instead I have 4 ticks with the labels
> 0.8,1.6,2.4,3.2
> 
> Thank you for your help,
> Markus
> 
> 
Markus,
The problem here is not the specification of the ticks, it is the actual 
range of the colorbar, which is taken from the norm object used in the 
color mapping. Try this (in ipython -pylab):
imshow(rand(10,10)*8, vmin=0, vmax=8)
colorbar(ticks=[0,2,4,6,8])
Alternatively, you can use the set_clim() method on any Mappable such as 
an image, or the pyplot clim() function, to set the limits.
Note also that to get the sequence [0,2,4,6,8] you need arange(0,9,2), 
not arange(0,8,2). Or you can use linspace(0,8,5) if you prefer.
Eric
From: marcusantonius <mar...@st...> - 2009年05月25日 20:59:06
I should perhaps mention, that if i try
cbar=fig.colorbar(p1,orientation='horizontal',ticks=[0.0,2.0,4.0,6.0,8.0])
cbar.ax.set_xticklabels(['0', '2', '4','6','8'])
the colorbar is drawn correctly, but I get the label 0 at position 2, the
label 2 at position 4 and 4 at pos. 6, the labels at the end are not
drawn...
-- 
View this message in context: http://www.nabble.com/Colorbar-Ticks-tp23712716p23712944.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: marcusantonius <mar...@st...> - 2009年05月25日 20:38:48
Hello,
I have the problem, that sometimes the first and last ticklabel of a
colorbar is not drawn. E.g. if I create a colorbar through
fig.colorbar(p3,orientation='horizontal',ticks=np.arange(0.0,8,2))
I only get ticklabels at 2,4,6, but I would like it to have 0,2,4,6,8 and I
don't know how to control this behaviour. If I do
cb=fig.colorbar(p3,orientation='horizontal',ticks=np.arange(0.0,8,2))
cb.ax.xaxis.set_ticks(np.arange(0,8,2))
the colorbar vanishes and instead I have 4 ticks with the labels
0.8,1.6,2.4,3.2
Thank you for your help,
Markus
-- 
View this message in context: http://www.nabble.com/Colorbar-Ticks-tp23712716p23712716.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Christoph G. <cg...@uc...> - 2009年05月25日 19:52:20
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. The 
crash occurs in _png.write_png(). When replacing the file _png.pyd with 
version 0.98.5.2 saving of PNG files works. There were no changes in the 
write_png function since 0.98.5.2.
import matplotlib
matplotlib.use('Agg')
from matplotlib import pylab
pylab.plot([0], [0])
pylab.savefig("test.png") # crashes here
pylab.close()
Thanks,
Christoph
From: Esmail <eb...@ho...> - 2009年05月25日 18:25:20
Hi again,
John Hunter wrote:
> 
> One thing I just noticed -- you call show before savefig. show is
> supposed to be the last line in your script, and should only be called
> once. Does moving it to the end help?
No, that's just an artifact of my trying a number of things :-)
for the pdf file save it makes no difference (but I tried both ways).
In the case of the png it always crashes, though it does create a zero-byte
file with the correct name.
Esmail
From: John H. <jd...@gm...> - 2009年05月25日 18:06:57
On Mon, May 25, 2009 at 1:01 PM, Esmail <eb...@ho...> wrote:
> Hello John,
>
> \John Hunter wrote:
>> On Mon, May 25, 2009 at 12:32 PM, Esmail <eb...@ho...> wrote:
>>> Hi all,
>>>
>>> I'm new to pylab/matplotlib, so perhaps I am making a mistake here,
>>> but when I try to save a plot under Windows as a png file, the program
>>> crashes (pdf works fine).
>>>
>>
>> I don't have a windows box to test on today (I can try tomorrow from
>> work).
>
> That would be helpful.
>
>> Most likely, you have a problem of an install over an old
>> install. Try installing mpl and numpy cleanly by removing all the
>> numpy* and matplotlib* files from your site-packages dir and
>> reinstalling.
>
> I didnt' have either of those packages installed before, so that
> should not be a problem, but I will take a look at the links you
> sent.
>
> Thanks .. it'll be interesting to see if the problem can be
> reproduced.
One thing I just noticed -- you call show before savefig. show is
supposed to be the last line in your script, and should only be called
once. Does moving it to the end help?
JDH
From: Esmail <eb...@ho...> - 2009年05月25日 18:01:56
Hello John,
\John Hunter wrote:
> On Mon, May 25, 2009 at 12:32 PM, Esmail <eb...@ho...> wrote:
>> Hi all,
>>
>> I'm new to pylab/matplotlib, so perhaps I am making a mistake here,
>> but when I try to save a plot under Windows as a png file, the program
>> crashes (pdf works fine).
>>
> 
> I don't have a windows box to test on today (I can try tomorrow from
> work). 
That would be helpful.
> Most likely, you have a problem of an install over an old
> install. Try installing mpl and numpy cleanly by removing all the
> numpy* and matplotlib* files from your site-packages dir and
> reinstalling. 
I didnt' have either of those packages installed before, so that
should not be a problem, but I will take a look at the links you
sent.
Thanks .. it'll be interesting to see if the problem can be
reproduced.
Esmail
22 messages has been excluded from this view by a project administrator.

Showing results of 523

<< < 1 2 3 4 5 6 .. 21 > >> (Page 4 of 21)
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 によって変換されたページ (->オリジナル) /