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




Showing 10 results of 10

From: Gideon S. <si...@ma...> - 2008年09月26日 23:11:50
Is there anything akin to this MATLAB script:
http://www.mathworks.com/company/newsletters/digest/june00/export/
available for mpl? or some simple set of commands that will 
accomplish the same task?
-gideon
From: Eric F. <ef...@ha...> - 2008年09月26日 21:53:37
ziw...@ni... wrote:
> Dear All,
> 
> For the class "PrintoutWx" in backend_wx.py, because it doesn't update the API
> change from matplotlib 0.98.3. All of "print" and "print preview" doesn't
> work correctly on new version(matplotlib 0.98.3.)
> 
> if we change the line in 2109 "self.canvas.figure.dpi.set(fig_dpi)"
> into
> "self.canvas.figure.set_dpi(fig_dpi)".
> Then it works.
> 
> Would you please change that.
Fixed in svn 6123.
Thank you.
Eric
> 
> Your sincerity,
> Ziwen Fu
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Goyo <goy...@gm...> - 2008年09月26日 20:37:20
El jue, 25-09-2008 a las 22:19 +0200, Oz Nahum escribió:
> >¿What's the meaning of that data arrange? I can't make any sense of
> >plotting a 2D scatter from a 3D array.
> 
> when I wrote:
> head = [[0, 0, 10],
> [1, 0, 13],
> [2, 0, 11],
> [3, 0, 12],
> [1, 2, 11]]
> 
> my meaning was to represent point of intereset with x, y coordinates
> and the 3rd number was height for example. 
> I felt like I couldn't access the individual points easily, because
> their are located in on big list...
> So I wanted to have the list broken into rows, and the each row
> represents a value on the y axis... like this:
> head = [
> [[0, 0, 10], [0, 0, 13]],
> [[2, 0, 11], [3, 0, 12]],
> ]
Mm... maybe this is better for your eyes but not for processing, I
think.
> 
> But that's redundant I think now, after looking into the function
> zip. 
> Maybe I could write head in the following way:
> 
> # j = 0 1
> head = [ 
> [[ 0, 10], [ 1, 13]], # i =0
> [[ 0, 11], [ 1, 12]], # i =1
> ]
The same. Parsing a data file usually yields a sequence of rows
(records), data processing functions usually expects columns of
homogeneous data and convert from records to columns and back is pretty
straightforward using zip. If you want to use a different representation
for your data you'll need to handle more complex structures and
conversions. Do it if you think it pays (sometimes it does).
> But actually after understanding what zip does, I think I don't need
> it anyway...
> Talking about this: can you give me an example of another use of zip ?
> not just zip(*head)
> 
> I did help(zip) but I could partially understand what it does. I
> learned more by doing:
> x,y,z = zip(*head)
> and then printing x,y,z individually.
There is no other use I can think of. If you think of the arguments
passed to zip as rows, it returns the columns. If the arguments are
columns, zip returns rows. How you name things depends on how you think
of your data. There is no other use I can think of.
zip expects each row (if they are rows) to be passed as an argument so
you usually need that * thing to unpack them. When you call zip(*x), x
being a sequence or array-like, you are actually passing each element of
x as an argument to zip.
Try this:
numbers = [1, 2, 3, 4, 5]
english = ['one', 'two', 'three', 'four', 'five']
spanish = ['uno', 'dos', 'tres', 'cuatro', 'cinco']
x = [numbers, english, spanish]
zip(numbers, english, spanish)
zip(x)
zip(*x)
You can learn about unpacking and zipping sequences reading the Python
Tutorial or another similar resource (maybe Dive into Python dives into
it, not sure but a useful reading anyway).
Goyo
From: Momme B. <mo...@ya...> - 2008年09月26日 14:16:13
When plotting a global image using the robinson projection and the bluemarble image, I have the problem that the image remains rectangular and goes beyond the curved projection map boundaries (see attachment). Is there anyway around this?
Cheers,
Momme
import mpl_toolkits.basemap as b
import numpy as np
def draw(center=11.,latres=10.,lonres=10.):
 m = b.Basemap(projection='robin',lon_0=center)
 m.drawcoastlines()
 m.drawmapboundary()
 m.drawmeridians(np.arange(0,360,lonres),color='0.5',labels=[0,0,0,1])
 m.drawparallels(np.arange(-90,90,latres),color='0.5',labels=[1,0,0,0])
 im=m.bluemarble()
 return m
 
