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

1 2 > >> (Page 1 of 2)
From: John [H2O] <was...@gm...> - 2008年09月25日 22:52:01
I'm revisiting this with a new round of errors. I keep getting this error,
maybe related as before to the 'new' module, but I cannot tell?? Does anyone
know what is going on?
Python 2.5.1 (r251:54863, Jun 15 2008, 18:24:51)
[GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/lib/python2.5/site-packages/pylab.py", line 1, in <module>
 from matplotlib.pylab import *
 File "/usr/lib/python2.5/site-packages/matplotlib/__init__.py", line 128,
in <module>
 from rcsetup import defaultParams, validate_backend, validate_toolbar
 File "/usr/lib/python2.5/site-packages/matplotlib/rcsetup.py", line 19, in
<module>
 from matplotlib.colors import is_color_like
 File "/usr/lib/python2.5/site-packages/matplotlib/colors.py", line 39, in
<module>
 import matplotlib.cbook as cbook
 File "/usr/lib/python2.5/site-packages/matplotlib/cbook.py", line 16, in
<module>
 preferredencoding = locale.getpreferredencoding()
 File "/usr/lib/python2.5/locale.py", line 512, in getpreferredencoding
 setlocale(LC_CTYPE, "")
 File "/usr/lib/python2.5/locale.py", line 476, in setlocale
 return _setlocale(category, locale)
locale.Error: unsupported locale setting
-- 
View this message in context: http://www.nabble.com/scipy%2C-matplotlib-import-errors-tp16343711p19679786.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John [H2O] <was...@gm...> - 2008年09月25日 22:34:05
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?
Thanks,
john
Robert Kern-2 wrote:
> 
> John wrote:
>> Hello, could someone please help me understand a strange problem, 
>> possibly associated with PYTHONPATH. When I import matplotlib, pylab, or 
>> scipy from any directory other than the root installation directory, it 
>> fails. However, if I'm in the python installation directory there are no 
>> errors. Thanks in advance! Please see below:
>> 
>> *[jfb@andLinux ~]$ python*
>> Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
>> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import scipy
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/usr/lib/python2.5/site-packages/scipy/__init__.py", line 18, in 
>> <module>
>> import pkg_resources as _pr # activate namespace packages 
>> (manipulates __path__)
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, 
>> in <module>
>> add_activation_listener(lambda dist: dist.activate())
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 640, in 
>> subscribe
>> callback(dist)
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, 
>> in <lambda>
>> add_activation_listener(lambda dist: dist.activate())
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2130, 
>> in activate
>> map(declare_namespace, self._get_metadata('namespace_packages.txt'))
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1749, 
>> in declare_namespace
>> _handle_ns(packageName, path_item)
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1712, 
>> in _handle_ns
>> module = sys.modules[packageName] = new.module(packageName)
>> AttributeError: 'module' object has no attribute 'module'
> 
> You have a new.py module somewhere which is interfering with the standard 
> library's "new" module. Find it and rename it.
> 
> -- 
> 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
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/scipy%2C-matplotlib-import-errors-tp16343711p19679575.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John [H2O] <was...@gm...> - 2008年09月25日 21:27:21
Thank you!
I see this is a deprecated module, might I break something else?
Thanks again,
john
Robert Kern-2 wrote:
> 
> John wrote:
>> Hello, could someone please help me understand a strange problem, 
>> possibly associated with PYTHONPATH. When I import matplotlib, pylab, or 
>> scipy from any directory other than the root installation directory, it 
>> fails. However, if I'm in the python installation directory there are no 
>> errors. Thanks in advance! Please see below:
>> 
>> *[jfb@andLinux ~]$ python*
>> Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
>> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import scipy
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/usr/lib/python2.5/site-packages/scipy/__init__.py", line 18, in 
>> <module>
>> import pkg_resources as _pr # activate namespace packages 
>> (manipulates __path__)
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, 
>> in <module>
>> add_activation_listener(lambda dist: dist.activate())
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 640, in 
>> subscribe
>> callback(dist)
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, 
>> in <lambda>
>> add_activation_listener(lambda dist: dist.activate())
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2130, 
>> in activate
>> map(declare_namespace, self._get_metadata('namespace_packages.txt'))
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1749, 
>> in declare_namespace
>> _handle_ns(packageName, path_item)
>> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1712, 
>> in _handle_ns
>> module = sys.modules[packageName] = new.module(packageName)
>> AttributeError: 'module' object has no attribute 'module'
> 
> You have a new.py module somewhere which is interfering with the standard 
> library's "new" module. Find it and rename it.
> 
> -- 
> 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
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/scipy%2C-matplotlib-import-errors-tp16343711p19678674.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Oz N. <na...@gm...> - 2008年09月25日 20:20:03
>¿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]],
 ]
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
 ]
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.
Thanks for your help so far.
Oz
From: Goyo <goy...@gm...> - 2008年09月25日 19:50:56
Just give a look at zip(*head) and see that now it return two values so
you can't assign it to three variables.
¿What's the meaning of that data arrange? I can't make any sense of
plotting a 2D scatter from a 3D array.
Goyo
El jue, 25-09-2008 a las 15:15 +0200, Oz Nahum escribió:
> Hi, 
> Thanks for your reply and appologies for my late response. 
> This indeed does the job. But after playing a little bit with the
> code, I have discovered a few things:
> first, I'd rather work with lists not tuples so I could actually
> change my huge array of points. 
> second the array I described is kind of a pseudo 2D:
> It has one big row. 
> head = [[0, 0, 10],
> [1, 0, 13],
> [2, 0, 11],
> [3, 0, 12],
> [1, 2, 11]]
> 
> When I try to use a 3D array, with rows and columns 
> 
> import pylab as pl
> 
> head = [[[0, 0, 10], [0, 1, 13]],
> [[1, 0, 11], [1, 1, 12]],
> [[2, 1, 11], [2, 2, 14]]]
> 
> x, y, z = zip(*head)
> xi, yi = pl.arange(0, 4, 0.1), pl.arange(0, 3, 0.1)
> g = pl.griddata(x, y, z, xi, yi)
> pl.scatter(x, y)
> pl.contour(xi, yi, g)
> pl.show()
> 
> I get this error:
> Traceback (most recent call last):
> File "asfplot.py", line 9, in <module>
> x, y, z = zip(*head)
> ValueError: need more than 2 values to unpack
> 
> 
> On Sat, Sep 20, 2008 at 2:19 PM, Goyo <goy...@gm...> wrote:
> Try something like this:
> 
> import pylab as pl
> 
> head = ((0, 0, 10),
> (1, 0, 13),
> (2, 0, 11),
> (3, 0, 12),
> (1, 2, 11))
> 
> 
> x, y, z = zip(*head)
> xi, yi = pl.arange(0, 4, 0.1), pl.arange(0, 3, 0.1)
> g = pl.griddata(x, y, z, xi, yi)
> pl.scatter(x, y)
> pl.contour(xi, yi, g)
> 
> Level values are automatically chosen in this example but you
> can
> provide the number of values or a sequence of them.
> 
> Note that no extrapolation is done outside convex hull defined
> by input
> data.
> 
> Goyo
> 
> El sáb, 20-09-2008 a las 11:13 +0200, Oz Nahum escribió:
> 
> > I'm trying again to understand how to plot scattered data
> from array into
> > contour graph.
> > I looked at
> >
> http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
> > and I understand I have to grid my data. However, in most
> samples the plot
> > is of a function.
> > Let's say I want to plot some geological data, suppose
> water table head, and
> > I have the following 3D aray
> > x y head
> > head = ((0, 0, 10),
> > (1, 0, 13),
> > (2, 0, 11),
> > (3, 0, 12),
> > (1, 2, 11))
> > matplotlib has lot's of restrictions about how I can plot
> and interpolate
> > the data, which causes a lot of confusion in my side...
> > I'll be happy if someone could supply me a clue of how to
> plot contours of
> > data which comes in arrays or raster format and not an
> equation.
> > Thanks,
> > Oz
> >
> 
> >
> -------------------------------------------------------------------------
> > 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
> 
> 
> 
> 
> -- 
> .''`.
> : :' : We are debian.org. Lower your prices, 
> `. `' surrender your code.
> `- We will add your hardware and software 
> distinctiveness to our own. 
> Resistance is futile.
> 
> ----
> 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 
> ----
> You all must read 'The God Delusion' 
> http://en.wikipedia.org/wiki/The_God_Delusion
> ---
> when one person suffers from a delusion it is called insanity. When
> many people suffer from a delusion it is called religion."
> Robert Pirsig, Zen and the Art of Motorcycle Maintenance
> 
> 
From: Eric F. <ef...@ha...> - 2008年09月25日 18:05:44
Christopher Brown wrote:
> Hi List,
> 
> Attached is a closeup of two legends on a 2-panel figure. The first
> legend has 10 plots listed, the second has 1. I have set each legend
> identically: loc='upper right', pad=.3, handlelen=.1, handletextsep=.05.
> But it seems that while the horizontal padding is the same, the vertical
> padding is too large in the first legend, and too small in the second.
> The only difference between the two I am aware of is the number of plots
> listed (not contained in the axes, but listed in the legends). I'm using 
> version 0.98.3 on windows. Any ideas?
This looks to me like a design flaw: the pad is "fractional" (fraction 
of legend box size), when logically it should be in something like units 
of legend text height, or possibly in points. This might be easy enough 
to change, although for backwards compatibility we would need to use a 
new kwarg.
Eric
From: Jouni K. S. <jk...@ik...> - 2008年09月25日 18:05:12
"John Hunter" <jd...@gm...> writes:
> When I run your script with 91.5 (svn branch) vs 98.3 (svn head), I
> see that the text labels do not align with the images (PDF only, not
> Agg) in 98.3 and not 91.5. Is this the problem you are describing?
It's not exactly alignment, it's that the image (consisting of all the
little color bars) is upside down. The part of the pdf backend that
writes out the images hasn't changed very much between 0.91 and 0.98:
both essentially do
 img.flipud_out()
 # get rgba data of image and write it in the output file
 img.flipud_out()
