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





Showing 12 results of 12

From: William C. <wcc...@lb...> - 2009年11月02日 22:30:27
Hello Mitra,
If you haven't solved your problem yet, I would highly recommend cleaning up
previous versions and using the make.osx file supplied with the matplotlib
download. Edit the PREFIX to replace the example target directory with your
own target directory.
Make sure the MACOSX_DEPLOYMENT_TARGET and the MacOSX versions in the CFLAGS
and LDFLAGS are all set to the version you are using, presumably 10.4.
The make.osx script will check all the required dependencies and go get the
ones it needs for you.
I had a lot of trouble installing matplotlib on 10.6 until I followed this
procedure.
Good luck,
Bill
On 11/2/09 12:11 PM, "R. Mitra" <rm...@uc...> wrote:
> Hello Again
> Since I got no replies for my last question and figuring that it
> must be a problem with numpy (as Eric pointed out) I now have running
> python 2.6.4 and numpy 1.3.0 on OSX 10.4.11. Is there a need to
> uninstall previous matplotlib and reinstall it again? This page
> sounds pretty complicated for me: http://matplotlib.sourceforge.net/
> users/installing.html#build-osx?
> 
> There are multiple versions still existing on my computer. How can I
> clean up and install the latest version? Thank you all so much
> 
> Mitra
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Pierre de B. <pd...@ul...> - 2009年11月02日 21:34:08
 From memory, you just need to make a length one list
contour(z, [i])
Pierre
Le 2 nov. 09 à 22:19, Brendan Arnold a écrit :
> Hi there,
>
> I can draw a single contour line in MATLAB using
>
> contour(z, [i i])
>
> however,
>
> contour(z, [i, i])
>
> using matplotlib gives an error. In fact any plot that plots a single
> line (i.e. contour(z, 1)) also gives an error as follows,
>
> TypeError: unhashable type: 'numpy.ndarray'
>
> How do I draw a single contour line using matplotlib?
>
> regards,
>
> Brendan
>
> ---------------------------------------------------------------------- 
> --------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart 
> your
> developing skills, take BlackBerry mobile applications to market 
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John H. <jd...@gm...> - 2009年11月02日 21:28:10
On Mon, Nov 2, 2009 at 3:19 PM, Brendan Arnold <bre...@gm...> wrote:
> Hi there,
>
> I can draw a single contour line in MATLAB using
>
> contour(z, [i i])
>
> however,
>
> contour(z, [i, i])
>
> using matplotlib gives an error. In fact any plot that plots a single
> line (i.e. contour(z, 1)) also gives an error as follows,
>
> TypeError: unhashable type: 'numpy.ndarray'
>
> How do I draw a single contour line using matplotlib?
I've used:
 ax.contour(R, F, dR, levels=[0])
From: Brendan A. <bre...@gm...> - 2009年11月02日 21:19:46
Hi there,
I can draw a single contour line in MATLAB using
contour(z, [i i])
however,
contour(z, [i, i])
using matplotlib gives an error. In fact any plot that plots a single
line (i.e. contour(z, 1)) also gives an error as follows,
TypeError: unhashable type: 'numpy.ndarray'
How do I draw a single contour line using matplotlib?
regards,
Brendan
From: Pierre de B. <pd...@ul...> - 2009年11月02日 20:43:05
Hello,
> There are multiple versions still existing on my computer. How can I
> clean up and install the latest version? Thank you all so much
You need to check the different paths accessed by Python.
 >>> import sys
 >>> print sys.path
and remove the possible matplotib files in these paths. Typically, 
this includes /usr/lib/python2.6/site-packages, /usr/local/lib/..., / 
opt/lib/..., /sw/lib/... (on mac)
Then, download the .tar.gz file from matplotlib website, uncompress 
and in the folder run
$ python setup.py build
That command will check dependencies before building, indicating what 
is needed.
If some dependencies are not met, I suggest to use a package manager 
to install them. I use Fink on OS 10.4.11 with no problem, but I am 
still at Python 2.5 running matplotlib 1.0.svn .
Pierre
Le 2 nov. 09 à 20:11, R. Mitra a écrit :
> Hello Again
> Since I got no replies for my last question and figuring that it
> must be a problem with numpy (as Eric pointed out) I now have running
> python 2.6.4 and numpy 1.3.0 on OSX 10.4.11. Is there a need to
> uninstall previous matplotlib and reinstall it again? This page
> sounds pretty complicated for me: http://matplotlib.sourceforge.net/
> users/installing.html#build-osx?
> Mitra
>
> ---------------------------------------------------------------------- 
> --------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart 
> your
> developing skills, take BlackBerry mobile applications to market 
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: R. M. <rm...@uc...> - 2009年11月02日 19:16:34
Hello Again
 Since I got no replies for my last question and figuring that it 