From: Friedrich H. <fri...@gm...> - 2008年09月26日 13:21:07
On Fri, Sep 26, 2008 at 12:52:01PM +0100, Peter Saffrey wrote:
> Is there a way to automatically resize plots (and subplots) and 
> move/resize plot legends so that they don't obscure the plotted data? I 
> have this problem especially on plots with 4 or 5 tracks.
> 
> I can post an example, but I wasn't sure of the etiquette of posting 
> images to this list.
Yes as *.png. I think it's convinient to understand your problem in a
few seconds.
By,
 Friedrich
From: Jeff W. <js...@fa...> - 2008年09月26日 11:57:05
Antoine De Pauw wrote:
> Jeff,
>
> I totally agree this is due to missing values
>
> Again I've got difficulties to find good words so forgive me, what I tried
> to say is that the ability to have that border transparent would be a good
> feature in next releases, for people who need to interpolate and plot such
> data and have an aesthetic result
> 
Antoine: First of all, let's not call it a 'border' - it happens to show 
up around the border of the image in your case, but fundamentally it's 
just missing pixels in the image. The missing pixels are already 
transparent - what you're seeing is the axes background showing through 
the missing values.
> Imshow is the ideal candidate for satellite data as it has some nice
> interpolation features and it is fast, so it can be batch-run on the server
> every time we receive data, without too much computation time
>
> The alternative I'm using now is a double or quadruple size grid to reduce
> the width of that border, with background color set to the lower colormap
> color
>
> That way, the border is really hard to see and it makes (almost) quality
> plots for publications
> 
I think you're already doing everything that can be done - aside from 
making the plot region smaller so it's inside the convex hull of the 
data and there are no missing values. I don't see how changing the 
behavior of imshow would help you any further.
-Jeff
> -----Original Message-----
> From: Jeff Whitaker [mailto:js...@fa...] 
> Sent: Thursday, 25 September, 2008 15:34
> To: De Pauw Antoine
> Cc: 'Matplotlib Users'
> Subject: Re: [Matplotlib-users] Information request
>
> De Pauw Antoine wrote:
> 
>> Jeff,
>>
>> Thanks for the tip, it's now working perfectly
>>
>> However, there's still that border with the imshow plot, and I think it
>> would be good to have it transparent
>>
>> There's a zoomed picture I made:
>> http://img218.imageshack.us/img218/5833/imshowborderxz9.png
>>
>> You see the shadow around the data...
>>
>> It would be nice for next releases of Matplotlib to get rid of that, but
>> 
> I'm
> 
>> not able to patch it myself or so... I know there's still a lot of work
>> 
> with
> 
>> the lib but keep the good work, it is really fantastic
>>
>> Thanks for your help!
>>
>> Antoine De Pauw
>> Collaborateur de recherches, Informatique - Research collaborator, IT
>> Laboratoire de chimie quantique et photophysique - Quantum chemistry and
>> photophysics laboratory
>> Université Libre de Bruxelles - ULB
>> 
>> 
>
> Antoine: I thought we agreed that it's not an imshow bug - but rather 
> due to the griddata gridding procedure returning missing values outside 
> the convex hull of the input data. Do you disagree? I see no such border 
> around an imshow plot that contains no missing values. If you shrink the 
> size of the map plotting region so it's fully within the convex hull of 
> the data, the border disappears.
>
> -Jeff
> 
>> -----Original Message-----
>> From: Jeff Whitaker [mailto:js...@fa...] 
>> Sent: jeudi 25 septembre 2008 14:15
>> To: De Pauw Antoine
>> Cc: 'Matplotlib Users'
>> Subject: Re: [Matplotlib-users] Information request
>>
>> De Pauw Antoine wrote:
>> 
>> 
>>> Hi Jeff,
>>>
>>> I finally found out how to fill my figure with a background color using
>>> axes.set_axis_bgcolor(color), but I'm facing the following problem now:
>>>
>>> How could I get the lower color of a colormap? This is quite undocumented
>>> and I don’t know the colormap properties I could use for that
>>>
>>> I know there must be an accessible value somewhere, like for the
>>> ax.get_yticklabels() you gave me
>>>
>>> If someone had the clue, my problems would then be completely solved
>>>
>>> Antoine De Pauw
>>> Collaborateur de recherches, Informatique - Research collaborator, IT
>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry and
>>> photophysics laboratory
>>> Université Libre de Bruxelles - ULB
>>> 
>>> 
>>> 
>> Antoine: To get the RGBA value associated with a particular data value, 
>> just call the colormap as a function as pass it that value. For example
>>
>> >>> import matplotlib.pyplot as plt
>> >>> plt.cm.jet(1)
>> (0.0, 0.0, 0.517825311942959, 1.0)
>>
>> BTW: the 'fill_color' kwarg of drawmapboundary basemap method allows you 
>> to set the background color of the map.
>>
>> http://matplotlib.sourceforge.net/basemap/doc/html/api/basemap_api.html
>>
>> It fills only the map region (which for some projections, like the 
>> orthographic, is not the same as the axes region).
>>
>>
>> -Jeff
>> 
>> 
>>> -----Original Message-----
>>> From: Jeff Whitaker [mailto:js...@fa...] 
>>> Sent: mardi 23 septembre 2008 20:38
>>> To: De Pauw Antoine
>>> Cc: 'John Hunter'; 'Matplotlib Users'
>>> Subject: Re: [Matplotlib-users] Information request
>>>
>>> De Pauw Antoine wrote:
>>> 
>>> 
>>> 
>>>> Jeff,
>>>>
>>>> I still don't know how to either remove this artifact or fill my arrays
>>>> 
>>>> 
>>>> 
>>> with
>>> 
>>> 
>>> 
>>>> values to remove empty regions, and I'll make a last attempt to resolve
>>>> 
>>>> 
>> it
>> 
>> 
>>>> I uploaded a data file here: http://scqp.ulb.ac.be/20080821.b56
>>>>
>>>> The actual code snippet is here:
>>>> http://snipplr.com/view/8307/map-plotting-python-code-temporary/
>>>>
>>>> I hope you'll be able to reproduce it, I set the cmap to winter for you
>>>> 
>>>> 
>> to
>> 
>> 
>>>> see the gap... setting it to hot will make the grayish border visible in
>>>> high resolution by zooming it... I think the border (not the empty zone)
>>>> could be an artifact with the hot colormap
>>>>
>>>>
>>>> Antoine De Pauw
>>>> Collaborateur de recherches, Informatique - Research collaborator, IT
>>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry and
>>>> photophysics laboratory
>>>> Université Libre de Bruxelles - ULB
>>>>
>>>> 
>>>> 
>>>> 
>>>> 
>>> Antoine: Here is a version that just plots the pixels directly, without 
>>> interpolating to a grid. I personally like this better, since you can 
>>> easily see where you actually have data.
>>>
>>> HTH,
>>>
>>> -Jeff
>>>
>>> from mpl_toolkits.basemap import Basemap
>>> import matplotlib.pyplot as plt
>>> import matplotlib.mlab as mlab
>>> import numpy as np
>>> import os
>>> fileName = '20080821.b56'
>>> titre='SO2'
>>> legende='Delta Brightness Temperature (K)'
>>> nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
>>> rawfile=np.fromfile(open(fileName,'rb'),'<d',-1)
>>> Lat=rawfile[0:nbreligne]
>>> Lon=rawfile[nbreligne:nbreligne*2]
>>> Val=rawfile[nbreligne*21:nbreligne*22]
>>> map=Basemap(projection='mill',llcrnrlat=-90,urcrnrlat=90,\
>>> urcrnrlon=180,llcrnrlon=-180,resolution='l')
>>> x, y = map(Lon, Lat)
>>>
>>> 
>>> 
> plt.scatter(x,y,s=25,c=Val,marker='s',edgecolor="None",cmap=plt.cm.winter,vm
> 
>> 
>> 
>>> in=-5,vmax=-1.2, 
>>> alpha=0.5)
>>> cb=plt.colorbar(shrink=0.6)
>>> cb.ax.set_ylabel(legende,fontsize=11)
>>> for t in cb.ax.get_yticklabels():
>>> t.set_fontsize(7)
>>> meridians = np.arange(-180,180,60)
>>> parallels = np.arange(-90,90,30)
>>> map.drawparallels(parallels,labels=[1,0,0,0],fontsize=7,linewidth=0.25)
>>> map.drawmeridians(meridians,labels=[0,0,0,1],fontsize=7,linewidth=0.25)
>>> map.drawcoastlines(0.25,antialiased=1)
>>> plt.title(titre)
>>> plt.show()
>>> 
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: Jeff Whitaker [mailto:js...@fa...] 
>>>> Sent: lundi 22 septembre 2008 13:59
>>>> To: De Pauw Antoine
>>>> Cc: 'John Hunter'; 'Matplotlib Users'
>>>> Subject: Re: [Matplotlib-users] Information request
>>>>
>>>> De Pauw Antoine wrote:
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> Jeff,
>>>>>
>>>>> I included here a figure where you'll see the border problem for imshow
>>>>> 
>>>>> 
>>>>> 
>>> in
>>> 
>>> 
>>> 
>>>>> my case
>>>>>
>>>>> http://img217.imageshack.us/img217/5240/testfigzp3.png
>>>>>
>>>>> The border wraps at -180 and 180 to form the white line
>>>>>
>>>>> PS: it is atmospheric ice and not SO2, I just omitted to change the
>>>>> 
>>>>> 
>> title
>> 
>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> ^^
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> Antoine De Pauw
>>>>> Collaborateur de recherches, Informatique - Research collaborator, IT
>>>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry
>>>>> 
> and
> 
>>>>> photophysics laboratory
>>>>> Université Libre de Bruxelles - ULB
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> Antoine: I hate to keep repeating myself - but we can't do much if you 
>>>> don't provide a self-contained script, that I can run, which reproduces 
>>>> the problem. My guess is that the line along the dateline, and the 
>>>> point at the South Pole are missing values (which griddata set to 
>>>> missing because they are outside the extent of the data) - but that's 
>>>> just a guess until I can reproduce it.
>>>>
>>>> -Jeff
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> -----Original Message-----
>>>>> From: Antoine De Pauw [mailto:and...@ul...] 
>>>>> Sent: jeudi 18 septembre 2008 17:23
>>>>> To: Jeff Whitaker; and...@ul...
>>>>> Cc: 'John Hunter'; 'Matplotlib Users'
>>>>> Subject: re:Re: [Matplotlib-users] Information request
>>>>>
>>>>> Jeff,
>>>>>
>>>>> No the example doesn't show that line
>>>>>
>>>>> If I reduce the amount of data, the border will be on every side of the
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> plot
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> I'll show you an orthographic plot with no maskinf tomorrow and you
>>>>> 
> will
> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> see
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> the problem easily, it wraps in a white line along the 0° meridian and
>>>>> 
> a
> 
>>>>> white circle in the pole
>>>>>
>>>>> I think it's the imshow layer that is not totally transparent on the
>>>>> 
> map
> 
>>>>> background.. I tried every trick I could for example to put some
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> zero-valued
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> points on each corner to make imshow interpolate correctly the sides,
>>>>> 
>>>>> 
>> but
>> 
>> 
>>>>> that doesn't make any difference
>>>>>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>> De Pauw Antoine wrote:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> Jeff,
>>>>>>>
>>>>>>> Yes they disappear, and they fluctuate with the interpolation method
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>> used
>>>> 
>>>> 
>>>> 
>>>> 
>>>>>>> For example, nearest interpolation don't show the line
>>>>>>>
>>>>>>> Also, if I reduce the grid resolution, the line is thicker, and if I
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>> use
>>> 
>>> 
>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>> a
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>>> masked array to get rid of undesired values, the border shows really
>>>>>>> strongly
>>>>>>>
>>>>>>> Here's an example everyone will see:
>>>>>>>
>>>>>>> http://img225.imageshack.us/img225/2671/testfigep2.png
>>>>>>>
>>>>>>> (everything except the clouds is noise)
>>>>>>>
>>>>>>> Antoine De Pauw
>>>>>>> Collaborateur de recherches, Informatique - Research collaborator, IT
>>>>>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>> and
>>> 
>>> 
>>> 
>>>>>>> photophysics laboratory
>>>>>>> Université Libre de Bruxelles - ULB
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> Antoine: Sorry to seem dense, but I don't see anything wrong with
>>>>>> 
> that
> 
>>>>>> 
>>>>>> 
>> 
>> 
>>>>>> plot. I see a white border along the north and south pole, but I 
>>>>>> intrepret that to be missing values. However, my eyes are notoriously
>>>>>> 
>
> 
>>>>>> bad. I'd like to be to run a script that generates the artifacts 
>>>>>> myself, so I can zoom in and see the problem myself. Does the 
>>>>>> griddata_demo.py script show the same problem for you?
>>>>>>
>>>>>> -Jeff
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> -----Original Message-----
>>>>>>> From: Jeff Whitaker [mailto:js...@fa...] 
>>>>>>> Sent: mercredi 17 septembre 2008 19:05
>>>>>>> To: John Hunter
>>>>>>> Cc: De Pauw Antoine; Matplotlib Users
>>>>>>> Subject: Re: [Matplotlib-users] Information request
>>>>>>>
>>>>>>> John Hunter wrote:
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>> On Wed, Sep 17, 2008 at 11:54 AM, John Hunter <jd...@gm...>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>> wrote:
>>>> 
>>>> 
>>>> 
>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> Attached is a screenshot (zoom.png) from the gimp, zoomed in near
>>>>>>>>> 
>>>>>>>>> 
>> the
>> 
>> 
>>>>>>>>> axes border. The black horizontal line is the top axes border, the
>>>>>>>>> horizontal grey line is the artifact, the vertical dashed line is a
>>>>>>>>> grid line. I don't know if this offers a clue, but if you look at
>>>>>>>>> 
> a
> 
>>>>>>>>> zoom in the upper right corner, the grey line seems to break up
>>>>>>>>> 
> and
> 
>>>>>>>>> curve down and to the right (corner.png)
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> Sorry, screwed up corner.png (I attached the original and not the
>>>>>>>> screenshot). The correct screenshot is attached
>>>>>>>> 
>>>>>>>>
>>>>>>>>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> John: OK, now I finally see it. Antoine: Do these artifacts 
>>>>>>> disappear if you comment out the imshow call?
>>>>>>>
>>>>>>> -Jeff
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> -- 
>>>>>> Jeffrey S. Whitaker Phone : (303)497-6313
>>>>>> Meteorologist FAX : (303)497-6449
>>>>>> NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
>>>>>> 325 Broadway Office : Skaggs Research Cntr 1D-113
>>>>>> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>>>>>>
>>>>>>
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
>
>
> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Peter S. <pz...@dc...> - 2008年09月26日 11:52:17
Is there a way to automatically resize plots (and subplots) and 
move/resize plot legends so that they don't obscure the plotted data? I 
have this problem especially on plots with 4 or 5 tracks.
I can post an example, but I wasn't sure of the etiquette of posting 
images to this list.
Cheers,
Peter
From: Antoine De P. <and...@ul...> - 2008年09月26日 05:59:54
Jeff,
I totally agree this is due to missing values
Again I've got difficulties to find good words so forgive me, what I tried
to say is that the ability to have that border transparent would be a good
feature in next releases, for people who need to interpolate and plot such
data and have an aesthetic result
Imshow is the ideal candidate for satellite data as it has some nice
interpolation features and it is fast, so it can be batch-run on the server
every time we receive data, without too much computation time
The alternative I'm using now is a double or quadruple size grid to reduce
the width of that border, with background color set to the lower colormap
color
That way, the border is really hard to see and it makes (almost) quality
plots for publications
-----Original Message-----
From: Jeff Whitaker [mailto:js...@fa...] 
Sent: Thursday, 25 September, 2008 15:34
To: De Pauw Antoine
Cc: 'Matplotlib Users'
Subject: Re: [Matplotlib-users] Information request
De Pauw Antoine wrote:
> Jeff,
>
> Thanks for the tip, it's now working perfectly
>
> However, there's still that border with the imshow plot, and I think it
> would be good to have it transparent
>
> There's a zoomed picture I made:
> http://img218.imageshack.us/img218/5833/imshowborderxz9.png
>
> You see the shadow around the data...
>
> It would be nice for next releases of Matplotlib to get rid of that, but
I'm
> not able to patch it myself or so... I know there's still a lot of work
with
> the lib but keep the good work, it is really fantastic
>
> Thanks for your help!
>
> Antoine De Pauw
> Collaborateur de recherches, Informatique - Research collaborator, IT
> Laboratoire de chimie quantique et photophysique - Quantum chemistry and
> photophysics laboratory
> Université Libre de Bruxelles - ULB
> 
Antoine: I thought we agreed that it's not an imshow bug - but rather 
due to the griddata gridding procedure returning missing values outside 
the convex hull of the input data. Do you disagree? I see no such border 
around an imshow plot that contains no missing values. If you shrink the 
size of the map plotting region so it's fully within the convex hull of 
the data, the border disappears.
-Jeff
> -----Original Message-----
> From: Jeff Whitaker [mailto:js...@fa...] 
> Sent: jeudi 25 septembre 2008 14:15
> To: De Pauw Antoine
> Cc: 'Matplotlib Users'
> Subject: Re: [Matplotlib-users] Information request
>
> De Pauw Antoine wrote:
> 
>> Hi Jeff,
>>
>> I finally found out how to fill my figure with a background color using
>> axes.set_axis_bgcolor(color), but I'm facing the following problem now:
>>
>> How could I get the lower color of a colormap? This is quite undocumented
>> and I don’t know the colormap properties I could use for that
>>
>> I know there must be an accessible value somewhere, like for the
>> ax.get_yticklabels() you gave me
>>
>> If someone had the clue, my problems would then be completely solved
>>
>> Antoine De Pauw
>> Collaborateur de recherches, Informatique - Research collaborator, IT
>> Laboratoire de chimie quantique et photophysique - Quantum chemistry and
>> photophysics laboratory
>> Université Libre de Bruxelles - ULB
>> 
>> 
>
> Antoine: To get the RGBA value associated with a particular data value, 
> just call the colormap as a function as pass it that value. For example
>
> >>> import matplotlib.pyplot as plt
> >>> plt.cm.jet(1)
> (0.0, 0.0, 0.517825311942959, 1.0)
>
> BTW: the 'fill_color' kwarg of drawmapboundary basemap method allows you 
> to set the background color of the map.
>
> http://matplotlib.sourceforge.net/basemap/doc/html/api/basemap_api.html
>
> It fills only the map region (which for some projections, like the 
> orthographic, is not the same as the axes region).
>
>
> -Jeff
> 
>> -----Original Message-----
>> From: Jeff Whitaker [mailto:js...@fa...] 
>> Sent: mardi 23 septembre 2008 20:38
>> To: De Pauw Antoine
>> Cc: 'John Hunter'; 'Matplotlib Users'
>> Subject: Re: [Matplotlib-users] Information request
>>
>> De Pauw Antoine wrote:
>> 
>> 
>>> Jeff,
>>>
>>> I still don't know how to either remove this artifact or fill my arrays
>>> 
>>> 
>> with
>> 
>> 
>>> values to remove empty regions, and I'll make a last attempt to resolve
>>> 
> it
> 
>>> I uploaded a data file here: http://scqp.ulb.ac.be/20080821.b56
>>>
>>> The actual code snippet is here:
>>> http://snipplr.com/view/8307/map-plotting-python-code-temporary/
>>>
>>> I hope you'll be able to reproduce it, I set the cmap to winter for you
>>> 
> to
> 
>>> see the gap... setting it to hot will make the grayish border visible in
>>> high resolution by zooming it... I think the border (not the empty zone)
>>> could be an artifact with the hot colormap
>>>
>>>
>>> Antoine De Pauw
>>> Collaborateur de recherches, Informatique - Research collaborator, IT
>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry and
>>> photophysics laboratory
>>> Université Libre de Bruxelles - ULB
>>>
>>> 
>>> 
>>> 
>> Antoine: Here is a version that just plots the pixels directly, without 
>> interpolating to a grid. I personally like this better, since you can 
>> easily see where you actually have data.
>>
>> HTH,
>>
>> -Jeff
>>
>> from mpl_toolkits.basemap import Basemap
>> import matplotlib.pyplot as plt
>> import matplotlib.mlab as mlab
>> import numpy as np
>> import os
>> fileName = '20080821.b56'
>> titre='SO2'
>> legende='Delta Brightness Temperature (K)'
>> nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
>> rawfile=np.fromfile(open(fileName,'rb'),'<d',-1)
>> Lat=rawfile[0:nbreligne]
>> Lon=rawfile[nbreligne:nbreligne*2]
>> Val=rawfile[nbreligne*21:nbreligne*22]
>> map=Basemap(projection='mill',llcrnrlat=-90,urcrnrlat=90,\
>> urcrnrlon=180,llcrnrlon=-180,resolution='l')
>> x, y = map(Lon, Lat)
>>
>> 
>
plt.scatter(x,y,s=25,c=Val,marker='s',edgecolor="None",cmap=plt.cm.winter,vm
> 
>> in=-5,vmax=-1.2, 
>> alpha=0.5)
>> cb=plt.colorbar(shrink=0.6)
>> cb.ax.set_ylabel(legende,fontsize=11)
>> for t in cb.ax.get_yticklabels():
>> t.set_fontsize(7)
>> meridians = np.arange(-180,180,60)
>> parallels = np.arange(-90,90,30)
>> map.drawparallels(parallels,labels=[1,0,0,0],fontsize=7,linewidth=0.25)
>> map.drawmeridians(meridians,labels=[0,0,0,1],fontsize=7,linewidth=0.25)
>> map.drawcoastlines(0.25,antialiased=1)
>> plt.title(titre)
>> plt.show()
>> 
>> 
>>> -----Original Message-----
>>> From: Jeff Whitaker [mailto:js...@fa...] 
>>> Sent: lundi 22 septembre 2008 13:59
>>> To: De Pauw Antoine
>>> Cc: 'John Hunter'; 'Matplotlib Users'
>>> Subject: Re: [Matplotlib-users] Information request
>>>
>>> De Pauw Antoine wrote:
>>> 
>>> 
>>> 
>>>> Jeff,
>>>>
>>>> I included here a figure where you'll see the border problem for imshow
>>>> 
>>>> 
>> in
>> 
>> 
>>>> my case
>>>>
>>>> http://img217.imageshack.us/img217/5240/testfigzp3.png
>>>>
>>>> The border wraps at -180 and 180 to form the white line
>>>>
>>>> PS: it is atmospheric ice and not SO2, I just omitted to change the
>>>> 
> title
> 
>>>> 
>>>> 
>>>> 
>>> ^^
>>> 
>>> 
>>> 
>>>> Antoine De Pauw
>>>> Collaborateur de recherches, Informatique - Research collaborator, IT
>>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry
and
>>>> photophysics laboratory
>>>> Université Libre de Bruxelles - ULB
>>>> 
>>>> 
>>>> 
>>>> 
>>> Antoine: I hate to keep repeating myself - but we can't do much if you 
>>> don't provide a self-contained script, that I can run, which reproduces 
>>> the problem. My guess is that the line along the dateline, and the 
>>> point at the South Pole are missing values (which griddata set to 
>>> missing because they are outside the extent of the data) - but that's 
>>> just a guess until I can reproduce it.
>>>
>>> -Jeff
>>> 
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: Antoine De Pauw [mailto:and...@ul...] 
>>>> Sent: jeudi 18 septembre 2008 17:23
>>>> To: Jeff Whitaker; and...@ul...
>>>> Cc: 'John Hunter'; 'Matplotlib Users'
>>>> Subject: re:Re: [Matplotlib-users] Information request
>>>>
>>>> Jeff,
>>>>
>>>> No the example doesn't show that line
>>>>
>>>> If I reduce the amount of data, the border will be on every side of the
>>>> 
>>>> 
>>>> 
>>> plot
>>> 
>>> 
>>> 
>>>> I'll show you an orthographic plot with no maskinf tomorrow and you
will
>>>> 
>>>> 
>>>> 
>>> see
>>> 
>>> 
>>> 
>>>> the problem easily, it wraps in a white line along the 0° meridian and
a
>>>> white circle in the pole
>>>>
>>>> I think it's the imshow layer that is not totally transparent on the
map
>>>> background.. I tried every trick I could for example to put some
>>>> 
>>>> 
>>>> 
>>> zero-valued
>>> 
>>> 
>>> 
>>>> points on each corner to make imshow interpolate correctly the sides,
>>>> 
> but
> 
>>>> that doesn't make any difference
>>>>
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> De Pauw Antoine wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>> Jeff,
>>>>>>
>>>>>> Yes they disappear, and they fluctuate with the interpolation method
>>>>>> 
>>>>>> 
>>>>>> 
>>> used
>>> 
>>> 
>>> 
>>>>>> For example, nearest interpolation don't show the line
>>>>>>
>>>>>> Also, if I reduce the grid resolution, the line is thicker, and if I
>>>>>> 
>>>>>> 
>> use
>> 
>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>> a
>>>> 
>>>> 
>>>> 
>>>> 
>>>>>> masked array to get rid of undesired values, the border shows really
>>>>>> strongly
>>>>>>
>>>>>> Here's an example everyone will see:
>>>>>>
>>>>>> http://img225.imageshack.us/img225/2671/testfigep2.png
>>>>>>
>>>>>> (everything except the clouds is noise)
>>>>>>
>>>>>> Antoine De Pauw
>>>>>> Collaborateur de recherches, Informatique - Research collaborator, IT
>>>>>> Laboratoire de chimie quantique et photophysique - Quantum chemistry
>>>>>> 
>>>>>> 
>> and
>> 
>> 
>>>>>> photophysics laboratory
>>>>>> Université Libre de Bruxelles - ULB
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> Antoine: Sorry to seem dense, but I don't see anything wrong with
that
>>>>> 
>
> 
>>>>> plot. I see a white border along the north and south pole, but I 
>>>>> intrepret that to be missing values. However, my eyes are notoriously
>>>>> bad. I'd like to be to run a script that generates the artifacts 
>>>>> myself, so I can zoom in and see the problem myself. Does the 
>>>>> griddata_demo.py script show the same problem for you?
>>>>>
>>>>> -Jeff
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: Jeff Whitaker [mailto:js...@fa...] 
>>>>>> Sent: mercredi 17 septembre 2008 19:05
>>>>>> To: John Hunter
>>>>>> Cc: De Pauw Antoine; Matplotlib Users
>>>>>> Subject: Re: [Matplotlib-users] Information request
>>>>>>
>>>>>> John Hunter wrote:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Wed, Sep 17, 2008 at 11:54 AM, John Hunter <jd...@gm...>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>> wrote:
>>> 
>>> 
>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>> Attached is a screenshot (zoom.png) from the gimp, zoomed in near
>>>>>>>> 
> the
> 
>>>>>>>> axes border. The black horizontal line is the top axes border, the
>>>>>>>> horizontal grey line is the artifact, the vertical dashed line is a
>>>>>>>> grid line. I don't know if this offers a clue, but if you look at
a
>>>>>>>> zoom in the upper right corner, the grey line seems to break up
and
>>>>>>>> curve down and to the right (corner.png)
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> Sorry, screwed up corner.png (I attached the original and not the
>>>>>>> screenshot). The correct screenshot is attached
>>>>>>> 
>>>>>>>
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> John: OK, now I finally see it. Antoine: Do these artifacts 
>>>>>> disappear if you comment out the imshow call?
>>>>>>
>>>>>> -Jeff
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> -- 
>>>>> Jeffrey S. Whitaker Phone : (303)497-6313
>>>>> Meteorologist FAX : (303)497-6449
>>>>> NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
>>>>> 325 Broadway Office : Skaggs Research Cntr 1D-113
>>>>> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>>>>>
>>>>>
>>>>>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
>
>
> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: <lea...@my...> - 2008年09月26日 02:31:32
Hello,<br /><br />I've started to use matplotlib for my website since
about a month ago and so far I am very impressed with it. I have one
question about bar plots using the axes.bar() function. It seems that
sometimes when I specify a constant width (by supplying a scalar width
argument), I get slightly uneven bar widths. Moreover, dending on the
width I specify and the limits of the x-axis, some bars get dropped
altogether. I am using the savefig() function to save the plots as a PNG
file. An example of uneven bar widths can be seen here:
http://www.myquant.net <br /><br />I would appreciate it if anyone has
encountered this problem before and if there is a fix for it. Thank
you.<br /><br />Roy<br /><br />
From: Robert K. <rob...@gm...> - 2008年09月26日 01:01:07
John [H2O] wrote:
> I wonder if I've misunderstood or made a mistake? I renamed a file:
> /usr/lib/python2.5/new.py to /usr/lib/python2.5/new.bak
> 
> and everything worked... but now, after logging out and logging back in
> again, I'm getting the problem again?
> 
> Perhaps that was the standard libraries module? But I cannot find any other
> new.py files?
/usr/lib/python2.5/new.py is the standard library's module. Leave it alone. If 
you are still having problems and cannot find another new.py module anywhere, 
edit pkg_resources.py to print out new.__file__ just before where the exception 
occurs.
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
1 message has been excluded from this view by a project administrator.

Showing 10 results of 10

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