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






Showing results of 620

<< < 1 .. 3 4 5 6 7 .. 25 > >> (Page 5 of 25)
From: Jim V. <Jim...@no...> - 2010年02月24日 11:48:43
Jae-Joon Lee wrote:
> This seems to be a bug and I recommend you to file a bug.
> This happens because Axis.set_ticklabels method only changes the
> attributes of left (or bottom) tick labels.
>
> Meanwhile, try
>
> for t in colorbar.ax.get_yticklabels():
> t.set_color("w")
>
> -JJ
> 
Thanks for the explanation and alternative which works just fine!
As per your suggestion, I have submitted a trouble report (2957923). 
entitled: "set_yticklabels(labels, color='white') ignored"
-- jv
> On Tue, Feb 23, 2010 at 11:03 AM, Jim Vickroy <Jim...@no...> wrote:
> 
>> Hello,
>>
>> I'm (unsuccessfully) trying to generate a figure (with a labeled colorbar)
>> having a black background.
>>
>> Here is the code.
>>
>> _purpose_ = 'demonstrate capability to create PNG with black background
>> including labeled color bar'
>> _author_ = 'jim...@no...'
>>
>> import numpy # http://numpy.scipy.org/
>> import matplotlib # http://matplotlib.sourceforge.net/index.html
>> matplotlib.use('Agg') # http://matplotlib.sourceforge.net/backends.html --
>> probably the fastest, non-GUI, rendering backend
>> import matplotlib.pyplot as plot #
>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot
>> import matplotlib.cm # color maps
>>
>> import sys
>> assert sys.version == '2.6.4 (r264:75708, Oct 26 2009, 08:23:19)
>> [MSC v.1500 32 bit (Intel)]', sys.version
>> assert numpy.__version__ == '1.4.0', numpy.__version__
>> assert matplotlib.__version__ == '0.99.1', matplotlib.__version__
>>
>> data_min = 0
>> data_max = 256
>> data = numpy.random.randint(data_max, size=(512,512))
>> rows_cnt, columns_cnt = data.shape
>> shape = rows_cnt, columns_cnt
>> x = numpy.empty(data.shape, dtype=int)
>> y = numpy.empty(data.shape, dtype=int)
>> x[:] = numpy.arange(rows_cnt)
>> y[:] = numpy.arange(columns_cnt)
>> XI, YI = numpy.meshgrid(x[0], y[0])
>>
>> title = 'this is the figure title'
>> plot.clf() # clear the figure
>> plot.title(title,color='white',backgroundcolor='black')
>> plot.axis('off')
>> colormap = 'gist_heat'
>> config = dict(cmap=eval('matplotlib.cm.%s' % colormap), vmin=data_min,
>> vmax=data_max) # vmin,vmax specify a fixed (color-map) scale
>> plot.pcolormesh(XI, YI, data, **config)
>> colorbar = plot.colorbar()
>> ##############################################################################################################################################################
>> # labels = ??? list of strings labels ???
>> labels = [str(i) for i in range(10)]
>> colorbar.ax.set_yticklabels(labels, color='white')
>> ##############################################################################################################################################################
>> plot.imshow(data, interpolation='bilinear', cmap=config['cmap'],
>> origin='upper', extent=[0,rows_cnt,0,columns_cnt])
>> # plot.show() # interactive
>> filename = 'trial-plot-with-labeled-colorbar.png'
>> plot.savefig(filename, facecolor='black')
>> plot.close()
>>
>> which generates a figure with a black background and invisible (black) color
>> bar labels.
>>
>> I'm probably going about this completely wrong.
>>
>> Questions:
>>
>> How do I get white color bar labels?
>> How do I access the generated sequence of string labels (for use as the
>> first set_yticklabels parameter) rather than artificially defining a list of
>> labels?
>>
>> Thanks,
>> -- jv
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> 
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Wayne W. <sie...@sb...> - 2010年02月24日 11:42:50
Anyone here going to the meeting, see Subject? As far as I can tell, it 
meets from 7:30 to 9 pm. Their site shows no speaker yet, and there 
seems to be an informal group dinner at 6 pm at some place yet unknown. 
Are there other events and activities at the meeting? Pre-speaker 
events? Demonstrations?
-- 
 "There is nothing so annoying as to have two people
 talking when you're busy interrupting." -- Mark Twain