must be a problem with numpy (as Eric pointed out) I now have running 
python 2.6.4 and numpy 1.3.0 on OSX 10.4.11. Is there a need to 
uninstall previous matplotlib and reinstall it again? This page 
sounds pretty complicated for me: http://matplotlib.sourceforge.net/ 
users/installing.html#build-osx?
There are multiple versions still existing on my computer. How can I 
clean up and install the latest version? Thank you all so much
Mitra
From: Eric F. <ef...@ha...> - 2009年11月02日 17:56:11
R. Mitra wrote:
> Hello All
> Thanks a lot Eric. I think I have some module missing but I cannot 
> figure out what it is. I get the following. Any idea. This started 
> hapening after I reinstalled matplotlib.
This is a numpy installation or version problem--notice that at the 
bottom of the traceback it is something from numpy that is not being 
found. Installation of numpy and mpl on OSX seems to be subject to all 
sorts of complications, and I don't use OSX, so I will have to leave 
this for someone else on the list.
Eric
> 
> File "/Users/Kennel/Pythoncodes/coolingmodel.py", line 6, in <module>
> import matplotlib
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/__init__.py", 
> line 129, in <module>
> from rcsetup import defaultParams, validate_backend, validate_toolbar
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/rcsetup.py", 
> line 19, in <module>
> from matplotlib.colors import is_color_like
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/colors.py", 
> line 54, in <module>
> import matplotlib.cbook as cbook
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/cbook.py", 
> line 10, in <module>
> import numpy.ma as ma
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/__init__.py", 
> line 47, in <module>
> import extras
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/extras.py", 
> line 45, in <module>
> from numpy.lib.index_tricks import AxisConcatenator
> ImportError: cannot import name AxisConcatenator
> 
> 
> The first few lines of my codes are:
> 
> from math import *
> import exceptions
> import pmag
> import matplotlib
> matplotlib.use("TkAgg")
> import numpy as np
> import matplotlib.pyplot as plt
> 
> Thanks a lot for all your help.
> 
> Mitra
> 
> 
> On Nov 1, 2009, at 11:32 PM, Eric Firing wrote:
> 
>> R. Mitra wrote:
>>> Hi Eric
>>> from math import *
>>> import matplotlib
>>> matplotlib.use("TkAgg")
>>> from pylab import *
>>> This is very basic I know. The above are the modules I am using. Is 
>>> plt a separate module? Thanks.
>>
>> With your method above, you don't need the "plt." part. "from pylab 
>> import *" is discouraged, however, except for quick interactive use. 
>> For scripts, it is generally considered better practice to use
>>
>> import matplotlib
>> matplotlib.use("tkagg")
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> pyplot is the plot-related part of the pylab namespace; or to put it 
>> another way, pylab is pyplot plus numpy.
>>
>> See http://matplotlib.sourceforge.net/faq/usage_faq.html
>>
>> Eric
>>
>>
>>
>>> RM
>>> On Nov 1, 2009, at 7:26 PM, Eric Firing wrote:
>>>> R. Mitra wrote:
>>>>> Hi
>>>>> I am having problems with contourf(). Suppose I have two 10X30 
>>>>> arrays X,Y and a corresponding Z value array. How do I make the 
>>>>> upper left to be the origin? I cannot use contour 
>>>>> (Z,origin='upper') because the axis values gets messed up.
>>>>
>>>> It sounds like maybe you want to reverse the y-axis. Try something 
>>>> like plt.gca().invert_yaxis() after your call to contourf.
>>>>
>>>> Eric
>>
> 
From: R. M. <rm...@uc...> - 2009年11月02日 17:48:25
Hello All
 Thanks a lot Eric. I think I have some module missing but I 
cannot figure out what it is. I get the following. Any idea. This 
started hapening after I reinstalled matplotlib.
 File "/Users/Kennel/Pythoncodes/coolingmodel.py", line 6, in <module>
 import matplotlib
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/__init__.py", line 129, in <module>
 from rcsetup import defaultParams, validate_backend, 
validate_toolbar
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/rcsetup.py", line 19, in <module>
 from matplotlib.colors import is_color_like
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/colors.py", line 54, in <module>
 import matplotlib.cbook as cbook
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/cbook.py", line 10, in <module>
 import numpy.ma as ma
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/ma/__init__.py", line 47, in <module>
 import extras
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/ma/extras.py", line 45, in <module>
 from numpy.lib.index_tricks import AxisConcatenator
