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

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
From: John H. <jd...@gm...> - 2008年01月23日 19:57:08
On Jan 22, 2008 11:11 PM, <dj...@ph...> wrote:
> I checked the instructions on :
> http://matplotlib.sourceforge.net/interactive.html
> and have used the config file there with minor changes for TkAgg and
> interactive mode. However this also did not work. Note : again under
> cygwin I placed the file in ~/.matplotlib/matplotlibrc rather than the
> suggested windows location and this seemed to work.
>
> While interactive mode is useful it is not mandatory for what I am doing
> and perhaps the easiest thing to do is set matplotlib to dump all output
> to files...
I have never used mpl under cygwin in windows, but it might help to
make sure your parameters and config files are as you expect. For
example, in interactive mode, you should not need to call show to get
the figure to appear. Please report the output of a test script in
the same environment with the --verbose-helpful flag
> python test.py --verbose-helpful
where test.py is something like:
 from pylab import plot, show
 plot([1,2,3])
 show()
this should echo your backedn and interactive settings, as well as the
matplotlibrc file location.
JDH
From: Christopher B. <Chr...@no...> - 2008年01月23日 18:29:35
Just another note:
If you can use wxPython 2.8.*, then this problem should go away. 2.8 
added some methods that allow more directly moving bitmaps from Agg to 
wxPython, eliminating the need for any extension code.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Pete F. <pet...@we...> - 2008年01月23日 13:30:11
dj...@ph... writes:
 > On a more general note it seems there are dozens of different ways
 > to run matplotlib under windows.
TkAgg gave me the same set of problems as you on Windows (native).
I was able to use WxAgg instead. wxPython 2.8 did not work but
switching to 2.6 cured that. IIRC others hacked some binaries to get
2.8 going.
-- 
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pet...@we... -./\.- the opinion of Schlumberger or
http://petef.port5.com -./\.- WesternGeco.
From: Matthias M. <Mat...@gm...> - 2008年01月23日 11:19:13
Attachments: error_message.txt
Hello Ken,
Hello Mike,
Hello all,
On Tuesday 22 January 2008 19:33, Ken McIvor wrote:
> On Jan 22, 2008, at 11:00 AM, Matthias Michler wrote:
> > I was not up to date with my installation and I tried to use the
> > latest svn
> > version (trunk) on my Debian etch. I have a problem to build
> > matplotlib
> > including support for wxPython as backend. The output is attached
> > below.
> >
> > Actually I cannot find a file "wxPython.h" on my system.
>
> The wxPython Debian packages do not include the development headers
> required to build the WXAgg accelerator module. The WXAgg backend
> will work just fine without it, so you should disable the module by
> editing setup.cfg and uncommenting the line "wxagg = False" in the
> "gui_support" section.
>
> Please let me know if you haven't created a setup.cfg file and are
> receiving this error straight "out of the box", as that's indicative
> of a bug in the build system. Thanks!
First of all thanks a lot for your (Mike and Ken) suggestions. I will try it 
later that day.
I'm quite sure I did not create a setup.cfg file before this error message 
occured the first time. I deleted my setup.cfg and the error message seems 
quite similar (it is attached).
thanks again for your help, best regards 
Matthias
From: <dj...@ph...> - 2008年01月23日 05:12:03
Hi there,
I feel like I am really close to getting matplotlib working under
cygwin/ipython (although the problem persists in the conventional python
shell also).
On a more general note it seems there are dozens of different ways to run
matplotlib under windows. I used as many cygwin packages as seemed
relvant including the cygwin version of python and X etc. I then
installed numpy and ipython from source (following the linux
instructions). I tried to install pygtk and wxpython without success
(also from source). I am a bit confused in this situation when I should
follow windows installation and when I should follow unix e.g. Windows
installers of python packages appear not to work at all...
There were only two minor issues. I had to run ash / rebaseall
Also I had to create the following symbolic links :
cd /lib
ln -s libtk84.a libtk8.4.a
ln -s libtcl84.a libtcl8.4.a
Anyway my problem is the following :
from pylab import *
from numpy import *
contour(eye(100))
show()
This then produces the image and the function show() blocks on the shell. 
This is all normal behaviour (it also happens in linux).
However If I then close the window and then type :
contour(eye(100))
A "Figure 1" window appears, but nothing happens in it (on linux the
contour plot would reappear).
in this situation show() also does nothing. From this point on nothing I
do can make the figure plot...
I checked the instructions on :
http://matplotlib.sourceforge.net/interactive.html
and have used the config file there with minor changes for TkAgg and
interactive mode. However this also did not work. Note : again under
cygwin I placed the file in ~/.matplotlib/matplotlibrc rather than the
suggested windows location and this seemed to work.
While interactive mode is useful it is not mandatory for what I am doing
and perhaps the easiest thing to do is set matplotlib to dump all output
to files...
Thanks in advance for any help!
David
From: Angus M. <am...@gm...> - 2008年01月23日 00:50:18
Hi S=F8ren,
I've put this back on the list in case it's useful to anyone else, or
if there are better suggestions or improvements around. Hope you don't
mind.
On 22/01/2008, S=F8ren Nielsen <sor...@gm...> wrote:
> Yeah i'd like to see your code if I can..
import numpy as n
def get_poly_pts(x, y, shape):
"""Creates convex polygon mask from list of corners.
 Parameters
 ----------
 x : array_like
 x co-ordinates of corners
 y : array_like
 y co-ordinates of corners, in order corresponding to x
 shape : array_like
 dimension sizes of result
 Returns
 -------
 build : ndarray
 2-D array of shape shape with values True inside polygon
 Notes
 -----
 Code is constrained to convex polygons by "inside"
 assessment criterion.
 """
 x =3D n.asarray(x)
 y =3D n.asarray(y)
 shape =3D n.asarray(shape)
 npts =3D x.size # should probably assert x.size =3D=3D y.size
 inds =3D n.indices( shape )
 xs =3D inds[0]
 ys =3D inds[1]
 xav =3D n.round(x.mean()).astype(int)
 yav =3D n.round(y.mean()).astype(int)
 for i in xrange(npts): # iterate over pairs of co-ordinates
 j =3D (i + 1) % npts
 m =3D (y[j] - y[i])/(x[j] - x[i])
 c =3D (x[j] * y[i] - x[i] * y[j])/(x[j] - x[i])
 thisone =3D ( ys > m * xs + c )
 if thisone[xav, yav] =3D=3D False:
 thisone =3D ~thisone
 if i =3D=3D 0:
 build =3D thisone
 else:
 build &=3D thisone
 return build
(released under BSD licence)
> I just needed the push over the edge to know how to draw on the canvas,
> mapping clicks etc. since i'm still fairly new to matplotlib, so I think
> your code will be helpfull.
I hope so. As you can see this code doesn't do any of the drawing or
click collecting, but the cookbook page should be able to guide you
there. Ask again on the list if you have any further questions and
we'll see if we can help.
Also, the code assumes that the average co-ordinate is inside the
shape - that's true for convex polygons, but not necessarily for
arbitrary ones. I use if after taking a convex hull of a greater list
of points (using the delaunay module in scipy (now in scikits, I
hear)), which ensures convexity. You just need to be aware of that
limitation.
Cheers,
A.
--=20
AJC McMorland, PhD candidate
Physiology, University of Auckland
1 message has been excluded from this view by a project administrator.

Showing 10 results of 10

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /