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


Showing results of 310

<< < 1 2 3 4 5 .. 13 > >> (Page 3 of 13)
From: John H. <jd...@gm...> - 2008年01月29日 14:40:46
On Jan 29, 2008 8:33 AM, Robert Cimrman <cim...@nt...> wrote:
>
> Is there a way of simultaneously setting both xdata and ydata of a line?
> I need to animate a line with varying number of points in each frame.
line.set_data(xdata, ydata)
is what you are looking for
JDH
From: Robert C. <cim...@nt...> - 2008年01月29日 14:35:56
Is there a way of simultaneously setting both xdata and ydata of a line? 
I need to animate a line with varying number of points in each frame.
regards,
r.
From: John H. <jd...@gm...> - 2008年01月29日 14:23:42
On Jan 28, 2008 2:06 PM, j vickroy <jim...@no...> wrote:
> Hello users,
>
> I wish to repeatedly re-plot labels and contour data on a figure since
> redrawing the figure is temporally expensive. The attached script (I
> apologize for its length), hopefully, illustrates a simplified version
> of what I'm trying to do -- contour temporally-varying data on a map
> projection.
matplotlib has some support for the kinds of things you are trying to
do -- eg draw an expensive part of the figure, save it, plot something
on top of it, erase it, restore the original figure, etc. This is
convered in some detail in the animation cookbook recipe. Although
you are not doing animation, the concepts are quite similar in that
both require copying and restoring a background, and updating the
"animated" object.
http://www.scipy.org/Cookbook/Matplotlib/Animations
JDH
From: Andy C. <And...@br...> - 2008年01月29日 13:28:19
The error was due to muppetdom of the highest degree... I've created a 
bash alias which subsituted ipython with ipython ---options. Subsequent 
use of ipython -pylab put the -pylab tab at the end and it was quietly 
ignored
Sorry to waste people time
Andy
j vickroy wrote:
> Hello users,
>
> I wish to repeatedly re-plot labels and contour data on a figure since 
> redrawing the figure is temporally expensive. The attached script (I 
> apologize for its length), hopefully, illustrates a simplified version 
> of what I'm trying to do -- contour temporally-varying data on a map 
> projection.
>
> I do not understand how to erase the plot label each time the figure 
> is to be reused. I also do not know how to erase the contour-fill 
> although, based on the generated PNG files, it does not, for unknown 
> reasons , appear to be necessary. From some postings, it seems that I 
> have to employ collections attributes, but I have not been able to 
> find documentation or examples that illustrate this.
>
> My system:
>
> * matplotlib.__version__: '0.91.2'
> * sys.version: '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC
> v.1310 32 bit (Intel)]'
>
>
> Thanks,
> -- jv
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Michael B. <mic...@as...> - 2008年01月29日 05:30:08
I wanted to test MatPlotLib for use in a GIS system for which I help 
develop the GUI in wxPython. I'm working on a Mac Intel OSX 10.4.11 
system.
The installation instructions for OS X are very sketchy and there is 
no readme in the binary. But AFAICT, there ought to be a setup.py 
file in the fat egg distribution folder. However, there is no such 
beast. There is only pylab.py and that isn't a distribution build 
utility.
Since I'm not a member of the list, I'd appreciate it if someone 
could email me directly.
Thanks
Michael Barton
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>
From: postmaster <pos...@aj...> - 2008年01月29日 03:24:09
I just migrated from edgy to gutsy this weekend. I did a clean install (boy it really
went smoothly - either I'm getting better or the installs are) and it all works fine
for me. I used Adept Manager to install everything. You installed numpy? I'm running
kubuntu.
On 2008年1月28日 17:39:45 +0000
Andy Cheesman <And...@br...> wrote:
> Hi people
> 
> I'm trying to use matplotlib, ipython and xubuntu(gusty) all together. 
> Whenever I try to run ipython with -pylab tab, nothing extra happens to 
> the start up screen and pylab hasn't been imported. I have managed to 
> sucessfull install ipython and matplotlib on a Redhat system and ipython 
> -pylab works. ipython and matplotlib work btw
> 
> I've tried install from source, apt and easy_install all to to avail
> 
> Can anyone suggest what I am doing wrong or an output to post to show 
> more details of what is happening on my machine
> 
> Thanks
> 
> Andy
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
-----------------------------------------------------------------------
| Alan K. Jackson | To see a World in a Grain of Sand |
| al...@aj... | And a Heaven in a Wild Flower, |
| www.ajackson.org | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake |
-----------------------------------------------------------------------
From: j v. <jim...@no...> - 2008年01月28日 20:06:53
Attachments: reuse.py
Hello users,
I wish to repeatedly re-plot labels and contour data on a figure since 
redrawing the figure is temporally expensive. The attached script (I 
apologize for its length), hopefully, illustrates a simplified version 
of what I'm trying to do -- contour temporally-varying data on a map 
projection.
I do not understand how to erase the plot label each time the figure is 
to be reused. I also do not know how to erase the contour-fill 
although, based on the generated PNG files, it does not, for unknown 
reasons , appear to be necessary. From some postings, it seems that I 
have to employ collections attributes, but I have not been able to find 
documentation or examples that illustrate this.
My system:
 * matplotlib.__version__: '0.91.2'
 * sys.version: '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC
 v.1310 32 bit (Intel)]'
Thanks,
-- jv
From: Tim M. <tim...@gm...> - 2008年01月28日 19:25:10
Hello,
for me it works:
****
timmie@localhost:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"
timmie@localhost:~$ ipython -pylab
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.1 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
 Welcome to pylab, a matplotlib-based Python environment.
 For more information, type 'help(pylab)'.
 ****
I would suggest to reinstall the necessary packages.
Kind regards,
Timmie
From: Andy C. <And...@br...> - 2008年01月28日 17:40:17
Hi people
I'm trying to use matplotlib, ipython and xubuntu(gusty) all together. 
Whenever I try to run ipython with -pylab tab, nothing extra happens to 
the start up screen and pylab hasn't been imported. I have managed to 
sucessfull install ipython and matplotlib on a Redhat system and ipython 
 -pylab works. ipython and matplotlib work btw
I've tried install from source, apt and easy_install all to to avail
Can anyone suggest what I am doing wrong or an output to post to show 
more details of what is happening on my machine
Thanks
Andy
From: Manuel M. <mm...@as...> - 2008年01月28日 09:10:44
Cheng-Kong Wu wrote:
> Dear all,
> 
> I am working on sending vibration results to two
> plots: subplot(211) and subplot(212). I have the
> following questions:
> 
> 1. How to define the size of the figure? I will
> eventually import the figure into Microsoft Word, and
> I hope I can fit the figure into one page.
fig = pylab.figure(figsize=(6,10), dpi=96)
[...]
pylab.savefig("filename.eps", dpi=96)
,where figsize in the figure size in inches.
> 2. If I want to make both the subplots square sized,
> how do I achieve it?
xylims = (-10,10) # set your axis limits here
pylab.gca().set_xlim(xylims)
pylab.gca().set_ylim(xylims)
pylab.gca().set_aspect('equal')
That's the quick-and-easy way. If the limits differ, you can create your 
own new axes instance, have a look at axes_demo.py in the examples.
Manuel
> Thanks!
> Cheng-Kong
> 
> 
> ____________________________________________________________________________________
> Never miss a thing. Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Neil C. <nei...@gm...> - 2008年01月27日 22:18:04
I think scatter3D does what you want:
from matplotlib import axes3d
import pylab as pl
fig = pl.figure()
ax = axes3d.Axes3D(fig)
ax.scatter3D(data[:,0],data[:,1],data[:,2])
ax.set_xlabel('X value')
ax.set_ylabel('Y value')
ax.set_zlabel('Z value')
pl.show()
You could also change the colour and size of each point based on other
array values:
col = ax.scatter3D(data[:,0], data[:,1], data[:,2], c=data[:,3],
cmap=pl.cm.jet, s=data[:,4])
cbar = fig.colorbar(col,shrink=0.9,extend='both')
cbar.ax.set_ylabel('axis 3 data values')
Pretty nifty.
Neil
> hello,
> I would like to plot in 3D a dataset organized as 1000 x,y,z points in a
> numpy array, so it would be smthg like
> plot3d(data[:,0],data[:,1],data[:,2]). I looked at the plot3D cookbook
> page, but it all seems to expect some sort of binning on a grid.....
>
> best,
> Johann
>
From: Cheng-Kong Wu <che...@ya...> - 2008年01月27日 17:30:20
Dear all,
I am working on sending vibration results to two
plots: subplot(211) and subplot(212). I have the
following questions:
1. How to define the size of the figure? I will
eventually import the figure into Microsoft Word, and
I hope I can fit the figure into one page.
2. If I want to make both the subplots square sized,
how do I achieve it?
Thanks!
Cheng-Kong
 ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page. 
http://www.yahoo.com/r/hs
From: Johann Cohen-T. <co...@sl...> - 2008年01月25日 20:41:55
hello,
I would like to plot in 3D a dataset organized as 1000 x,y,z points in a 
numpy array, so it would be smthg like 
plot3d(data[:,0],data[:,1],data[:,2]). I looked at the plot3D cookbook 
page, but it all seems to expect some sort of binning on a grid.....
best,
Johann
From: Vinu V. <vv...@gm...> - 2008年01月25日 19:19:01
Hi all
I am new to the interactive matplotlib scripting. I need to get coordinate
list of some pixels interactively from the image.
My aim is to get the coordinate list of some region first by selecting
interactively. If I could select the region successfully, then using a key
press (say 'a' key) save that list. If the selection is bad then I want to
ignore the list using a key press (say, 'c' key) and go for the next
selection. When I finish the selection quit the interactive mode by using
another key press (say, 'q').
I tried to modify the lasso_demo.py but failed to achieve the task. I am
attaching the code. Could anybody help me?
Thanks
Vinu V
#!/usr/bin/env python
"""
Show how to use a lasso to select a set of points and get the indices
of the selected points. A callback is used to change the color of the
selected points
This is currently a proof-of-concept implementation (though it is
usable as is). There will be some refinement of the API and the
inside polygon detection routine.
"""
from matplotlib.widgets import Lasso
import matplotlib.mlab
from matplotlib.nxutils import points_inside_poly
from matplotlib.colors import colorConverter
from matplotlib.collections import RegularPolyCollection
import pyfits
import pylab
from pylab import figure, show, nx
import numpy as n
from matplotlib.patches import Polygon
class LassoManager:
 def __init__(self, ax, x, y, z):
 self.axes = ax
 self.canvas = ax.figure.canvas
 self.x = x
 self.y = y
 self.z = z
 ax.contourf(x,y,z, 50)
 x1 = n.reshape(x, (size * size, 1))
 y1 = n.reshape(y, (size * size, 1))
 self.xy = n.concatenate((x1,y1),axis=1)
 self.Nxy = size * size
 self.cid = self.canvas.mpl_connect('button_press_event',
self.onpress)
 self.cid2 = fig.canvas.mpl_connect('key_press_event', self.onpress1)
 def onpress1(self, event):
 if event.key=='a':
 accept = 'yes'
 print accept
 if event.key=='c':
 accept = 'no'
 print accept
 elif event.key=='q':
 pylab.close()
 def callback(self, verts):
 ind = nx.nonzero(points_inside_poly(self.xy, verts))
 print ind % size, ind / size
 for i in range(self.Nxy):
 if i in ind:
 pass
 else:
 pass
 rect = Polygon(verts, facecolor='red', alpha=0.3)
 self.axes.add_patch(rect)
 self.canvas.draw_idle()
 def onpress(self, event):
 self.lasso = Lasso(event.inaxes, (event.xdata, event.ydata),
self.callback)
f = pyfits.open('I_EDCSNJ1216453-1201176.fits')
z = f[0].data
f.close()
size = z.shape[0]
x = n.reshape(n.arange(size * size), (size, size)) % size
x = x.astype(n.float32)
y = n.reshape(n.arange(size * size), (size, size)) / size
y = y.astype(n.float32)
fig = figure()
ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)
lman = LassoManager(ax, x, y, z)
show()
-- 
VINU VIKRAM
http://iucaa.ernet.in/~vvinuv/
From: Larsen, J. <jl...@dm...> - 2008年01月25日 08:27:00
Jim Vickroy wrote:
>Thanks for the detailed explanation; I may be starting to understand =
the=20
>significance of *figure*.
>I was hoping to avoid repeated calls like map.drawcoastlines(),=20
>map.drawcountries(), map.fillcontinents(color=3D'0.95'),=20
>map.drawmapboundary(), map.drawmeridians(plot.arange(0,360,30)), and=20
>map.drawparallels(plot.arange(-90,90,30)). So, I will follow your=20
>example and experiment to see what works and what does not to better=20
>understand the behaviors.
Hi Jim and others,
You should definitely reuse the basemap instance but from your reply it =
seems like you would also like to reuse the figure instance. The current =
figure instance is changed when you make plot commands like =
map.drawcountries(). What I do is to remove the stuff that should not be =
reused. That is something like this:
# If first time create figure from basemap using my function getfigure
if fig =3D=3D None:
 fig =3D getfigure(map)
# The figure I am plotting on has two axes which I change - an axes with =
the plot and an axes with a colorbar
ax =3D fig.get_axes()[0]
cax =3D fig.get_axes()[1]
# Create plot and save figure
cs =3D map.contourf(lon, lat, data, ax=3Dax)
fig.colorbar(cs, cax=3Dcax, orientation=3D'vertical', extend=3D'both')
fig.savefig(filename)
# Remove contourf axes ContourSets
for c in cs.collections:
 ax.collections.remove(c)
# Remove colorbar axes ContourSets
cax.collections =3D []
Hope it helps.
Regards,
Jesper
From: Jordan D. <jd...@eo...> - 2008年01月24日 18:25:17
Eric Firing wrote:
>
> Maybe contour, contourf, and any similar plotting commands that do not 
> support zorder as a kwarg should do so? I am not sure if this is 
> needed often enough to warrant the extra code and documentation.
I can't speak for other people, but I use this kind of functionality in 
nearly every plot I do. Usually I contourf a field in 4-level 
greyscale, then contour over that to make 8 contour levels, then 
contourf over _that_ to mask land points (I run models so I have 'land' 
arrays I can use for this). Sometimes I them put polygons (sometimes 
transparent) over that to highlight regions. Usually how I've been 
doing this is by going in to illustrator and manually altering the 
stacking of the plot elements. Ideally how I wish it worked was that 
the default zorder was set by a counter, so the oldest plots on an axis 
would be buried under the newer ones.
Jordan
From: Eric F. <ef...@ha...> - 2008年01月24日 18:13:03
Jordan Dawe wrote:
>> pc = contour(random.rand(10,10))
>> pcf = contourf(random.rand(10,10), cmap=cm.gray)
>> # now the contours are on top
>>
>> for l in pc.collections:
>> l.set_zorder(-100)
>>
>> draw()
>> # now the contours are on the bottom
> 
> Well, that's certainly kludgey, but it worked great. Thanks.
Maybe contour, contourf, and any similar plotting commands that do not 
support zorder as a kwarg should do so? I am not sure if this is needed 
often enough to warrant the extra code and documentation.
Eric
From: Jordan D. <jd...@eo...> - 2008年01月24日 16:31:36
>
> pc = contour(random.rand(10,10))
> pcf = contourf(random.rand(10,10), cmap=cm.gray)
> # now the contours are on top
>
> for l in pc.collections:
> l.set_zorder(-100)
>
> draw()
> # now the contours are on the bottom
Well, that's certainly kludgey, but it worked great. Thanks.
Jordan
From: Tommy G. <tg...@ma...> - 2008年01月24日 14:13:46
I have a plot that is divided into four subplots.
pylab.figure()
pylab.subplot(221)
pylab.plot(a,b,"k-")
pylab.subplot(222)
pylab.plot(a,b,"k-")
pylab.subplot(223)
pylab.plot(a,b,"k-")
pylab.subplot(224)
pylab.plot(a,b,"k-")
I would like to add a title to the entire plot, but pylab.title() only
applies to the most recent subplot. I have tried
pylab.figure()
pylab.subplot(111)
pylab.title("Title Here")
pylab.subplot(221)
pylab.plot(a,b,"k-")
pylab.subplot(222)
pylab.plot(a,b,"k-")
pylab.subplot(223)
pylab.plot(a,b,"k-")
pylab.subplot(224)
pylab.plot(a,b,"k-")
but this does not work as I do not create a plot for
the subplot(111) instance. Is there some way of getting
the type of title I want easily?
Cheers
 Tommy
From: Rob H. <he...@ta...> - 2008年01月24日 07:32:03
On Jan 24, 2008, at 8:11 AM, Jordan Dawe wrote:
> However, when I do this the result is the two contour plots are 
> drawn on
> top of the contourf plots no matter what. How do I hide the contours
> under a contourf?
zorder.
It won't really matter what order you plot, as long as you set the 
zorder of the objects to the order you want. However, there is no 
set_zorder for the whole contour, rather just for each element in the 
collection. Observe:
pc = contour(random.rand(10,10))
pcf = contourf(random.rand(10,10), cmap=cm.gray)
# now the contours are on top
for l in pc.collections:
 l.set_zorder(-100)
draw()
# now the contours are on the bottom
I guess the advantage is that you could pick and choose which 
contours to expose:
for l in pcf.collections[::2]:
 l.set_zorder(-1000)
