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



Showing results of 397

<< < 1 .. 5 6 7 8 9 .. 16 > >> (Page 7 of 16)
From: Jeff P. <je...@gm...> - 2010年06月17日 15:29:34
can someone tell me how to turn off the frame on the colorbar?
i tried this
...
cb=plt.colorbar()
plt.axes(cb.ax)
plt.box(on=False)
...
but it has no effect
thanks,
jeff
From: Pablo A. <pab...@ua...> - 2010年06月17日 08:57:18
Thanks again!
El 17/06/10 02:03, Mike Alger escribió:
>
> Pablo,
>
> 
>
> I found the example on the svn
> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/mplot3d/surface3d_demo3.py?view=log
> it will demonstrate the face colour thing but personally I found
> getting the rgb tuple data into an array a bit too complicated for my
> needs.
>
> 
>
> Regarding that little SNAFU about the matrix size, I was half asleep
> and in a rush when I wrote the reply to your email, so I knew if I
> made a mistake it was in the interpretation there :D
>
> A slice, reshape function may be more efficient/ easier to read but
> I took the loop structure right from the plot surface command to make
> sure it was done exactly the same way as the 3d surface. It may be
> interesting to see which is more efficient computationally and see if
> there is an improvement to be made in the plot surface command
>
> 
>
> 
>
> *From:* Pablo Angulo [mailto:pab...@ua...]
> *Sent:* June-16-10 9:07 AM
> *To:* Mike Alger
> *Cc:* mat...@li...
> *Subject:* Re: [Matplotlib-users] color in plot3d
>
> 
>
> El 15/06/10 01:22, Mike Alger escribió:
>
> The way that color keyword is set up, it is dedsigned to take a color
> word or rgba tuple , (Reinier will know this better than me), however
> if you want to just assign colors based on a colour map you can take
> you color array and reshape the same way the plot surface command
> does then use surf.set_array()
>
>
> If I understand you correctly, you mean there is a way to use directly
> a map from two or three spatial coordinates into the three or four
> components of the color space?
>
> That's interesting. It might be limiting that this map has to factor
> as the composition of an scalar map and a color map, even for 2d plots.
>
>
>
> here is a snippet of the code I use to do this I am pretty sure it
> won’t run the way it is right now but the idea is buried in there
>
> Thanks, I got the idea!
>
> 
>
> note that regmap xyz and costmapz are all the same size and are nxm
> matrices costmapout is a 2x(m.n) if i can do the math correctly
>
>
> One comment: from your code it seems that costmapout is a 1D array of
> lenght roughly equal (m*n)/scale**2 with the data coming from
> costmapz. Why don't you use a slice followed by a reshape command?
>
> 
>
>
>
>
> 
>
> 
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.829 / Virus Database: 271.1.1/2942 - Release Date:
> 06/16/10 14:35:00
>
From: Hana S. <ha...@cs...> - 2010年06月17日 00:48:05
Hi,
I installed matplotlib-0.99.3-py2.6-macosx10.6.dmg on MacOS X 10.6.3, 
python 2.6.5. But I get an error when running the histogram example from
http://matplotlib.sourceforge.net/examples/api/histogram_demo.html
Exception in Tkinter callback
Traceback (most recent call last):
 File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py", 
line 1410, in __call__
 return self.func(*args)
 File 
"/Library/Python/2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 
212, in resize
 self.show()
 File 
"/Library/Python/2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 
216, in draw
 tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
 File 
"/Library/Python/2.6/site-packages/matplotlib/backends/tkagg.py", line 
19, in blit
 tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, 
id(bbox_array))
TclError
Would anybody know what's wrong?
Thanks,
Hana
From: Mike A. <ma...@ry...> - 2010年06月17日 00:04:02
Pablo, 
 
I found the example on the svn <http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/mplot3d/surface3d_demo3.py?view=log> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/mplot3d/surface3d_demo3.py?view=log it will demonstrate the face colour thing but personally I found getting the rgb tuple data into an array a bit too complicated for my needs.
 
Regarding that little SNAFU about the matrix size, I was half asleep and in a rush when I wrote the reply to your email, so I knew if I made a mistake it was in the interpretation there :D
A slice, reshape function may be more efficient/ easier to read but I took the loop structure right from the plot surface command to make sure it was done exactly the same way as the 3d surface. It may be interesting to see which is more efficient computationally and see if there is an improvement to be made in the plot surface command
 
 
From: Pablo Angulo [mailto:pab...@ua...] 
Sent: June-16-10 9:07 AM
To: Mike Alger
Cc: mat...@li...
Subject: Re: [Matplotlib-users] color in plot3d
 
El 15/06/10 01:22, Mike Alger escribió: 
The way that color keyword is set up, it is dedsigned to take a color word or rgba tuple , (Reinier will know this better than me), however if you want to just assign colors based on a colour map you can take you color array and reshape the same way the plot surface command does then use surf.set_array()
If I understand you correctly, you mean there is a way to use directly a map from two or three spatial coordinates into the three or four components of the color space? 
That's interesting. It might be limiting that this map has to factor as the composition of an scalar map and a color map, even for 2d plots.
 here is a snippet of the code I use to do this I am pretty sure it won’t run the way it is right now but the idea is buried in there
Thanks, I got the idea!
 