From: Samuel T. S. <arc...@gm...> - 2010年02月24日 11:29:45
Hi all
Days ago I ask for tips about to improvemente my code on
http://dpaste.com/161149/
Today, it's work ok on my web app.
I fill it a form and when press submit I generate the graphic.
But, I fill it the form again and press submit again, it will generate a
second graphic
instead of reset the previous and created a new one.
so... What I need to restart my plot for not print new graphics with the
previous one or on them?
well. thanks in advanced all
Samuel
From: Matthieu B. <mat...@gm...> - 2010年02月24日 11:13:34
Indeed, with a fixed value, I could bypass this, but the main issue is
that the documentation says that it should work (xx-small, x-small,
small, medium, large, ... although I don't know if it should be
larger, as indicated in rc() doc, or large as indicated in the font
size doc IIRC).
Matthieu
2010年2月24日 Philipp Bender <li...@ro...>:
> The error is the 'size':'larger', not the passing as keyword arguments. Maybe
> you try to stick (as "workaround") with a fixed number, like 'size':12
>
> It's located in matplotlib/lib/matplotlib/rcsetup.py
>
> def validate_float(s):
>  'convert s to float or raise'
>  try: return float(s)
>  except ValueError:
>    raise ValueError('Could not convert "%s" to float' % s)
>
> -> conversion of 'larger' to float fails, I don't know, maybe this should go
> through "validate_fontsize" instead of "validate_float"? Or, if failed in
> validate_floats, to validate_fontsize? Like
>
>
> def validate_float(s):
>  'convert s to float or raise'
>  try: return float(s) or validate_fontsize()
>  except ValueError:
>    raise ValueError('Could not convert "%s" to float' % s)
>
> Regards,
> Philipp
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher
From: Philipp B. <li...@ro...> - 2010年02月24日 11:10:07
The error is the 'size':'larger', not the passing as keyword arguments. Maybe 
you try to stick (as "workaround") with a fixed number, like 'size':12 
It's located in matplotlib/lib/matplotlib/rcsetup.py
def validate_float(s):
 'convert s to float or raise'
 try: return float(s)
 except ValueError:
 raise ValueError('Could not convert "%s" to float' % s)
-> conversion of 'larger' to float fails, I don't know, maybe this should go 
through "validate_fontsize" instead of "validate_float"? Or, if failed in 
validate_floats, to validate_fontsize? Like
def validate_float(s):
 'convert s to float or raise'
 try: return float(s) or validate_fontsize()
 except ValueError:
 	raise ValueError('Could not convert "%s" to float' % s)
Regards,
Philipp
From: Matthieu B. <mat...@gm...> - 2010年02月24日 10:44:40
Hi,
I've tried to set the size of the main font by doing:
import matplotlib.pyplot as pyplot
font = {'size' : 'larger'}
pyplot.rc('font', **font)
as indicated in
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.rc
It failed with:
 raise ValueError('Could not convert "%s" to float' % s)
ValueError: Could not convert "larger" to float
I'm using Matplotlib 0.99.1.2.
Matthieu
-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher
From: Friedrich R. <fri...@gm...> - 2010年02月24日 10:31:14
The following was sent unintentionally in private e-mail (my e-mail
program always selects the sender as recipient first :-( ). I think
the solution by Jae-Joon is also elegant, but nevertheless the
following may be useful also (and maybe also in other places):
---------- Forwarded message ----------
From: Friedrich Romstedt <fri...@gm...>
Date: 2010年2月24日
Subject: Re: [Matplotlib-users] Looping through all the built-in colormaps
To: David Goldsmith <d_l...@ya...>
> 0) is there some "elegant" way to do what I want to do?
Don't know whether it's elegant or not, but it should do the job:
for cmap_name in dir(cm):
 cmap_object = getattr(cm, cmap_name)
 if isinstance(cmap_object, matplotlib.colors.LinearSegmentedColormap):
 [...]