ImportError: cannot import name AxisConcatenator
The first few lines of my codes are:
from math import *
import exceptions
import pmag
import matplotlib
matplotlib.use("TkAgg")
import numpy as np
import matplotlib.pyplot as plt
Thanks a lot for all your help.
Mitra
On Nov 1, 2009, at 11:32 PM, Eric Firing wrote:
> R. Mitra wrote:
>> Hi Eric
>> from math import *
>> import matplotlib
>> matplotlib.use("TkAgg")
>> from pylab import *
>> This is very basic I know. The above are the modules I am using. 
>> Is plt a separate module? Thanks.
>
> With your method above, you don't need the "plt." part. "from 
> pylab import *" is discouraged, however, except for quick 
> interactive use. For scripts, it is generally considered better 
> practice to use
>
> import matplotlib
> matplotlib.use("tkagg")
> import numpy as np
> import matplotlib.pyplot as plt
>
> pyplot is the plot-related part of the pylab namespace; or to put 
> it another way, pylab is pyplot plus numpy.
>
> See http://matplotlib.sourceforge.net/faq/usage_faq.html
>
> Eric
>
>
>
>> RM
>> On Nov 1, 2009, at 7:26 PM, Eric Firing wrote:
>>> R. Mitra wrote:
>>>> Hi
>>>> I am having problems with contourf(). Suppose I have two 
>>>> 10X30 arrays X,Y and a corresponding Z value array. How do I 
>>>> make the upper left to be the origin? I cannot use contour 
>>>> (Z,origin='upper') because the axis values gets messed up.
>>>
>>> It sounds like maybe you want to reverse the y-axis. Try 
>>> something like plt.gca().invert_yaxis() after your call to 
>>> contourf.
>>>
>>> Eric
>
From: Jeff W. <js...@fa...> - 2009年11月02日 15:53:00
Attachments: hexbin.py
Stephane Raynaud wrote:
> Ross,
>
>
> one way is to mask (or remove) ocean points using the _geoslib module 
> provided with basemap.
> When you create a Basemap instance, you can retrieve all its polygons 
> land (continents and islands) with "mymap.coastpolygons".
> Thay are stored as numpy arrays, and you can convert them to 
> _geoslib.Polygon objects :
>
> poly = _geoslib.Polygon(N.asarray(coastalpoly).T)
>
> Then you loop over all Polygons and all (x,y) points and test :
>
> good_point = _geoslib.Point((x,y)).within(poly)
>
> Thanks to this method, you can choose you optimal resolution.
> You can even compute the intersection of you hexagons with coastal 
> polygons using .intersection() and .area (instead of simply checking 
> if the center is inside) and then reject points depending the fraction 
> of the cell covered by land (or ocean).
Following Stephane's excellent suggestion, here's a prototype Basemap 
method that checks to see if a point is on land or over water. Ross - 
if you find it useful I'll include it in the next release. Note that it 
will be slow for lots of points or large map regions.
-Jeff
>
> On Mon, Nov 2, 2009 at 8:07 AM, <Ros...@ga... 
> <mailto:Ros...@ga...>> wrote:
>
> Listers,
>
> I'm using basemap to plot randomly sampled values (x,y,z) through
> hexbin. This produces a very nice result. Some sample code is:
> ----------
> import numpy as np
> from numpy.random import seed
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
> from matplotlib.mlab import griddata
>
> ll_lat = -38.39477 # extent of area of interest
> ll_lon = 144.54767
> ur_lat = -37.51642
> ur_lon = 145.67144
>
> num_points = 100 # sample points
>
> # create random sampling over the area of interest
> seed(0)
> data = np.ones((3, num_points))
> data[0,:] *= ll_lon + np.random.random((num_points))*(ur_lon-ll_lon)
> data[1,:] *= ll_lat + np.random.random((num_points))*(ur_lat-ll_lat)
> data[2,:] *= np.random.random((num_points))*10000
>
> # plot the data
> fig = plt.figure()
> ax = fig.add_subplot(111)
> m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
> llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f',
> suppress_ticks=False, area_thresh=0.5)
> plt.hexbin(data[0,:], data[1,:], data[2,:], zorder=3)
> m.fillcontinents(color=(0.8,0.8,0.8,0), zorder=1)
> m.drawcoastlines(linewidth=0.25, color='k', zorder=2)
> plt.show()
> ----------
>
> This contrived example shows a sparse set of hexagons on both land
> and ocean. I would like the hexagons over the ocean to be hidden.
> I can make the ones on land disappear by changing the 'zorder'
> parameter of .hexbin() to 0. However I have found no way of doing
> the inverse and hiding hexagons over the ocean.
>
> Using drawlsmask() is too crude at a 5-minute resolution.
>
> Any ideas?
>
> Thanks,
> Ross
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year.
> Jumpstart your
> developing skills, take BlackBerry mobile applications to market
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> -- 
> Stephane Raynaud
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
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: Stephane R. <ste...@gm...> - 2009年11月02日 09:00:32
Ross,
one way is to mask (or remove) ocean points using the _geoslib module
provided with basemap.
When you create a Basemap instance, you can retrieve all its polygons land
(continents and islands) with "mymap.coastpolygons".
Thay are stored as numpy arrays, and you can convert them to
_geoslib.Polygon objects :
poly = _geoslib.Polygon(N.asarray(coastalpoly).T)
Then you loop over all Polygons and all (x,y) points and test :
good_point = _geoslib.Point((x,y)).within(poly)
Thanks to this method, you can choose you optimal resolution.
You can even compute the intersection of you hexagons with coastal polygons
using .intersection() and .area (instead of simply checking if the center is
inside) and then reject points depending the fraction of the cell covered by
land (or ocean).
On Mon, Nov 2, 2009 at 8:07 AM, <Ros...@ga...> wrote:
> Listers,
>
> I'm using basemap to plot randomly sampled values (x,y,z) through hexbin.
> This produces a very nice result. Some sample code is:
> ----------
> import numpy as np
> from numpy.random import seed
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
> from matplotlib.mlab import griddata
>
> ll_lat = -38.39477 # extent of area of interest
> ll_lon = 144.54767
> ur_lat = -37.51642
> ur_lon = 145.67144
>
> num_points = 100 # sample points
>
> # create random sampling over the area of interest
> seed(0)
> data = np.ones((3, num_points))
> data[0,:] *= ll_lon + np.random.random((num_points))*(ur_lon-ll_lon)
> data[1,:] *= ll_lat + np.random.random((num_points))*(ur_lat-ll_lat)
> data[2,:] *= np.random.random((num_points))*10000
>
> # plot the data
> fig = plt.figure()
> ax = fig.add_subplot(111)
> m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
> llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f',
> suppress_ticks=False, area_thresh=0.5)
> plt.hexbin(data[0,:], data[1,:], data[2,:], zorder=3)
> m.fillcontinents(color=(0.8,0.8,0.8,0), zorder=1)
> m.drawcoastlines(linewidth=0.25, color='k', zorder=2)
> plt.show()
> ----------
>
> This contrived example shows a sparse set of hexagons on both land and
> ocean. I would like the hexagons over the ocean to be hidden. I can make
> the ones on land disappear by changing the 'zorder' parameter of .hexbin()
> to 0. However I have found no way of doing the inverse and hiding hexagons
> over the ocean.
>
> Using drawlsmask() is too crude at a 5-minute resolution.
>
> Any ideas?
>
> Thanks,
> Ross
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Stephane Raynaud
From: <Ros...@ga...> - 2009年11月02日 07:08:21
Listers,
I'm using basemap to plot randomly sampled values (x,y,z) through hexbin. This produces a very nice result. Some sample code is:
----------
import numpy as np
from numpy.random import seed
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.mlab import griddata
ll_lat = -38.39477 # extent of area of interest
ll_lon = 144.54767
ur_lat = -37.51642
ur_lon = 145.67144
num_points = 100 # sample points
# create random sampling over the area of interest
seed(0)
data = np.ones((3, num_points))
data[0,:] *= ll_lon + np.random.random((num_points))*(ur_lon-ll_lon)
data[1,:] *= ll_lat + np.random.random((num_points))*(ur_lat-ll_lat)
data[2,:] *= np.random.random((num_points))*10000
# plot the data
fig = plt.figure()
ax = fig.add_subplot(111)
m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
 llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f',
 suppress_ticks=False, area_thresh=0.5)
plt.hexbin(data[0,:], data[1,:], data[2,:], zorder=3)
m.fillcontinents(color=(0.8,0.8,0.8,0), zorder=1)
m.drawcoastlines(linewidth=0.25, color='k', zorder=2)
plt.show()
----------
This contrived example shows a sparse set of hexagons on both land and ocean. I would like the hexagons over the ocean to be hidden. I can make the ones on land disappear by changing the 'zorder' parameter of .hexbin() to 0. However I have found no way of doing the inverse and hiding hexagons over the ocean.
Using drawlsmask() is too crude at a 5-minute resolution.
Any ideas?
Thanks,
Ross
From: Eric F. <ef...@ha...> - 2009年11月02日 03:26:56
R. Mitra wrote:
> Hi
> I am having problems with contourf(). Suppose I have two 10X30 
> arrays X,Y and a corresponding Z value array. How do I make the 
> upper left to be the origin? I cannot use contour (Z,origin='upper') 
> because the axis values gets messed up.
It sounds like maybe you want to reverse the y-axis. Try something like 
 plt.gca().invert_yaxis() after your call to contourf.
Eric

Showing 12 results of 12

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