note that regmap xyz and costmapz are all the same size and are nxm matrices costmapout is a 2x(m.n) if i can do the math correctly 
One comment: from your code it seems that costmapout is a 1D array of lenght roughly equal (m*n)/scale**2 with the data coming from costmapz. Why don't you use a slice followed by a reshape command? 
 
 
 
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.829 / Virus Database: 271.1.1/2942 - Release Date: 06/16/10 14:35:00
From: Malte D. <mal...@we...> - 2010年06月16日 21:52:30
Hi,
is it helpful to write that both of you examples doesn't crash anything for me 
(except the second only being able to be "$kill"ed)?
mdik@eee:~$ uname -a
Linux eee 2.6.29-2-686 #1 SMP Sun May 17 17:56:29 UTC 2009 i686 GNU/Linux
mdik@eee:~$ python --version
Python 2.5.5
Regards,
Malte
From: Malte D. <mal...@we...> - 2010年06月16日 21:06:39
Hi,
Eamon Caddigan <eam...@gm...>
> The reason my initial attempts failed was because I (erroneously)
> assumed that the default axis spanned (0, 0), (1, 1). Now I that I
> know better, I can place an axis for each image in the right place and
> everything looks fine.
> 
> However, I'm still interested in knowing how to query the pixel size
> of the figure, so I can translate normalized axis coordinates to pixel
> coordinates.
http://matplotlib.sourceforge.net/users/transforms_tutorial.html
Maybe something along the lines
ax.transAxes.transform((0, 0)) - ax.transAxes.transform((1, 1))
?
From: Jae-Joon L. <lee...@gm...> - 2010年06月16日 17:58:28
Did you check values in palette?
With
 palette /= 255
you're setting the value in place. Because the palette.dtype is int,
the result is also an integer array, i.e., only with with zeros and
ones.
You may do
 palette = [reds,greens,blues]
 palette = numpy.array(palette, dtype="d")
Regards,
-JJ
On Wed, Jun 16, 2010 at 1:40 PM, Jim Vickroy <Jim...@no...> wrote:
> Jae-Joon Lee wrote:
>>
>> As you can see from the error, the dimension of your input is wrong
>> (it needs to be transposed).
>> Furthermore, matplotlib expects the rgb values in 0-1.
>>
>> replace
>>
>> colormap = matplotlib.colors.ListedColormap(palette,'custom-orange')
>>
>> with
>>
>> colormap =
>> matplotlib.colors.ListedColormap(palette.T/255.,'custom-orange')
>>
>> Regards,
>>
>> -JJ
>>
>
> Thanks much for this JJ !
>
> I have a follow-up question. :-(
>
> The attached script is a slight modification of the one originally posted.
>
> The attached PNG files are the outputs from the attached script.
>
> Prior to my original post, I had actually tried something "similar" to your
> solution -- namely:
>
> palette = [reds,greens,blues]
> palette = palette.transpose()
> palette /= 255.0
> colormap = matplotlib.colors.ListedColormap(palette,'custom-orange-jv')
>
> I do not know why the 2 PNG files are so different in appearance (and size).
>
> I would appreciate some help understanding this.
>
> Thanks,
> -- jv
>
> P.S.
> As seen in the attached script, the orange-JJ.png is the result of using
> your (i.e., JJ's) solution.
>
>
>
>>
>> On Wed, Jun 16, 2010 at 11:13 AM, Jim Vickroy <Jim...@no...>
>> wrote:
>>
>>>
>>> Hello,
>>>
>>> The attached script shows my (failed) attempt to define a custom color
>>> map
>>> from a set of RGB values (taken from an IDL palette).
>>>
>>> My approach is presumably completely wrong, but I have not found
>>> information
>>> or examples on how to do this.
>>>
>>> Could someone point in the right direction?
>>>
>>> Thanks,
>>>
>>> -- jv
>>>
>>> P.S.
>>> When run on my workstation, the output from the attached script is:
>>>
>>> <output>
>>> Python version:   2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500
>>> 32
>>> bit (Intel)]
>>> matplotlib version: 0.99.3
>>> numpy version:   1.4.0
>>> Traceback (most recent call last):
>>> File "custom-colormap.py", line 97, in <module>
>>>  plotter.savefig('%s.png' %colormap.name, facecolor='black',
>>> edgecolor='black')
>>> File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 356, in
>>> savefig
>>>  return fig.savefig(*args, **kwargs)
>>> File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 1032, in
>>> savefig
>>>  self.canvas.print_figure(*args, **kwargs)
>>> File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line
>>> 1476, in print_figure
>>>  **kwargs)
>>> File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
>>> line 358, in print_png
>>>  FigureCanvasAgg.draw(self)
>>> File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
>>> line 314, in draw
>>>  self.figure.draw(self.renderer)
>>> File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in
>>> draw_wrapper
>>>  draw(artist, renderer, *args, **kwargs)
>>> File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in
>>> draw
>>>  for a in self.axes: a.draw(renderer)
>>> File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in
>>> draw_wrapper
>>>  draw(artist, renderer, *args, **kwargs)
>>> File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1701, in
>>> draw
>>>  im.draw(renderer)
>>> File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in
>>> draw_wrapper
>>>  draw(artist, renderer, *args, **kwargs)
>>> File "C:\Python26\lib\site-packages\matplotlib\image.py", line 237, in
>>> draw
>>>  im = self.make_image(renderer.get_image_magnification())
>>> File "C:\Python26\lib\site-packages\matplotlib\image.py", line 182, in
>>> make_image
>>>  x = self.to_rgba(self._A, self._alpha)
>>> File "C:\Python26\lib\site-packages\matplotlib\cm.py", line 167, in
>>> to_rgba
>>>  x = self.cmap(x, alpha=alpha, bytes=bytes)
>>> File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 489, in
>>> __call__
>>>  if not self._isinit: self._init()
>>> File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 720, in
>>> _init
>>>  for c in self.colors], np.float)
>>> File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 311, in
>>> to_rgb
>>>  raise ValueError('to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc))
>>> ValueError: to_rgb: Invalid rgb arg "(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2,
>>> 3,
>>> 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23,
>>> 25,
>>> 26, 28, 29, 31, 33, 34, 36, 38,
>>> 40, 41, 43, 45, 47, 49, 50, 53, 55, 57, 59, 61, 64, 66, 68, 70, 72, 74,
>>> 76,
>>> 79, 82, 84, 87, 89, 91, 94, 96, 99, 101, 104, 106, 108, 110, 113, 116,
>>> 118,
>>> 121, 124, 127, 128, 131, 134, 137
>>> , 138, 141, 144, 147, 149, 152, 155, 156, 160, 161, 164, 168, 169, 172,
>>> 174,
>>> 177, 179, 182, 184, 188, 189, 191, 195, 196, 198, 202, 203, 205, 209,
>>> 211,
>>> 212, 214, 216, 220, 222, 224, 225
>>> , 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253,
>>> 255,
>>> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
>>> 255,
>>> 255, 255, 255, 255, 255, 255, 255
>>> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
>>> 255,
>>> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
>>> 255,
>>> 255, 255, 255, 255, 255, 255, 255
>>> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
>>> 255,
>>> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
>>> 255,
>>> 255, 255, 255, 255, 255, 255, 255
>>> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
>>> 255,
>>> 255, 255, 255, 255, 255, 255, 255, 255)"
>>> sequence length is 256; must be 3 or 4
>>> </output>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>>> lucky parental unit. See the prize list and enter to win:
>>> http://p.sf.net/sfu/thinkgeek-promo
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>>
>
>
From: Jae-Joon L. <lee...@gm...> - 2010年06月16日 16:26:24
As you can see from the error, the dimension of your input is wrong
(it needs to be transposed).
Furthermore, matplotlib expects the rgb values in 0-1.
replace
 colormap = matplotlib.colors.ListedColormap(palette,'custom-orange')