draw()
# woven contours and contourfs...
-Rob
----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331
From: Jordan D. <jd...@eo...> - 2008年01月24日 07:12:02
Ok, I've spent a while searching through the mailing list archives and I 
can't find an answer for this relatively simple problem. I've plotted a 
series of contourf and contour plots on the same axes.
First I plot a contourf.
Next a contour on top of it.
Then I want a contourf plotted on top of both the previous contourf and 
contour plots.
And finally, a contour on top of the second contourf.
However, when I do this the result is the two contour plots are drawn on 
top of the contourf plots no matter what. How do I hide the contours 
under a contourf?
Jordan
From: Jim V. <Jim...@no...> - 2008年01月23日 21:31:50
Jeff Whitaker wrote:
> Jim Vickroy wrote:
>> Hello users,
>>
>> I'm using matplotlib.toolkits.basemap.Basemap to plot data on several 
>> types of projections at a regular cadence. I am presently 
>> regenerating the maps each time new data is to be plotted. Is it 
>> possible to generate template map projections once (at startup) and 
>> reuse them each time new data is to be plotted? If so, could someone 
>> point to a reference or example of how to do this?
>>
>> Thanks,
>> -- jv
>> 
>
> Jim: You can reuse a Basemap instance to plot data on multiple 
> figures, like this
>
> # create the first figure
> fig = pylab.figure()
> # create a Basemap instance for your map projection
> map = Basemap(...)
> # plot some stuff on this map projection.
> map.contour(...)
> ... some other plotting commands ...
> # save the figure
> pylab.savefig('plot1.png')
>
> # create another figure
> fig = pylab.figure()
> # use the same basemap instance to different data on this map projection
> map.contour(...)
> ... more plotting commands...
> # save the second figure
> pylab.savefig('plot2.png')
>
> You can also save the Basemap instance to disk using the Pickle module 
> and reload it in another script.
>
> -Jeff
>
>
Thanks for the detailed explanation; I may be starting to understand the 
significance of *figure*.
I was hoping to avoid repeated calls like map.drawcoastlines(), 
map.drawcountries(), map.fillcontinents(color='0.95'), 
map.drawmapboundary(), map.drawmeridians(plot.arange(0,360,30)), and 
map.drawparallels(plot.arange(-90,90,30)). So, I will follow your 
example and experiment to see what works and what does not to better 
understand the behaviors.
-- jv
From: Pierre GM <pgm...@gm...> - 2008年01月23日 20:34:51
On Wednesday 23 January 2008 14:57:26 Jim Vickroy wrote:
> Hello users,
>
> I'm using matplotlib.toolkits.basemap.Basemap to plot data on several
> types of projections at a regular cadence. I am presently regenerating
> the maps each time new data is to be plotted. Is it possible to
> generate template map projections once (at startup) and reuse them each
> time new data is to be plotted? If so, could someone point to a
> reference or example of how to do this?
You could try to pickle the basemap instance, that should save you some 
initialization time. Then, it's just a matter of replotting.
From: Jeff W. <js...@fa...> - 2008年01月23日 20:30:59
Jim Vickroy wrote:
> Hello users,
>
> I'm using matplotlib.toolkits.basemap.Basemap to plot data on several 
> types of projections at a regular cadence. I am presently regenerating 
> the maps each time new data is to be plotted. Is it possible to 
> generate template map projections once (at startup) and reuse them each 
> time new data is to be plotted? If so, could someone point to a 
> reference or example of how to do this?
>
> Thanks,
> -- jv
> 
Jim: You can reuse a Basemap instance to plot data on multiple figures, 
like this
# create the first figure
fig = pylab.figure()
# create a Basemap instance for your map projection
map = Basemap(...)
# plot some stuff on this map projection.
map.contour(...)
 ... some other plotting commands ...
# save the figure
pylab.savefig('plot1.png')
# create another figure
fig = pylab.figure()
# use the same basemap instance to different data on this map projection
map.contour(...)
... more plotting commands...
# save the second figure
pylab.savefig('plot2.png')
You can also save the Basemap instance to disk using the Pickle module 
and reload it in another script.
-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-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Jim V. <Jim...@no...> - 2008年01月23日 19:57:36
Hello users,
I'm using matplotlib.toolkits.basemap.Basemap to plot data on several 
types of projections at a regular cadence. I am presently regenerating 
the maps each time new data is to be plotted. Is it possible to 
generate template map projections once (at startup) and reuse them each 
time new data is to be plotted? If so, could someone point to a 
reference or example of how to do this?
Thanks,
-- jv
2 messages has been excluded from this view by a project administrator.

Showing results of 310

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