If I comment out the flipud_out method calls in 0.98, it works correctly
with this example but gets image_origin.pdf wrong. I'm at a loss to
figure out the difference between image_origin.py and Haibao Tang's
script. Does anyone have a clue?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: <ziw...@ni...> - 2008年09月25日 15:50:30
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.
Your sincerity,
Ziwen Fu
From: Haibao T. <tan...@gm...> - 2008年09月25日 14:05:21
John, thanks for the swift reply.
1) Yes. I later found that whenever I call imshow with extent option more
than once, the coordinates will be off.
2) Here is a sample script
-----------------------------------------
from pylab import *
img = imread("image.png")
imshow(img)
axis("off")
savefig("image.pdf")
-----------------------------------------
Just try any png off the web and generate pdf using 0.91 and 0.98. Look
closely at the results. There are two major differences. One is that the
pixel is larger in 0.98 than in 0.91; also the color looks lossy in 0.98. I
suspect that there is more compression for pdf in 0.98, but I am not clear
how to reset it.
On Thu, Sep 25, 2008 at 9:37 AM, John Hunter <jd...@gm...> wrote:
> On Wed, Sep 24, 2008 at 2:16 PM, Haibao Tang <tan...@gm...> wrote:
>
> > for k in cm_keys:
> > imshow(Y, extent=(xstart, xstart+.7*col_interval,
> > ystart, ystart+.5*row_interval),
> > cmap=get_cmap(name=k))
> > root.text(xstart+.75*col_interval, ystart, k, size=9)
> > xstart += col_interval
> > if j%2==0:
> > xstart = .03
> > ystart -= row_interval
> > j += 1
> >
> > root.set_xlim(0, 1)
> > root.set_ylim(0, 1)
> > root.set_axis_off()
> > savefig("cm_instances.pdf")
>
> > Different versions gave me different results, with only the old version
> > appears to be correct.
>
> When I run your script with 91.5 (svn branch) vs 98.3 (svn head), I
> see that the text labels do not align with the images (PDF only, not
> Agg) in 98.3 and not 91.5. Is this the problem you are describing?
>
> It appears that the image positioning argument is off in the PDF
> backend because comparing the trunk vs the head, the labels are in the
> same relative position and the images are off. Could one of the PDF
> backend gurus look into this?
>
> > In addition, when I wish to imshow a JPG image through PIL, the newer
> > version gave me very low resolution. Can someone duplicate my
> observation? I
> > appreciate any solution, thanks.
>
> I am not sure what you are trying here -- can you post a script that
> illustrates the problem?
>
From: Jeff W. <js...@fa...> - 2008年09月25日 13:50:16
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: John H. <jd...@gm...> - 2008年09月25日 13:37:35
On Wed, Sep 24, 2008 at 2:16 PM, Haibao Tang <tan...@gm...> wrote:
> for k in cm_keys:
> imshow(Y, extent=(xstart, xstart+.7*col_interval,
> ystart, ystart+.5*row_interval),
> cmap=get_cmap(name=k))
> root.text(xstart+.75*col_interval, ystart, k, size=9)
> xstart += col_interval
> if j%2==0:
> xstart = .03
> ystart -= row_interval
> j += 1
>
> root.set_xlim(0, 1)
> root.set_ylim(0, 1)
> root.set_axis_off()
> savefig("cm_instances.pdf")
> Different versions gave me different results, with only the old version
> appears to be correct.
When I run your script with 91.5 (svn branch) vs 98.3 (svn head), I
see that the text labels do not align with the images (PDF only, not
Agg) in 98.3 and not 91.5. Is this the problem you are describing?
It appears that the image positioning argument is off in the PDF
backend because comparing the trunk vs the head, the labels are in the
same relative position and the images are off. Could one of the PDF
backend gurus look into this?
> In addition, when I wish to imshow a JPG image through PIL, the newer
> version gave me very low resolution. Can someone duplicate my observation? I
> appreciate any solution, thanks.
I am not sure what you are trying here -- can you post a script that
illustrates the problem?
From: Jeff W. <js...@fa...> - 2008年09月25日 13:30:31
Paul Langevin wrote:
> Hi,
>
> I'm wondering if it is 
Paul: No, it's not.
> (or when will it be if not) possible to specify the desired boundary 
> for the triangulated meshes in order to design holes which seems 
> impossible at the moment (the boundary seems to always be the convex 
> hull of the set of points when using delaunay.Triangulation(x,y) ).
>
> Thanks.
The delaunay package is an external package (from scipy) that is 
included in matplotlib for convenience. It's not maintained by the 
matplotlib developers. I'd ask on the scipy list.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: De P. A. <and...@ul...> - 2008年09月25日 13:27:28
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
-----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: Oz N. <na...@gm...> - 2008年09月25日 13:15:56
Hi,
Thanks for your reply and appologies for my late response.
This indeed does the job. But after playing a little bit with the code, I
have discovered a few things:
first, I'd rather work with lists not tuples so I could actually change my
huge array of points.
second the array I described is kind of a pseudo 2D:
It has one big row.
head = [[0, 0, 10],
 [1, 0, 13],
 [2, 0, 11],
 [3, 0, 12],
 [1, 2, 11]]