with
 colormap = matplotlib.colors.ListedColormap(palette.T/255.,'custom-orange')
Regards,
-JJ
On Wed, Jun 16, 2010 at 11:13 AM, Jim Vickroy <Jim...@no...> wrote:
> Hello,
>
> The attached script shows my (failed) attempt to define a custom color map
> from a set of RGB values (taken from an IDL palette).
>
> My approach is presumably completely wrong, but I have not found information
> or examples on how to do this.
>
> Could someone point in the right direction?
>
> Thanks,
>
> -- jv
>
> P.S.
> When run on my workstation, the output from the attached script is:
>
> <output>
> Python version:   2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32
> bit (Intel)]
> matplotlib version: 0.99.3
> numpy version:   1.4.0
> Traceback (most recent call last):
>  File "custom-colormap.py", line 97, in <module>
>   plotter.savefig('%s.png' %colormap.name, facecolor='black',
> edgecolor='black')
>  File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 356, in
> savefig
>   return fig.savefig(*args, **kwargs)
>  File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 1032, in
> savefig
>   self.canvas.print_figure(*args, **kwargs)
>  File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line
> 1476, in print_figure
>   **kwargs)
>  File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
> line 358, in print_png
>   FigureCanvasAgg.draw(self)
>  File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
> line 314, in draw
>   self.figure.draw(self.renderer)
>  File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in
> draw_wrapper
>   draw(artist, renderer, *args, **kwargs)
>  File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in
> draw
>   for a in self.axes: a.draw(renderer)
>  File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in
> draw_wrapper
>   draw(artist, renderer, *args, **kwargs)
>  File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1701, in
> draw
>   im.draw(renderer)
>  File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in
> draw_wrapper
>   draw(artist, renderer, *args, **kwargs)
>  File "C:\Python26\lib\site-packages\matplotlib\image.py", line 237, in
> draw
>   im = self.make_image(renderer.get_image_magnification())
>  File "C:\Python26\lib\site-packages\matplotlib\image.py", line 182, in
> make_image
>   x = self.to_rgba(self._A, self._alpha)
>  File "C:\Python26\lib\site-packages\matplotlib\cm.py", line 167, in
> to_rgba
>   x = self.cmap(x, alpha=alpha, bytes=bytes)
>  File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 489, in
> __call__
>   if not self._isinit: self._init()
>  File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 720, in
> _init
>   for c in self.colors], np.float)
>  File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 311, in
> to_rgb
>   raise ValueError('to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc))
> ValueError: to_rgb: Invalid rgb arg "(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3,
> 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 25,
> 26, 28, 29, 31, 33, 34, 36, 38,
> 40, 41, 43, 45, 47, 49, 50, 53, 55, 57, 59, 61, 64, 66, 68, 70, 72, 74, 76,
> 79, 82, 84, 87, 89, 91, 94, 96, 99, 101, 104, 106, 108, 110, 113, 116, 118,
> 121, 124, 127, 128, 131, 134, 137
> , 138, 141, 144, 147, 149, 152, 155, 156, 160, 161, 164, 168, 169, 172, 174,
> 177, 179, 182, 184, 188, 189, 191, 195, 196, 198, 202, 203, 205, 209, 211,
> 212, 214, 216, 220, 222, 224, 225
> , 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255,
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
> 255, 255, 255, 255, 255, 255, 255
> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
> 255, 255, 255, 255, 255, 255, 255
> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
> 255, 255, 255, 255, 255, 255, 255
> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
> 255, 255, 255, 255, 255, 255, 255, 255)"
> sequence length is 256; must be 3 or 4
> </output>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
You're not defining your dictionary in the way specified in the link. In fact, I don't think you have a dictionary at all.
"First, create a script that will map the range (0,1) to values in the RGB spectrum. In this dictionary, you will have a series of tuples for each color 'red', 'green', and 'blue'. The first elements in each of these color series needs to be ordered from 0 to 1, with arbitrary spacing in between. Now, consider (0.5, 1.0, 0.7) in the 'red' series below. This tuple says that at 0.5 in the range from (0,1) , interpolate from below to 1.0, and above from 0.7. Often, the second two values in each tuple will be the same, but using different values is helpful for putting breaks in your colormap. This is easier understand than might sound, as demonstrated by this simple script"
From: Jim Vickroy [mailto:Jim...@no...]
Sent: Wednesday, June 16, 2010 9:15 AM
To: Paul Hobson
Cc: mat...@li...
Subject: Re: [Matplotlib-users] how to define custom colormap from set of RGB values ?
PH...@Ge...<mailto:PH...@Ge...> wrote:
Give this a shot:
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps
Thanks for your reply.
Previously, I had tried something based on the second example at that URL, but, after considerable time, I could only get a palette that was "close". I do not understand how to use that example to replicate an IDL color map.
The requirement is for me to exactly duplicate the IDL color map (actually several IDL color maps) listed in my script.
-- jv
From: Jim Vickroy [mailto:Jim...@no...]
Sent: Wednesday, June 16, 2010 8:14 AM
To: Matplotlib
Subject: [Matplotlib-users] how to define custom colormap from set of RGB values ?
Hello,
The attached script shows my (failed) attempt to define a custom color map from a set of RGB values (taken from an IDL palette).
My approach is presumably completely wrong, but I have not found information or examples on how to do this.
Could someone point in the right direction?
Thanks,
-- jv
P.S.
When run on my workstation, the output from the attached script is:
<output>
Python version: 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]
matplotlib version: 0.99.3
numpy version: 1.4.0
Traceback (most recent call last):
 File "custom-colormap.py", line 97, in <module>
 plotter.savefig('%s.png' %colormap.name, facecolor='black', edgecolor='black')
 File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 356, in savefig
 return fig.savefig(*args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 1032, in savefig
 self.canvas.print_figure(*args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line 1476, in print_figure
 **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 358, in print_png
 FigureCanvasAgg.draw(self)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 314, in draw
 self.figure.draw(self.renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in draw
 for a in self.axes: a.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1701, in draw
 im.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\image.py", line 237, in draw
 im = self.make_image(renderer.get_image_magnification())
 File "C:\Python26\lib\site-packages\matplotlib\image.py", line 182, in make_image
 x = self.to_rgba(self._A, self._alpha)
 File "C:\Python26\lib\site-packages\matplotlib\cm.py", line 167, in to_rgba
 x = self.cmap(x, alpha=alpha, bytes=bytes)
 File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 489, in __call__
 if not self._isinit: self._init()
 File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 720, in _init
 for c in self.colors], np.float)
 File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 311, in to_rgb
 raise ValueError('to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgb: Invalid rgb arg "(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 25, 26, 28, 29, 31, 33, 34, 36, 38,
40, 41, 43, 45, 47, 49, 50, 53, 55, 57, 59, 61, 64, 66, 68, 70, 72, 74, 76, 79, 82, 84, 87, 89, 91, 94, 96, 99, 101, 104, 106, 108, 110, 113, 116, 118, 121, 124, 127, 128, 131, 134, 137
, 138, 141, 144, 147, 149, 152, 155, 156, 160, 161, 164, 168, 169, 172, 174, 177, 179, 182, 184, 188, 189, 191, 195, 196, 198, 202, 203, 205, 209, 211, 212, 214, 216, 220, 222, 224, 225
, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255)"
sequence length is 256; must be 3 or 4
</output>
From: Jim V. <Jim...@no...> - 2010年06月16日 16:15:16
PH...@Ge... wrote:
>
> Give this a shot:
>
> http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps
>
Thanks for your reply.
Previously, I had tried something based on the second example at that 
URL, but, after considerable time, I could only get a palette that was 
"close". I do not understand how to use that example to replicate an 
IDL color map.
The requirement is for me to exactly duplicate the IDL color map 
(actually several IDL color maps) listed in my script.
-- jv
>
> 
>
> *From:* Jim Vickroy [mailto:Jim...@no...]
> *Sent:* Wednesday, June 16, 2010 8:14 AM
> *To:* Matplotlib
> *Subject:* [Matplotlib-users] how to define custom colormap from set 
> of RGB values ?
>
> 
>
> Hello,
>
> The attached script shows my (failed) attempt to define a custom color 
> map from a set of RGB values (taken from an IDL palette).
>
> My approach is presumably completely wrong, but I have not found 
> information or examples on how to do this.
>
> Could someone point in the right direction?
>
> Thanks,
>
> -- jv
>
> P.S.
> When run on my workstation, the output from the attached script is:
>
> <output>
> Python version: 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC 
> v.1500 32 bit (Intel)]
> matplotlib version: 0.99.3
> numpy version: 1.4.0
> Traceback (most recent call last):
> File "custom-colormap.py", line 97, in <module>
> plotter.savefig('%s.png' %colormap.name, facecolor='black', 
> edgecolor='black')
> File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 356, 
> in savefig
> return fig.savefig(*args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 
> 1032, in savefig
> self.canvas.print_figure(*args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", 
> line 1476, in print_figure
> **kwargs)
> File 
> "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", 
> line 358, in print_png
> FigureCanvasAgg.draw(self)
> File 
> "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", 
> line 314, in draw
> self.figure.draw(self.renderer)
> File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, 
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, 
> in draw
> for a in self.axes: a.draw(renderer)
> File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, 
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1701, 
> in draw
> im.draw(renderer)
> File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, 
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\image.py", line 237, 
> in draw
> im = self.make_image(renderer.get_image_magnification())
> File "C:\Python26\lib\site-packages\matplotlib\image.py", line 182, 
> in make_image
> x = self.to_rgba(self._A, self._alpha)
> File "C:\Python26\lib\site-packages\matplotlib\cm.py", line 167, in 
> to_rgba
> x = self.cmap(x, alpha=alpha, bytes=bytes)
> File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 489, 
> in __call__
> if not self._isinit: self._init()
> File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 720, 
> in _init
> for c in self.colors], np.float)
> File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 311, 
> in to_rgb
> raise ValueError('to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc))
> ValueError: to_rgb: Invalid rgb arg "(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 
> 2, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 
> 22, 23, 25, 26, 28, 29, 31, 33, 34, 36, 38,
> 40, 41, 43, 45, 47, 49, 50, 53, 55, 57, 59, 61, 64, 66, 68, 70, 72, 
> 74, 76, 79, 82, 84, 87, 89, 91, 94, 96, 99, 101, 104, 106, 108, 110, 
> 113, 116, 118, 121, 124, 127, 128, 131, 134, 137
> , 138, 141, 144, 147, 149, 152, 155, 156, 160, 161, 164, 168, 169, 
> 172, 174, 177, 179, 182, 184, 188, 189, 191, 195, 196, 198, 202, 203, 
> 205, 209, 211, 212, 214, 216, 220, 222, 224, 225
> , 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 
> 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
> , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
> 255, 255, 255, 255, 255, 255, 255, 255, 255, 255)"
> sequence length is 256; must be 3 or 4
> </output>
>
Give this a shot:
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps
From: Jim Vickroy [mailto:Jim...@no...]
Sent: Wednesday, June 16, 2010 8:14 AM
To: Matplotlib
Subject: [Matplotlib-users] how to define custom colormap from set of RGB values ?
Hello,
The attached script shows my (failed) attempt to define a custom color map from a set of RGB values (taken from an IDL palette).
My approach is presumably completely wrong, but I have not found information or examples on how to do this.
Could someone point in the right direction?
Thanks,
-- jv
P.S.
When run on my workstation, the output from the attached script is:
<output>
Python version: 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]
matplotlib version: 0.99.3
numpy version: 1.4.0
Traceback (most recent call last):
 File "custom-colormap.py", line 97, in <module>
 plotter.savefig('%s.png' %colormap.name, facecolor='black', edgecolor='black')
 File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 356, in savefig
 return fig.savefig(*args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 1032, in savefig
 self.canvas.print_figure(*args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line 1476, in print_figure
 **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 358, in print_png
 FigureCanvasAgg.draw(self)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 314, in draw
 self.figure.draw(self.renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in draw
 for a in self.axes: a.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1701, in draw
 im.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
 draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\image.py", line 237, in draw
 im = self.make_image(renderer.get_image_magnification())
 File "C:\Python26\lib\site-packages\matplotlib\image.py", line 182, in make_image
 x = self.to_rgba(self._A, self._alpha)
 File "C:\Python26\lib\site-packages\matplotlib\cm.py", line 167, in to_rgba
 x = self.cmap(x, alpha=alpha, bytes=bytes)
 File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 489, in __call__
 if not self._isinit: self._init()
 File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 720, in _init
 for c in self.colors], np.float)
 File "C:\Python26\lib\site-packages\matplotlib\colors.py", line 311, in to_rgb
 raise ValueError('to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgb: Invalid rgb arg "(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 25, 26, 28, 29, 31, 33, 34, 36, 38,
40, 41, 43, 45, 47, 49, 50, 53, 55, 57, 59, 61, 64, 66, 68, 70, 72, 74, 76, 79, 82, 84, 87, 89, 91, 94, 96, 99, 101, 104, 106, 108, 110, 113, 116, 118, 121, 124, 127, 128, 131, 134, 137
, 138, 141, 144, 147, 149, 152, 155, 156, 160, 161, 164, 168, 169, 172, 174, 177, 179, 182, 184, 188, 189, 191, 195, 196, 198, 202, 203, 205, 209, 211, 212, 214, 216, 220, 222, 224, 225
, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255)"
sequence length is 256; must be 3 or 4
</output>
From: Michael D. <md...@st...> - 2010年06月16日 14:25:18
pcolor runs directly on polar plots just fine. No need to convert polar 
to cartesian outside of matplotlib.
#!/usr/bin/env python
from pylab import *
import numpy as np
# Sampling 60 points in both dimensions
T = linspace(0, np.pi * 2, 60)
R = linspace(0, 1.0, 60)
Z = rand(60,60)
# Create a polar axes
ax = subplot(111, projection='polar')
# pcolor plot onto it
c = ax.pcolor(T, R, Z)
title('default: no edges')
show()
Mike
On 06/15/2010 07:08 PM, Benjamin Root wrote:
> Stephane,
>
> First off, you probably do not want to use a surface plot. Rather, 
> pcolor might be more appropriate.
>
> In addition, if you can take the azimuth-range coordinates and convert 
> that into x-y coordinates, you can then plot a pcolor using just 
> that. The code would look something like so (assuming some function 
> polar2xy exists):
>
> # azimuth, r, vals, x, and y are all the same shape
> x, y = polar2xy(azimuth, r)
> plt.pcolor(x, y, vals)
> plt.show()
>
> Once that is working sufficiently, then you will have to modify the 
> code a bit to specify the colormap.
>
> I hope that gets you started.
>
> Ben Root
>
>
> On Tue, Jun 15, 2010 at 10:17 AM, Stephane GONAUER 
> <ste...@so... <mailto:ste...@so...>> 
> wrote:
>
> Hi,
>
> After reading documentations and the matplotlib example I haven’t
> found a way to graph the plot I want.
>
> I am trying to display a radar video (one turn of the antenna at a
> time). As such I need to plot a polar surface in 2D with a
> colormap indicating the video intensity.
>
> My data input is simply a file where intensity are logged along
> rho and theta
>
> The nearest example I found in the documentation is the 3d-surface
> plot but I need to have it in 2D
>
> Can you provide me with some idea/pointers ?
>
> Has it been already tried ?
>
> Best Regards,
>
> Stéphane
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Pablo A. <pab...@ua...> - 2010年06月16日 13:07:18
El 15/06/10 01:22, Mike Alger escribió:
>
> The way that color keyword is set up, it is dedsigned to take a color
> word or rgba tuple , (Reinier will know this better than me), however
> if you want to just assign colors based on a colour map you can take
> you color array and reshape the same way the plot surface command
> does then use surf.set_array()
>
If I understand you correctly, you mean there is a way to use directly a
map from two or three spatial coordinates into the three or four
components of the color space?
That's interesting. It might be limiting that this map has to factor as
the composition of an scalar map and a color map, even for 2d plots.
> here is a snippet of the code I use to do this I am pretty sure it
> won’t run the way it is right now but the idea is buried in there
>
Thanks, I got the idea!
>
> note that regmap xyz and costmapz are all the same size and are nxm
> matrices costmapout is a 2x(m.n) if i can do the math correctly
>
One comment: from your code it seems that costmapout is a 1D array of
lenght roughly equal (m*n)/scale**2 with the data coming from costmapz.
Why don't you use a slice followed by a reshape command?
subcostmapz= costmapz[0::scale,0::scale]
costmapout = subcostmapz.reshape(subcostmapz.size)
> scale= 3 
>
...
> rows, cols = costMAPz.shape
>
> costmapout = []
>
> for rs in np.arange(0, rows-1, scale):
>
> for cs in np.arange(0, cols-1, scale):
>
> costmapout.append(costMAPz[rs][cs])
>
> 
>
> costmapout=np.array(costmapout)
>
From: Eric F. <ef...@ha...> - 2010年06月15日 23:29:09
Attachments: tkpackgrid.py
On 06/15/2010 08:02 AM, Eliot Glairon wrote:
> Hello. Through accident, I found that running the following script will freeze the computer. On my computer, the mouse still worked, but everything else still froze. I have minimalized the code and attached the script for your convienence:
>
> import matplotlib
> matplotlib.use('TkAgg')
> import matplotlib.pyplot as plt
> import Tkinter
> from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
> from matplotlib.figure import Figure
> class simpleapp_tk(Tkinter.Tk):#initialize
> def __init__(self,parent):
> Tkinter.Tk.__init__(self,parent)
> self.grid()
> self.figure = Figure(figsize=(5,4), dpi=100)
> canvas = FigureCanvasTkAgg(self.figure, master=self)
> canvas.show()
> canvas.get_tk_widget().grid(row=0,column=0)
> toolbar = NavigationToolbar2TkAgg( canvas, self )
>
> if __name__ == "__main__":
> app = simpleapp_tk(None)
> app.title('Freezing computer...')
> app.mainloop()
>
> I am running this on linux, YYY is my computer's name (confidential)
> XXX@YYY:~$ uname -a
> Linux YYY 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 i686 GNU/Linux
>
> I obtained my version from the linux repositories.
>
> Mail me back if you fixed this bug or have any questions at ej...@ya....
I am not sure there is anything matplotlib can do about this. You can 
get into trouble mixing the packer (which matplotlib uses) with the grid 
manager even with straight Tkinter. An example is attached. It doesn't 
freeze X like your example, but it does sit in an endless loop.
In your example, I find that using ctrl-alt-F2 I can get to a console, 
but from there I haven't found any solution better than rebooting. 
Killing X should be an alternative, but it not as simple or obvious as 
it used to be. (I am also using ubuntu 10.04, but I run mpl from svn.)
Eric
From: Benjamin R. <ben...@ou...> - 2010年06月15日 23:09:06
Stephane,
First off, you probably do not want to use a surface plot. Rather, pcolor
might be more appropriate.
In addition, if you can take the azimuth-range coordinates and convert that
into x-y coordinates, you can then plot a pcolor using just that. The code
would look something like so (assuming some function polar2xy exists):
# azimuth, r, vals, x, and y are all the same shape
x, y = polar2xy(azimuth, r)
plt.pcolor(x, y, vals)
plt.show()
Once that is working sufficiently, then you will have to modify the code a
bit to specify the colormap.
I hope that gets you started.
Ben Root
On Tue, Jun 15, 2010 at 10:17 AM, Stephane GONAUER <
ste...@so...> wrote:
> Hi,
>
>
>
> After reading documentations and the matplotlib example I haven’t found a
> way to graph the plot I want.
>
>
>
> I am trying to display a radar video (one turn of the antenna at a time).
> As such I need to plot a polar surface in 2D with a colormap indicating the
> video intensity.
>
>
>
>
>
> My data input is simply a file where intensity are logged along rho and
> theta
>
>
>
> The nearest example I found in the documentation is the 3d-surface plot but
> I need to have it in 2D
>
> Can you provide me with some idea/pointers ?
>
>
>
> Has it been already tried ?
>
>
>
>
>
>
>
> Best Regards,
>
> Stéphane
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Eamon C. <eam...@gm...> - 2010年06月15日 22:38:47
Thanks for the suggestion!
The reason my initial attempts failed was because I (erroneously)
assumed that the default axis spanned (0, 0), (1, 1). Now I that I
know better, I can place an axis for each image in the right place and
everything looks fine.
However, I'm still interested in knowing how to query the pixel size
of the figure, so I can translate normalized axis coordinates to pixel
coordinates.
-Eamon
On Thu, Jun 10, 2010 at 9:40 AM, Benjamin Root <ben...@ou...> wrote:
> Actually, You might want to check out axes_grid module in the mpl_toolkits.
> After a quick perusal, I think InsetLocator might be what you are looking
> for in the axes_grid module.
>
> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html
>
> I hope this helps,
> Ben Root
>
> On Thu, Jun 10, 2010 at 8:54 AM, Eamon Caddigan <eam...@gm...>
> wrote:
>>
>> Actually, since axes are created with normalized coordinates, what I
>> really need is a way to query the size of the current figure, in
>> pixels.
>>
>> On Thu, Jun 10, 2010 at 7:43 AM, Eamon Caddigan
>> <eam...@gm...> wrote:
>> > Thanks Scott. In order to precisely position an image using separate
>> > axes, I'd need to be able to query and set the margin between the
>> > bounding box and the actual axes. I can't seem to find any way to do
>> > that, either.
>> >
>> > On Thu, Jun 10, 2010 at 1:13 AM, Scott Sinclair
>> > <sco...@gm...> wrote:
>> >>>On 10 June 2010 07:21, Eamon Caddigan <eam...@gm...> wrote:
>> >>> I'd like to draw thumbnails of images on various plots, e.g., a bar
>> >>> chart with a picture placed at the base of the bar, or a scatter plot
>> >>> with photos next to select points.
>> >>>
>> >>> Reading and resizing the image aren't an issue. However, I've been
>> >>> searching all day, and I can't figure out how to call imshow without
>> >>> it taking over the axis in which its drawn.
>> >>
>> >> You could try using separate axes for your images, as in
>> >>
>> >> http://matplotlib.sourceforge.net/examples/pylab_examples/axes_demo.html
>> >>
>> >> Cheers,
>> >> Scott
>> >>
From: Eliot G. <ej...@ya...> - 2010年06月15日 18:02:30
Attachments: gridtestbug.py
Hello. Through accident, I found that running the following script will freeze the computer. On my computer, the mouse still worked, but everything else still froze. I have minimalized the code and attached the script for your convienence:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import Tkinter
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
class simpleapp_tk(Tkinter.Tk):#initialize
 def __init__(self,parent):
 Tkinter.Tk.__init__(self,parent)
 self.grid()
 self.figure = Figure(figsize=(5,4), dpi=100)
 canvas = FigureCanvasTkAgg(self.figure, master=self)
 canvas.show()
 canvas.get_tk_widget().grid(row=0,column=0)
 toolbar = NavigationToolbar2TkAgg( canvas, self )
if __name__ == "__main__":
 app = simpleapp_tk(None)
 app.title('Freezing computer...')
 app.mainloop()
I am running this on linux, YYY is my computer's name (confidential)
XXX@YYY:~$ uname -a
Linux YYY 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 i686 GNU/Linux
I obtained my version from the linux repositories.
Mail me back if you fixed this bug or have any questions at ej...@ya....
 
From: Stephane G. <ste...@so...> - 2010年06月15日 15:47:27
Hi,
 
After reading documentations and the matplotlib example I haven’t found a
way to graph the plot I want. 
 
I am trying to display a radar video (one turn of the antenna at a time). As
such I need to plot a polar surface in 2D with a colormap indicating the
video intensity.
 
 
My data input is simply a file where intensity are logged along rho and
theta
 
The nearest example I found in the documentation is the 3d-surface plot but
I need to have it in 2D
Can you provide me with some idea/pointers ? 
 
Has it been already tried ? 
 
 
 
Best Regards,
Stéphane
From: Mike A. <ma...@ry...> - 2010年06月14日 23:22:59
First what version of mpl are you using? if it is recent this colour word already exists, I asked about this a couple months ago and i should point you first to the example in the svn it does a checkerboard, but i cannot remember the exact name. Although i know it plots a checkerboard effect on one of the example plots. 
 
The way that color keyword is set up, it is dedsigned to take a color word or rgba tuple , (Reinier will know this better than me), however if you want to just assign colors based on a colour map you can take you color array and reshape the same way the plot surface command does then use surf.set_array()
 
here is a snippet of the code I use to do this I am pretty sure it won’t run the way it is right now but the idea is buried in there
 
note that regmap xyz and costmapz are all the same size and are nxm matrices costmapout is a 2x(m.n) if i can do the math correctly 
 
 
 from mpl_toolkits.mplot3d import Axes3D
 from matplotlib import cm
 import numpy as np
#--------------------------------------------------
 ax = Axes3D(fig)
 
 scale= 3 
 surf = ax.plot_surface(regMAPx ,regMAPy,-regMAPz , rstride=scale,cstride=scale, cmap=cm.jet, linewidth=.250 )
 
# to reshape the cost map to match grid used in plot surf
 rows, cols = costMAPz.shape
 costmapout = []
 for rs in np.arange(0, rows-1, scale):
 for cs in np.arange(0, cols-1, scale):
 costmapout.append(costMAPz[rs][cs])
 
 costmapout=np.array(costmapout)
 surf.set_array(costmapout)
 
## do your show plot stuff here!!
 
 
 
 
 
Mike Alger
 
From: Pablo Angulo [mailto:pab...@ua...] 
Sent: June-11-10 7:04 AM
To: mat...@li...
Subject: [Matplotlib-users] color in plot3d
 
 Hello!
 I wonder if there is a way to make 3d plots specifying arbitrary colors, instead of having the color be a function of the height. I was able to achieve this making minimal changes to the plot_surface method of Axes3D, adding as an optional keyword argument a function cfun which specifies the color (it specifies a real number that is mapped into a color by the color map cmap). But is there a standard way?
 Regard
Pablo Angulo
from matplotlib.colors import Normalize, colorConverter
def plot_surface(self, X, Y, Z, *args, **kwargs):
 '''
 Create a surface plot.
 
 By default it will be colored in shades of a solid color,
 but it also supports color mapping by supplying the *cmap*
 argument.
 
 ========== ================================================
 Argument Description
 ========== ================================================
 *X*, *Y*, Data values as numpy.arrays
 *Z*
 *rstride* Array row stride (step size)
 *cstride* Array column stride (step size)
 *color* Color of the surface patches
 *cmap* A colormap for the surface patches.
 *cfun* The function giving the color
 ========== ================================================
 '''
 
 had_data = self.has_data()
 
 rows, cols = Z.shape
 tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
 rstride = kwargs.pop('rstride', 10)
 cstride = kwargs.pop('cstride', 10)
 
 color = kwargs.pop('color', 'b')
 color = np.array(colorConverter.to_rgba(color))
 cmap = kwargs.get('cmap', None)
 cfun = kwargs.pop('cfun', None)
 polys = []
 normals = []
 avgz = []
 if not cfun:
 cfun = lambda p:p[2]
 
 for rs in np.arange(0, rows-1, rstride):
 for cs in np.arange(0, cols-1, cstride):
 ps = []
 corners = []
 for a, ta in [(X, tX), (Y, tY), (Z, tZ)]:
 ztop = a[rs][cs:min(cols, cs+cstride+1)]
 zleft = ta[min(cols-1, cs+cstride)][rs:min(rows, rs+rstride+1)]
 zbase = a[min(rows-1, rs+rstride)][cs:min(cols, cs+cstride+1):]
 zbase = zbase[::-1]
 zright = ta[cs][rs:min(rows, rs+rstride+1):]
 zright = zright[::-1]
 corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]])
 z = np.concatenate((ztop, zleft, zbase, zright))
 ps.append(z)
 
 # The construction leaves the array with duplicate points, which
 # are removed here.
 ps = zip(*ps)
 lastp = np.array([])
 ps2 = []
 avgzsum = 0.0
 for p in ps:
 if p != lastp:
 ps2.append(p)
 lastp = p
 avgzsum += cfun(p)
 polys.append(ps2)
 avgz.append(avgzsum / len(ps2))
 
 v1 = np.array(ps2[0]) - np.array(ps2[1])
 v2 = np.array(ps2[2]) - np.array(ps2[0])
 normals.append(np.cross(v1, v2))
 
 polyc = art3d.Poly3DCollection(polys, *args, **kwargs)
 if cmap is not None:
 polyc.set_array(np.array(avgz))
 polyc.set_linewidth(0)
 else:
 colors = self._shade_colors(color, normals)
 polyc.set_facecolors(colors)
 
 self.add_collection(polyc)
 self.auto_scale_xyz(X, Y, Z, had_data)
 
 return polyc
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.829 / Virus Database: 271.1.1/2933 - Release Date: 06/12/10 14:35:00
From: Daniel J. <law...@gm...> - 2010年06月14日 20:32:58
Hi matplotlib users,
I'm trying to write a script to loop through a bunch of tiff files,
display each image, and choose to accept or reject each image.
Something like:
for f in files:
 im = imread(f)
 imshow(im)
 # Accept keyboard input to accept or reject image
 # Close the image