> 1) why doesn't this:
>
>>>> for cmap in dir(cm):
>>>> try:
>>>> ax.imshow(image, cmap)
>>>> canvas.print_figure('image_'+cmap)
>>>> except:
>>>> pass
>
> "work" (i.e., simply bypass those elements of dir(cm) which cause imshow to raise an exception, but then continue on as if nothing had happened)? Is this a bug?
I guess it's because you have messed up with the internals of the
axes, when passing an invalid entry. It gets stored somewhere without
check, and then causes subsequent error occuring before the next
element is applied fully, I guess. It's more a bug of your code than
of matplotlib, because your argument did not fulfil specification :-)
Friedrich
From: Jae-Joon L. <lee...@gm...> - 2010年02月24日 09:45:30
On Wed, Feb 24, 2010 at 3:56 AM, David Goldsmith
<d_l...@ya...> wrote:
> cmap='LUTSIZE' does not create an image: it is an invalid value for imshow's cmap argument. Many images are created successfully by my loop before cmap='LUTSIZE' without me calling cla, and Friedrich's soln. works great w/out me having to call cla.
It DOES create an image at least in the svn version of matplotlib
(although I consider it as a bug). But this may not be true in other
version.
As I said, without calling cla, you end up with bunch of overlapping
images (unless hold is False). It DOES NOT mean that the results will
be wrong. It only means that it will increase the drawing time and/or
output size. You do not have to call cla if you don't care about
these.
You may check the number of images in the current figure by
print len(ax.images)
-JJ
From: Jae-Joon L. <lee...@gm...> - 2010年02月24日 08:22:46
On Tue, Feb 23, 2010 at 6:45 PM, David Goldsmith
<d_l...@ya...> wrote:
> 1) why doesn't this:
>
>>>> for cmap in dir(cm):
>>>>  try:
>>>>    ax.imshow(image, cmap)
>>>>    canvas.print_figure('image_'+cmap)
>>>>  except:
>>>>    pass
>
> "work" (i.e., simply bypass those elements of dir(cm) which cause imshow to raise an exception, but then continue on as if nothing had happened)? Is this a bug?
>
I believe this happens because you never clear your figure (or axes)
between print_figure.
imshow does not erase an existing image and you end up with bunch of
images overlapped.
And the exceptions are keep being raised as the image you created with
cmap="LUTSIZE" is still there.
calling ax.cla() before ax.imshow works for me.
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2010年02月24日 08:15:34
On Wed, Feb 24, 2010 at 3:06 AM, Matthias Michler
<Mat...@gm...> wrote:
> some time ago somebody proposed an example on the list to circle through all
> possible colormaps. In this time cm had an attribute "cm.cmapnames", which
> hold all these names, but nowerdays (svn-HEAD) this attribute has be removed
> and in my opinion 'cm.cmap_d.keys()' is an appropriate replacement for this.
>
The names are available as "cm._cmapnames". However, this list does
not include any reverse map names (i.e., names like "jet_r").
So, yes, you should use cmap_d instead.
Regards,
-JJ
From: Mathew Y. <mat...@gm...> - 2010年02月24日 02:33:21
This looks correct. I went and look at the animation examples and they do
something similar.
Thx
---------- Forwarded message ----------
From: Stephen George <ste...@op...>
Date: Tue, Feb 23, 2010 at 6:28 PM
Subject: Re: [Matplotlib-users] hoe to update a plot
To: Matplotlib Users <mat...@li...>
C M wrote:
> On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates <mat...@gm...>
wrote:
>
>> Hi
>> I am using gtk and displaying a plot in a FigureCanvas. In response to an
>> event, I want to update the plot with new data.
>>
>> e.g.
>> self.fig = Figure(figsize=(5,5), dpi=100)
>> self.ax = fig.add_subplot(111)
>> ax.plot(data[0,0:,0],
>>
>>
>>
>> canvas = FigureCanvas(fig)
>> canvas.set_size_request(500,500)
>>
>> def on_some_signal(self,widget):
>> ?????
>>
>
>
I also may be wrong.
I thought ax.plot(..) would redraw everything (ticks, labels, etc) to
do with the plot.
I've been using set_data as I thought it was meant to be quicker.
 self.cline[0].set_data(rX, myabs) # I have to make sure
I use correct line
 :: ::
 self.canvas.draw()
To just change the data associated with a specific line on plot.
I stored the lines on my graph in a list called cline, I captured the
line at time of creating of the plot
 r = self.axis.plot( rX, myabs ,self.linestyle, color='b')
 self.cline.append( r[0] )
- Steve
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
On Tue, Feb 23, 2010 at 6:28 PM, Stephen George
<ste...@op...>wrote:
> C M wrote:
> > On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates <mat...@gm...>
> wrote:
> >
> >> Hi
> >> I am using gtk and displaying a plot in a FigureCanvas. In response to
> an
> >> event, I want to update the plot with new data.
> >>
> >> e.g.
> >> self.fig = Figure(figsize=(5,5), dpi=100)
> >> self.ax = fig.add_subplot(111)
> >> ax.plot(data[0,0:,0],
> >>
> >>
> >>
> >> canvas = FigureCanvas(fig)
> >> canvas.set_size_request(500,500)
> >>
> >> def on_some_signal(self,widget):
> >> ?????
> >>
> >>
> I also may be wrong.
>
> I thought ax.plot(..) would redraw everything (ticks, labels, etc) to
> do with the plot.
>
> I've been using set_data as I thought it was meant to be quicker.
> self.cline[0].set_data(rX, myabs) # I have to make sure
> I use correct line
> :: ::
> self.canvas.draw()
>
> To just change the data associated with a specific line on plot.
>
> I stored the lines on my graph in a list called cline, I captured the
> line at time of creating of the plot
> r = self.axis.plot( rX, myabs ,self.linestyle, color='b')
> self.cline.append( r[0] )
>
>
> - Steve
>
>
>
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Stephen G. <ste...@op...> - 2010年02月24日 02:28:45
C M wrote:
> On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates <mat...@gm...> wrote:
> 
>> Hi
>> I am using gtk and displaying a plot in a FigureCanvas. In response to an
>> event, I want to update the plot with new data.
>>
>> e.g.
>> self.fig = Figure(figsize=(5,5), dpi=100)
>> self.ax = fig.add_subplot(111)
>> ax.plot(data[0,0:,0],
>>
>>
>>
>> canvas = FigureCanvas(fig)
>> canvas.set_size_request(500,500)
>>
>> def on_some_signal(self,widget):
>> ?????
>>
>>
>> I've tried a number of different things. How do you do this?
>> 
>
> I may be wrong here, but isn't it:
>
> def on_some_signal(self,widget):
> ax.plot(yournewdata)
> canvas.draw()
>
> Che
>
> 
I also may be wrong.
I thought ax.plot(..) would redraw everything (ticks, labels, etc) to 
do with the plot.
I've been using set_data as I thought it was meant to be quicker.
 self.cline[0].set_data(rX, myabs) # I have to make sure 
I use correct line
 :: ::
 self.canvas.draw()
To just change the data associated with a specific line on plot.
I stored the lines on my graph in a list called cline, I captured the 
line at time of creating of the plot
 r = self.axis.plot( rX, myabs ,self.linestyle, color='b')
 self.cline.append( r[0] )
- Steve
From: C M <cmp...@gm...> - 2010年02月24日 01:30:23
On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates <mat...@gm...> wrote:
> Hi
> I am using gtk and displaying a plot in a FigureCanvas. In response to an
> event, I want to update the plot with new data.
>
> e.g.
> self.fig = Figure(figsize=(5,5), dpi=100)
> self.ax = fig.add_subplot(111)
> ax.plot(data[0,0:,0],
>
>
>
> canvas = FigureCanvas(fig)
> canvas.set_size_request(500,500)
>
> def on_some_signal(self,widget):
>   ?????
>
>
> I've tried a number of different things. How do you do this?
I may be wrong here, but isn't it:
def on_some_signal(self,widget):
 ax.plot(yournewdata)
 canvas.draw()
Che
From: Mathew Y. <mat...@gm...> - 2010年02月24日 00:00:50
Hi
I am using gtk and displaying a plot in a FigureCanvas. In response to an
event, I want to update the plot with new data.
e.g.
self.fig = Figure(figsize=(5,5), dpi=100)
self.ax = fig.add_subplot(111)
ax.plot(data[0,0:,0],
canvas = FigureCanvas(fig)
canvas.set_size_request(500,500)
def on_some_signal(self,widget):
 ?????
I've tried a number of different things. How do you do this?
Mathew
From: David G. <d_l...@ya...> - 2010年02月23日 23:46:02
Hi! I'm trying to loop through all the built-in colormaps, applying each to an image before printing it to a file, then moving on to the next one.
>>> from matplotlib import cm
>>> for cmap in dir(cm): # cmap in cm doesn't work 'cause cm is a module
>>> ax.imshow(image, cmap)
>>> canvas.print_figure('image_'+cmap)
works until cmap == 'LUTSIZE', which evaluates to an integer and thus raises an exception. I tried putting it in a try/except:
>>> for cmap in dir(cm):
>>> try: 
>>> ax.imshow(image, cmap)
>>> canvas.print_figure('image_'+cmap)
>>> except:
>>> pass
but despite this, after 'LUTSIZE', every cmap - even valid ones - also raises the exception, and thus doesn't get used. So I tried just by-passing cmap == 'LUTSIZE' (in the obvious way), but then encountered cmap == 'ScalarMapable', which resulted in the same subsequent behavior as 'LUTSIZE'.
At that point I decided I should try a "positive filter," so I figured out that cmaps are instances of matplotlib.colors.LinearSegmentedColormap (which I imported as LSC) and tried adding an "if isinstance(cmap, LSC)", but of course that didn't work, 'cause the elements of dir(cm) are strings, not LSC's.
At this point I've decided I've wasted too much time trying to figure this out on my own, so:
0) is there some "elegant" way to do what I want to do?
1) why doesn't this:
>>> for cmap in dir(cm):
>>> try: 
>>> ax.imshow(image, cmap)
>>> canvas.print_figure('image_'+cmap)
>>> except:
>>> pass
"work" (i.e., simply bypass those elements of dir(cm) which cause imshow to raise an exception, but then continue on as if nothing had happened)? Is this a bug?
Thanks!
DG
 
From: Gökhan S. <gok...@gm...> - 2010年02月23日 23:15:21
On Tue, Feb 23, 2010 at 5:04 PM, Ariel Rokem <ar...@be...> wrote:
> Hi -
>
> yes - but I want something that looks like the generic boxplot, but in
> which I can control where the edges of the boxes are placed what the sizes
> of the whiskers are. A combination of errorbar and bar, with this
> appearance, if you will.
>
> Cheers - Ariel
>
>
I guess then yours will be a non-standard box-plot because in a regular
boxplot median is at 50th percentile, and the edges are at 25 and 75th
respectively. There is no consensus for whiskers some uses 5 and 95 some 10
- 90 or you could come up with your own pair. Don't get surprised if you see
different results for different percentiles. See at
http://old.nabble.com/incorrect-boxplot--td25440025.html
Probably you don't seek something like boxplot's widths kw arg if I
understand you right?
>
> On Tue, Feb 23, 2010 at 2:49 PM, Gökhan Sever <gok...@gm...>wrote:
>
>>
>>
>> On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem <ar...@be...> wrote:
>>
>>> Hi - more generally, is there any way to control the location of the
>>> median line, the vertical size of the box and the vertical location of the
>>> whiskers?
>>>
>>> Thanks - Ariel
>>>
>>>
>> Aren't those generically calculated from the data?
>>
>>
>> --
>> Gökhan
>>
>
>
>
> --
> Ariel Rokem
> Helen Wills Neuroscience Institute
> University of California, Berkeley
> http://argentum.ucbso.berkeley.edu/ariel
>
-- 
Gökhan
From: Ariel R. <ar...@be...> - 2010年02月23日 23:05:22
Hi -
yes - but I want something that looks like the generic boxplot, but in which
I can control where the edges of the boxes are placed what the sizes of the
whiskers are. A combination of errorbar and bar, with this appearance, if
you will.
Cheers - Ariel
On Tue, Feb 23, 2010 at 2:49 PM, Gökhan Sever <gok...@gm...> wrote:
>
>
> On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem <ar...@be...> wrote:
>
>> Hi - more generally, is there any way to control the location of the
>> median line, the vertical size of the box and the vertical location of the
>> whiskers?
>>
>> Thanks - Ariel
>>
>>
> Aren't those generically calculated from the data?
>
>
> --
> Gökhan
>
-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
From: Jae-Joon L. <lee...@gm...> - 2010年02月23日 22:54:31
It is best to create a figure of a right size in the first place.
If this cannot be done, try something like below.
dpi = 80
fig=figure(1, dpi=dpi)
ax = axes((0,0,1,1))
ax.set_aspect(1)
from matplotlib.transforms import TransformedBbox, Affine2D
w, h = fig.get_size_inches()
bbox = TransformedBbox(ax.bbox,
fig.transFigure.inverted()+Affine2D().scale(w, h))
savefig("a.png", bbox_inches=bbox, dpi=dpi)
Note that the size of the output will be different from the original
figure size.
Regards,
-JJ
On Tue, Feb 23, 2010 at 3:37 PM, Bruce Ford <br...@cl...> wrote:
> I'm attempting to output an image with a predictable bounding box so
> that it can be placed into a KML document and be correctly
> georeferenced.
>
> Essentially I need a PNG that has NO labeling and the size of the
> image be exactly the size of the plot bounding box and no more, no
> less.
>
> I can get exactly what I want with the top and bottom of the image with:
>
> fig.add_axes((0,0,1,1)
>
> However, I'm still left with undesired space on the left and right.
> How can I bring the left and right edges of the bounding box to match
> the image width?
>
> Also, this might be a candidate for a handy function for
> pyplot.figure(). This could be very useful for anyone needing to make
> KML-friendly figures.
>
> Thanks for any ideas!
>
> Bruce
> ---------------------------------------
> Bruce W. Ford
> Clear Science, Inc.
> br...@cl...
> http://www.ClearScienceInc.com
> Phone/Fax: 904-379-9704
> 8241 Parkridge Circle N.
> Jacksonville, FL 32211
> Skype: bruce.w.ford
> Google Talk: fo...@gm...
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Gökhan S. <gok...@gm...> - 2010年02月23日 22:49:52
On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem <ar...@be...> wrote:
> Hi - more generally, is there any way to control the location of the median
> line, the vertical size of the box and the vertical location of the
> whiskers?
>
> Thanks - Ariel
>
>
Aren't those generically calculated from the data?
-- 
Gökhan
From: Jae-Joon L. <lee...@gm...> - 2010年02月23日 22:38:30
This seems to be a bug and I recommend you to file a bug.
This happens because Axis.set_ticklabels method only changes the
attributes of left (or bottom) tick labels.
Meanwhile, try
for t in colorbar.ax.get_yticklabels():
 t.set_color("w")
-JJ
On Tue, Feb 23, 2010 at 11:03 AM, Jim Vickroy <Jim...@no...> wrote:
> Hello,
>
> I'm (unsuccessfully) trying to generate a figure (with a labeled colorbar)
> having a black background.
>
> Here is the code.
>
> _purpose_ = 'demonstrate capability to create PNG with black background
> including labeled color bar'
> _author_ = 'jim...@no...'
>
> import numpy   # http://numpy.scipy.org/
> import matplotlib # http://matplotlib.sourceforge.net/index.html
> matplotlib.use('Agg') # http://matplotlib.sourceforge.net/backends.html --
> probably the fastest, non-GUI, rendering backend
> import matplotlib.pyplot as plot #
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot
> import matplotlib.cm # color maps
>
> import sys
> assert sys.version      == '2.6.4 (r264:75708, Oct 26 2009, 08:23:19)
> [MSC v.1500 32 bit (Intel)]', sys.version
> assert numpy.__version__   == '1.4.0', numpy.__version__
> assert matplotlib.__version__ == '0.99.1', matplotlib.__version__
>
> data_min =  0
> data_max = 256
> data   = numpy.random.randint(data_max, size=(512,512))
> rows_cnt, columns_cnt = data.shape
> shape  = rows_cnt, columns_cnt
> x    = numpy.empty(data.shape, dtype=int)
> y    = numpy.empty(data.shape, dtype=int)
> x[:]   = numpy.arange(rows_cnt)
> y[:]   = numpy.arange(columns_cnt)
> XI, YI  = numpy.meshgrid(x[0], y[0])
>
> title   = 'this is the figure title'
> plot.clf() # clear the figure
> plot.title(title,color='white',backgroundcolor='black')
> plot.axis('off')
> colormap = 'gist_heat'
> config  = dict(cmap=eval('matplotlib.cm.%s' % colormap), vmin=data_min,
> vmax=data_max) # vmin,vmax specify a fixed (color-map) scale
> plot.pcolormesh(XI, YI, data, **config)
> colorbar = plot.colorbar()
> ##############################################################################################################################################################
> # labels  = ??? list of strings labels ???
> labels = [str(i) for i in range(10)]
> colorbar.ax.set_yticklabels(labels, color='white')
> ##############################################################################################################################################################
> plot.imshow(data, interpolation='bilinear', cmap=config['cmap'],
> origin='upper', extent=[0,rows_cnt,0,columns_cnt])
> # plot.show() # interactive
> filename = 'trial-plot-with-labeled-colorbar.png'
> plot.savefig(filename, facecolor='black')
> plot.close()
>
> which generates a figure with a black background and invisible (black) color
> bar labels.
>
> I'm probably going about this completely wrong.
>
> Questions:
>
> How do I get white color bar labels?
> How do I access the generated sequence of string labels (for use as the
> first set_yticklabels parameter) rather than artificially defining a list of
> labels?
>
> Thanks,
> -- jv
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jae-Joon L. <lee...@gm...> - 2010年02月23日 22:10:35
See
http://www.mail-archive.com/mat...@li.../msg13203.html
http://www.mail-archive.com/mat...@li.../msg13204.html
-JJ
On Tue, Feb 23, 2010 at 9:22 AM, Sebastian Rhode
<seb...@go...> wrote:
> Hi,
>
> has anyone a good idea how to interactively display the xy coordintes (as
> whole numbers) and the pixel intensity using the mouse cursor. Here is the
> code snippet:
>
> ...
> fig = plt.figure()
> ax1 = fig.add_subplot(111)
> channel_select = 1
> p = imread(filename) # normally I use TIFF file
> if (p.ndim > 2):
>   p1 = p[:,:,channel_select] # if more than 1 channel --> select
> else:
>   p1 = p
>
> ax1.imshow(p1)
> plt.show()
> ...
>
> So far only the XY coordinates are displayed, but not as whole numbers and
> even negative xy values are displayed, if the cursor is move to the corners
> (???). And of course I would like the pixel intensity to be displayed ...
>
> Thanks,
>
> Sebi
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jae-Joon L. <lee...@gm...> - 2010年02月23日 22:04:21
markers are vector paths, so I don't think you can use images as markers.
But you may overlay your images using imshow. The tricky part is to
figure out the extents of the image.
You may use OffsetImage
 http://matplotlib.sourceforge.net/trunk-docs/examples/pylab_examples/demo_annotation_box.html
But, it is only available in the svn version of matplotlib. For
example, you may do something like below
import matplotlib.pyplot as plt
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
import numpy as np
if 1:
 ax = plt.subplot(111)
 xx = [0.22, 0.5, 0.83]
 yy = [0.5, 0.43, 0.63]
 ax.plot(xx, yy, "-")
 arr = np.arange(100).reshape((10,10))
 im = OffsetImage(arr, zoom=2)
 for x1, y1 in zip(xx, yy):
 ab = AnnotationBbox(im, (x1, y1),
 xycoords='data',
 frameon=False)
 ax.add_artist(ab)
-JJ
On Tue, Feb 23, 2010 at 9:07 AM, t putkonen <tee...@gm...> wrote:
> I would like to use custom symbols (markers) on both line charts and scatter
> charts. The symbols I would like to use are currently stored in PNG files.
> Is there a way to convert these images to markers? Symbols are pretty simple
> and contain only one colour, and the background should be transparent.
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jae-Joon L. <lee...@gm...> - 2010年02月23日 21:44:43
On Tue, Feb 23, 2010 at 5:43 AM, Kornél Jahn <kja...@gm...> wrote:
> Hi all!
>
> I am preparing a journal article and the figures should have a fixed width
> of 3 inches, with as thin white border around as possible. The figure does
> an imshow with equal axes:
> My problem is: I do not know in advance the height of my figure to specify
> figsize. The height should vary so that the whole figure (with ticks,
> legends and colorbanr) fits tightly into a 3 x ? inch box.
>
> I have already tried bbox_inches='tight' for savefig and looked at HowTo
> FAQ: automatically make room for tick labels for possible ideas but do no
> have a clue yet.
> Any suggestion is welcome.
>
Do you want you figure width to be exactly 3 inch? Otherwise, I wonder
why bbox_inches="tight" does not work.
My recommendation is
1) create a figure with high enough height.
2) adjust subplot parameters either manually or using the method
described in the FAQ.
3) call savefig with tight bbox option.
If you want your figure width to be exactly 3 inch, try something like below
fig = figure(1, figsize=(3,7))
ax = subplot(111)
ax.set_aspect(1)
def get_tightbbox(renderer, fig=fig):
 from matplotlib.figure import Figure
 from matplotlib.transforms import Bbox
 bbox = Figure.get_tightbbox(fig, renderer)
 w, h = fig.get_size_inches()
 x1, y1, x2, y2 = bbox.extents
 return Bbox.from_extents(0, y1, w, y2)
fig.get_tightbbox = get_tightbbox
savefig("a.png", bbox_inches="tight")
-JJ
> Thx very much!
>
> Kornel
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jae-Joon L. <lee...@gm...> - 2010年02月23日 21:09:11
Try
ax = subplot(111, frame_on=False)
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
table(cellText=cellText, colLabels=colLabels)
-JJ
On Tue, Feb 23, 2010 at 4:06 AM, HUSSAIN BOHRA <hus...@gm...> wrote:
> Hi,
>
> Can any one tell me, How can I draw only a table in a figure (without XY
> Cordinates)
>
> Please find my code below :
>
> # do this before importing pylab or pyplot
> import matplotlib
>
> matplotlib.use('Agg')
> from matplotlib.pyplot import figure
> from matplotlib.table import table
> from pylab import *
>
> fig = figure()
>
>
> colLabels = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
> rowLabels = ['%d year' % x for x in (100, 50, 20, 10, 5)]
> cellText = [['66.4', '174.3', '75.1', '577.9', '32.0'], ['124.6', '555.4',
> '153.2', '677.2', '192.5'], ['213.8', '636.0', '305.7', '1175.2', '796.0'],
> ['292.2', '717.8', '456.4', '1368.5', '865.6'], ['431.5', '1049.4', '799.6',
> '2149.8', '917.9']]
> table(cellText=cellText, colLabels=colLabels)
> fig.savefig('test12.png')
>
> and also the generated png in an attachment.
>
> Can any one tell me how can i remove XY axis and have only table ?
>
> --
> Hussain Bohra
> Sr. Software Engineer
> Tavant Technologies
> Koramangala, Bangalore-95
> mailto: hus...@ta...
> mobile: +91 99867 95727
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Alan G I. <ala...@gm...> - 2010年02月23日 21:09:06
On 2/23/2010 3:44 PM, Friedrich Romstedt wrote:
> http://www.friedrichromstedt.org/index.php?m=186
> 
It's definitely nice to have examples around, although I won't
look at anything that's not explicitly BSD (or MIT) licensed.
Somebody on the SciPy list (I'm forgetting at the moment)
was working on a related project, so you may want to post there.
Alan Isaac
37 messages has been excluded from this view by a project administrator.

Showing results of 620

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