When I try to use a 3D array, with rows and columns
import pylab as pl
head = [[[0, 0, 10], [0, 1, 13]],
 [[1, 0, 11], [1, 1, 12]],
 [[2, 1, 11], [2, 2, 14]]]
x, y, z = zip(*head)
xi, yi = pl.arange(0, 4, 0.1), pl.arange(0, 3, 0.1)
g = pl.griddata(x, y, z, xi, yi)
pl.scatter(x, y)
pl.contour(xi, yi, g)
pl.show()
I get this error:
Traceback (most recent call last):
 File "asfplot.py", line 9, in <module>
 x, y, z = zip(*head)
ValueError: need more than 2 values to unpack
On Sat, Sep 20, 2008 at 2:19 PM, Goyo <goy...@gm...> wrote:
> Try something like this:
>
> import pylab as pl
>
> head = ((0, 0, 10),
> (1, 0, 13),
> (2, 0, 11),
> (3, 0, 12),
> (1, 2, 11))
>
> x, y, z = zip(*head)
> xi, yi = pl.arange(0, 4, 0.1), pl.arange(0, 3, 0.1)
> g = pl.griddata(x, y, z, xi, yi)
> pl.scatter(x, y)
> pl.contour(xi, yi, g)
>
> Level values are automatically chosen in this example but you can
> provide the number of values or a sequence of them.
>
> Note that no extrapolation is done outside convex hull defined by input
> data.
>
> Goyo
>
> El sáb, 20-09-2008 a las 11:13 +0200, Oz Nahum escribió:
> > I'm trying again to understand how to plot scattered data from array into
> > contour graph.
> > I looked at
> >
> http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
> > and I understand I have to grid my data. However, in most samples the
> plot
> > is of a function.
> > Let's say I want to plot some geological data, suppose water table
> head, and
> > I have the following 3D aray
> > x y head
> > head = ((0, 0, 10),
> > (1, 0, 13),
> > (2, 0, 11),
> > (3, 0, 12),
> > (1, 2, 11))
> > matplotlib has lot's of restrictions about how I can plot and
> interpolate
> > the data, which causes a lot of confusion in my side...
> > I'll be happy if someone could supply me a clue of how to plot
> contours of
> > data which comes in arrays or raster format and not an equation.
> > Thanks,
> > Oz
> >
> > -------------------------------------------------------------------------
> > 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
>
>
-- 
.''`.
: :' : We are debian.org. Lower your prices,
`. `' surrender your code.
`- We will add your hardware and software
distinctiveness to our own.
Resistance is futile.
----
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
----
You all must read 'The God Delusion'
http://en.wikipedia.org/wiki/The_God_Delusion
---
when one person suffers from a delusion it is called insanity. When many
people suffer from a delusion it is called religion."
Robert Pirsig, Zen and the Art of Motorcycle Maintenance
From: John H. <jd...@gm...> - 2008年09月25日 13:11:29
On Wed, Sep 24, 2008 at 9:35 PM, Dennis Newbold <den...@gm...> wrote:
> Hi all,
>
> The "Installing" page on the matplotlib website says: "You
> probably don't need to compile matplotlib unless you want to or work
> on an obscure platform. There are binary builds for Windows, OS X and
> many major linux distributions; see below".
>
> When I scrol below, under "Linux", I see
> "To build all the backends on a binary linux distro such as redhat,
> you need to install a number of the devel libs (and whatever
> dependencies they require), I suggest
> matplotlib core: zlib, zlib-devel, libpng, libpng-devel, freetype,
> freetype-devel, freetype-utils
> gtk/gtkagg backend: gtk2-devel, gtk+-devel, pygtk2, glib-devel,
> pygtk2-devel, gnome-libs-devel, pygtk2-libglade
> tk backend: tcl, tk, tkinter
> wx/wxagg backends - the wxpython rpms from wxpython"
These instructions were written a long time ago, before matplotlib was
shipped with most linux distributions, and are for people who want to
compile matplotlib from source. They need to be updated.
> This doesn't tell me where to find a matplotlib rpm file, just a list
> of the other stuff that I need to make sure my redhat system already
> has (btw, I thought that was what a good rpm is supposed to do
> anyway?)
It's sually called python2.5-matplotlib or something like that.
JDH
From: John H. <jd...@gm...> - 2008年09月25日 13:08:47
On Thu, Sep 25, 2008 at 6:34 AM, Peter Saffrey <pz...@dc...> wrote:
> For me, the code below draws the top plot only half on the page. Can
> anybody help me out?
>
>
>
> from pylab import *
>
> groups = [ [ 'A', 'B', 'C', 'D', 'E' ],
> [ 'F', 'G', 'H', 'I' ],
> [ 'M', 'N', 'O', 'P', 'Q' ] ]
>
> f = figure(1)
> for i in range(len(groups)):
> group = groups[i]
> subplot(len(groups), 1, i)
> for treatment in group:
> plot(linspace(0, 1, 32), rand(32))
>
> show()
subplot indexing starts at 1 and not zero, which is a matlab
compatibility feature, so perhaps
 subplot(len(groups), 1, i+1)