The problem is that I can't figure out how to show multiple images in
series. I can't use matplotlib.pyplot.show() because that can only be
used once at the very end of a script, and I don't want to show all
the images at once. matplotlib.pyplot.draw() seemed like a promising
candidate, but it only seems to work if I've already used show() once
in the script. It seems like there should be a simple way to do this,
but I can't quite seem to find it.
Thanks,
Daniel
From: Oz N. <na...@gm...> - 2010年06月14日 17:57:55
Hi Eric,
Thanks for your reply. I've already suspected that it's a simple linear
interpolation like in matlab.
And for better interpolation I should use griddata on a finer grid. That's
all clear now !
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: Eric F. <ef...@ha...> - 2010年06月14日 17:30:46
On 06/13/2010 10:27 PM, David Kremer wrote:
>> Hi Everyone,
>> I'd like to know, what is the underline mechanism that connects the
> points
>> of my gridded data when I use
>> contour().
>> Can I control this mechanism ?
No. If you want smoother contours you can either use a 2-D 
interpolation method to map your data to a finer grid and then use that 
for contouring, or you can use a spline algorithm to smooth the contour 
paths directly. There are more problems and pitfalls with the second 
method than with the first, so don't bother trying it.
>> Maybe I missed it in the documentation, but it's not clear to me.
>> Thanks in advance,
>>
> I think it's the same than this used in the imshow method. Would you
> like to check ?
No, image display and contouring use completely different algorithms. 
Imshow uses any of several 2-D interpolation methods to map values given 
on one square grid onto another square grid. It does not create paths; 
it simply displays pixels. In contouring, linear interpolation is used 
to find the intersections between contour level lines and grid lines; 
the intersection points are connected by line segments; and the line 
segments are assembled into complete contour paths, which are then drawn 
(contour) or filled (contourf).
Eric
>
> greetings.
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: David K. <dav...@gm...> - 2010年06月14日 08:27:40
> Hi Everyone,
> I'd like to know, what is the underline mechanism that connects the 
points
> of my gridded data when I use
> contour().
> Can I control this mechanism ?
> Maybe I missed it in the documentation, but it's not clear to me.
> Thanks in advance,
> 
I think it's the same than this used in the imshow method. Would you 
like to check ?
greetings.
From: Ola S. <ska...@si...> - 2010年06月14日 07:14:21
On Fri, Jun 11, 2010 at 4:50 PM, Benjamin Root <ben...@ou...> wrote:
> Ola,
>
> Just to make sure, have you tried "ax.set_xticks([])"?
Yes, I have tried that, but without success. Looks like the tick-logic
is overridden for 3d plotting. Or at least, I cannot figure out how it
works.
Ola
> Ben Root
>
>
>
> On Fri, Jun 11, 2010 at 3:05 AM, Ola Skavhaug <ska...@si...> wrote:
>>
>> Hi,
>>
>> I'm trying to remove the xtickmarks and ytickmarks from a 3d plot,
>> without any success.
>>
>> The example I experiment with is the following:
>>
>> from mpl_toolkits.mplot3d import axes3d
>> import matplotlib.pyplot as plt
>>
>> fig = plt.figure()
>> ax = axes3d.Axes3D(fig)
>> X, Y, Z = axes3d.get_test_data(0.05)
>> cset = ax.contour(X, Y, Z, 16, extend3d=True)
>> ax.clabel(cset, fontsize=9, inline=1)
>>
>> #One try that didn't work
>> ax.set_xticklabels("")
>>
>> plt.show()
>>
>> It looks like the final plot ignores all my efforts in turning the
>> ticks off. Any help on this matter would be greatly appreciated.
>>
>> Regards,
>> --
>> Ola Skavhaug
>> Research Programmer
>> Simula Research Laboratory
>>
>>
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit. See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
Ola Skavhaug
Research Programmer
Simula Research Laboratory
From: Eric F. <ef...@ha...> - 2010年06月13日 00:41:44
On 06/12/2010 12:57 PM, Christopher Brewster wrote:
> On an iMac running 10.6.3, python 2.6.4 I have installed numpy and then matplotlib using 'pip'.
> The message in both cases was that the install was successful.
>
> 'import matplotlib' does not cause error messages.
> 'from pylab import randn, hist' gets a traceback with the message "ImportError: No module named ma"
>
> How do I get matplotlib to work?
Delete your old versions, and install up-to-date versions of numpy and 
matplotlib. I don't know anything about pip, but it found you an 
ancient version of mpl that is incompatible with your version of numpy.
http://matplotlib.sourceforge.net/users/installing.html
Eric
>
> Thank you for any help.
>
> Christopher
>
> ------
>>>> from pylab import randn, hist
> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:62: DeprecationWarning: the md5 module is deprecated; use hashlib instead
> import md5, os, re, shutil, sys, warnings
> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pytz/tzinfo.py:5: DeprecationWarning: the sets module is deprecated
> from sets import Set
> Traceback (most recent call last):
> File "<stdin>", line 1, in<module>
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylab.py", line 1, in<module>
> from matplotlib.pylab import *
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pylab.py", line 206, in<module>
> from matplotlib.numerix import npyma as ma
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/numerix/__init__.py", line 166, in<module>
> __import__('ma', g, l)
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/numerix/ma/__init__.py", line 16, in<module>
> from numpy.core.ma import *
> ImportError: No module named ma
> ------
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
19 messages has been excluded from this view by a project administrator.

Showing results of 397

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