does what you want
JDH
From: John H. <jd...@gm...> - 2008年09月25日 13:06:48
On Thu, Sep 25, 2008 at 7:15 AM, Jeff Whitaker <js...@fa...> wrote:
> 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
You can get the lowest color of a colormap by evaluating it at zero, eg
In [1]: import matplotlib.cm as cm
In [2]: cm.jet(0)
Out[2]: (0.0, 0.0, 0.5, 1.0)
From: John H. <jd...@gm...> - 2008年09月25日 13:03:20
On Sat, Feb 9, 2008 at 11:05 AM, Jon Loehrke <jlo...@um...> wrote:
> Sorry to bother everyone with this post.
>
> I am new to matplotlib and python in general and am finding a problem that I
> don't understand.
>
> I've downloaded the scipy superpack (through easy_install) from C.
> Fonnesbeck (http://trichech.us) and receive and error when plotting (example
> below).
>
> Personally I do not know enough to diagnose it nor fix the problem. what is
> _wx.py relate to? How am I getting C++ assertion failures, shouldn't this
> go through gcc?
GUI packages like wx cannot be run from the standard python shell, as
you are trying to do in using the ex backend of matplotlib, because of
threading issues. See
 http://matplotlib.sourceforge.net/interactive.html
 http://matplotlib.sourceforge.net/faq.html#SHOW
 http://matplotlib.sourceforge.net/doc/html/faq/installing_faq.html#id1
Short answer: when working interactively from the python shell, either
use tkagg as your backend or ipython in pylab mode
 > ipython -pylab
JDH
From: Peter S. <pz...@dc...> - 2008年09月25日 12:27:51
For me, the code below draws the top plot only half on the page. Can 
anybody help me out?
from pylab import *
groups = [	[ 'A', 'B', 'C', 'D', 'E' ],
		[ 'F', 'G', 'H', 'I' ],
		[ 'M', 'N', 'O', 'P', 'Q' ] ]
f = figure(1)
for i in range(len(groups)):
	group = groups[i]
	subplot(len(groups), 1, i)
	for treatment in group:
		plot(linspace(0, 1, 32), rand(32))
show()
Thanks,
Peter
From: Hiro T. <hi...@as...> - 2008年09月25日 12:27:29
Hi,
 
I am trying to change my plots using another tk window I made, but it does
not work well.
I am wondering if someone could help me.
 
Here is an example to try to change the X axis of the plot using scale bars
on another
Tk window. But once I run the program, the figure window for matplotlib gets
darker several
second later, and I cannot use pan/zoom buttons etc.
 
--
#!/usr/bin/python
 
from pylab import *
from Tkinter import *
 
class TkWindow(Frame):
 def init(self):
 self.vmin= IntVar()
 self.vmax= IntVar()
 self.vmin.set(0)
 self.vmax.set(10)
 
 l2=Frame(self)
 scale_vmin=Scale(l2,label='x(min)',variable=self.vmin,
 to=20,from_=-20,length=200,tickinterval=10,
 orient=HORIZONTAL)
 scale_vmax=Scale(l2,label='x(max)',variable=self.vmax,
 to=20,from_=-20,length=200,tickinterval=10,
 orient=HORIZONTAL)
 scale_vmin.pack(side=LEFT,padx=5)
 scale_vmax.pack(side=LEFT,padx=5)
 scale_vmin.config(command=self.exec_scales)
 scale_vmax.config(command=self.exec_scales)
 l2.pack(fill=X)
 
 def exec_scales(self,event):
 vmin=self.vmin.get()
 vmax=self.vmax.get()
 ax.set_xlim(vmin,vmax)
 draw()
 
 def __init__(self,ax,master=None):
 self.ax=ax
 
 Frame.__init__(self,master)
 self.init()
 self.pack()
 
### Begin ###
 
ax=subplot(111)
plot(arange(0,10))
tkw=TkWindow(ax)
 
show()
tkw.mainloop()
 
---
 
Thanks a lot for your attention!!
 
Hiro
 
From: Paul L. <kkw...@ho...> - 2008年09月25日 12:17:41
Hi,
I'm wondering if it is (or when will it be if not) possible to specify the desired boundary for the triangulated meshes in order to design holes which seems impossible at the moment (the boundary seems to always be the convex hull of the set of points when using delaunay.Triangulation(x,y) ).
Thanks.
_________________________________________________________________
Installez gratuitement les 20 émôticones Windows Live Messenger les plus fous ! Cliquez ici !
http://www.emoticones-messenger.fr/ 
From: Jeff W. <js...@fa...> - 2008年09月25日 12:15:32
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: De P. A. <and...@ul...> - 2008年09月25日 12:00:07
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
-----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
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
From: Ali_baba <suh...@ya...> - 2008年09月25日 09:02:54
Hallo new user, 
Furthermore, imagine that a large amount of data is being received over a
slow connection. Socket 1
has no data in the read buffer, so it calls wxYield. There is still a
pending event
on Socket 2, so wxWidgets attempts to process that event. However, that
event
cannot complete, and it also calls wxYield. This will cause the infamous
"wxYield called recursively" message to appear. Eventually the stack would
fill
up with recursive calls to wxYield as long as all the data has not yet
arrived
and the call stack cannot unwind. Many users immediately assume that this
error message indicates a flaw in wxWidgets, when the truth is that it
represents
a problem in the application code. Simply stated, applications should be
programmed so that this situation does not occur; the error is present to
reveal a problem in the application code so that it can be fixed.
Please complete one event completely before calling the other event
-- 
View this message in context: http://www.nabble.com/new_user-matplotlib-help-tp15373200p19665311.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: greg7201 <gre...@ya...> - 2008年09月25日 02:36:05
That does the trick. I assumed that swaping the plot parameters would cause
other problems, but it doesn't.
That was simple!
Thanks!
Starting with the obvious -- x and y are arbitrary, so instead of
 plot (x, y)
you can
 plot(y, x)
If you need the data to be descending (smaller values on top, larger
values on bottom) you can invert the normal ordering with
 ylim(big_value, small_value)
If neither of these is what you are looking for, please elaborate a bit.
JDH
-------------------------------------------------------------------------
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
-- 
View this message in context: http://www.nabble.com/Newbie-question---rotated-XY-chart-tp19661397p19662093.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Showing results of 28

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