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
(10) |
2
(10) |
3
(8) |
4
(6) |
5
(10) |
6
(1) |
7
(3) |
8
|
9
(5) |
10
(4) |
11
(9) |
12
(6) |
13
(12) |
14
(3) |
15
(2) |
16
(13) |
17
(7) |
18
(14) |
19
(7) |
20
(3) |
21
(1) |
22
|
23
(8) |
24
(6) |
25
(3) |
26
(5) |
27
(10) |
28
(5) |
29
(1) |
30
(7) |
|
|
|
|
|
From: Elliot S. <sta...@gm...> - 2012-04-03 22:15:10
|
Hello, I am also having trouble installing matplotlib on OSX 10.7 (Homebrew python 2.7.2, clang v2.1) and when trying to compile it from source, I get errors regarding libpng. (https://gist.github.com/2269043) These are the same errors I get when trying to install via pip. I saw that there used to be errors with libpng 1.5 (which is what I have as I am running 10.7) but they were supposedly fixed, however this does not seem to be the case. Does anyone have any tips for me? Also, I do not think that I can use a binary distribution, as they do not detect my python 2.7, and will not install to the proper site-packages directory. I also do not wish to install an "all-in-one" python distribution such as EPD as I have many other packages that I wish to use alongside matplotlib that I have already installed in my current python setup. -E |
From: Emmanuel M. <ema...@ya...> - 2012-04-03 20:59:15
|
what does figure.clear() do ? what about ax.clear()? The doc is kind of sparce. The 2 function/method above do nothing on my setup. ax.clear() I was expecting to mean 'erase all the 2DLines' figure.clear() I was expecting 'hide all the axes' Now figure.del_axes(self.figure.axes) does not do anything either.... How can I remove my axes from the figure? -- Emmanuel |
From: Jonathan S. <js...@cf...> - 2012-04-03 20:50:05
|
Hi, I've been writing a routine that interactively finds fitting limits. Some of the time it seems that doing draw() flushes the output to the figure and some of the time it doesn't. The only way I can reliably get it to do that is to insert a waitforbuttonpress into the code. However, this raises a DeprecationWarning: DeprecationWarning: Using default event loop until function specific to this GUI is implemented That of course doesn't cause any real problems, but I'd like to know how it should be done properly since using waitforbuttonpress creates this warning. Or maybe it's just a warning that in the future, once the event loop function is written for my backend (gtkagg) this function won't necessarily exist? I'd just as soon not use it, but I don't know another way to force the updating of the figure. Jon -- ______________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA js...@cf... 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ______________________________________________________________ |
From: Mathew T. <mat...@ed...> - 2012-04-03 17:07:16
|
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. |
From: Jeff W. <js...@fa...> - 2012-04-03 13:22:45
|
On 4/3/12 3:09 AM, David Craig wrote: > Hi again, > So I removed everything and started again ( with version 1-0-2 :) ) > but am still having trouble, GEOS_DIR seems to be set correctly but I > get the following error when trying to make the GEOS library with, > > sudo make; make install > > make[3]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' > test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib" > /bin/sh ../libtool --mode=install /usr/bin/install -c libgeos.la > '/home/davcra/lib' > libtool: install: /usr/bin/install -c .libs/libgeos-3.3.1.so > /home/davcra/lib/libgeos-3.3.1.so > libtool: install: (cd /home/davcra/lib&& { ln -s -f libgeos-3.3.1.so > libgeos.so || { rm -f libgeos.so&& ln -s libgeos-3.3.1.so libgeos.so; > }; }) > libtool: install: /usr/bin/install -c .libs/libgeos.lai > /home/davcra/lib/libgeos.la > libtool: install: /usr/bin/install -c .libs/libgeos.a /home/davcra/lib/libgeos.a > libtool: install: chmod 644 /home/davcra/lib/libgeos.a > libtool: install: ranlib /home/davcra/lib/libgeos.a > libtool: finish: > PATH="/usr/ncl_files/bin:/usr/ncl_files/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/davcra/.local/bin:/home/davcra/bin:/sbin" > ldconfig -n /home/davcra/lib > ---------------------------------------------------------------------- > Libraries have been installed in: > /home/davcra/lib > > If you ever happen to want to link against installed libraries > in a given directory, LIBDIR, you must either use libtool, and > specify the full pathname of the library, or use the `-LLIBDIR' > flag during linking and do at least one of the following: > - add LIBDIR to the `LD_LIBRARY_PATH' environment variable > during execution > - add LIBDIR to the `LD_RUN_PATH' environment variable > during linking > - use the `-Wl,-rpath -Wl,LIBDIR' linker flag > - have your system administrator add LIBDIR to `/etc/ld.so.conf' > > See any operating system documentation about shared libraries for > more information, such as the ld(1) and ld.so(8) manual pages. > ---------------------------------------------------------------------- > make[3]: Nothing to be done for `install-data-am'. > make[3]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' > make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' > make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' > Making install in capi > make[1]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' > make[2]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' > test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib" > /bin/sh ../libtool --mode=install /usr/bin/install -c > libgeos_c.la '/home/davcra/lib' > libtool: install: warning: relinking `libgeos_c.la' > libtool: install: (cd /home/davcra/basemap-1.0.2/geos-3.3.1/capi; > /bin/sh /home/davcra/basemap-1.0.2/geos-3.3.1/libtool --tag CXX > --mode=relink g++ -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long > -ffloat-store -g -O2 -version-info 8:1:7 -no-undefined -o libgeos_c.la > -rpath /home/davcra/lib libgeos_c_la-geos_c.lo > libgeos_c_la-geos_ts_c.lo ../src/libgeos.la ) > mv: cannot move `libgeos_c.so.1.7.1' to `libgeos_c.so.1.7.1U': Permission denied > libtool: install: error: relink `libgeos_c.la' with the above command > before installing it > make[2]: *** [install-libLTLIBRARIES] Error 1 > make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' > make[1]: *** [install-am] Error 2 > make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' > make: *** [install-recursive] Error 1 > > any ideas?? > thanks > D David: Seems like a permissions problem? Any reason you're not using the libgeos yum package? -Jeff > > On 3/31/12 5:48 AM, David Craig wrote: >> Hi, I previously installed basemap by using the yum command. This >> installed version 0.99.4. I want to install the latest version so I >> can use shaded relief etc. This may be more of a linux problem but as >> I am more familiar with python than linux I thought someone here may >> be able to help. >> Following the website instructions >> (http://matplotlib.github.com/basemap/users/installing.html) I >> downloaded the latest version and untarred it. Then in the basemap >> directory (which contains geos-3.2.0) I try to set the environment >> variable GEOS_DIR to point to the location of libgeos_c and geos_c.h. >> I use the find command to locate the files, >> /find / -name geos_c.h/ returns the location of that file as >> //usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h/ >> and >> /find / -name libgeos*/ >> returns >> //libgeos_c_la-geos_c.Plo >> /usr/lib/libgeos-3.3.1.so<http://libgeos-3.3.1.so> >> /usr/lib/libgeos_c.so.1.7.1 >> /usr/lib/libgeos_c.so.1/ >> so I set GEOS_DIR to /usr/lib (not sure if this is correct). >> I then cd to the basemap directory and run, >> python setup.py install >> [davcra@... basemap-1.0.1]$ sudo python setup.py install >> [sudo] password for davcra: >> checking for GEOS lib in /root .... >> checking for GEOS lib in /usr .... >> checking for GEOS lib in /usr/local .... >> checking for GEOS lib in /sw .... >> checking for GEOS lib in /opt .... >> checking for GEOS lib in /opt/local .... >> >> Can't find geos library . Please set the >> environment variable GEOS_DIR to point to the location >> where geos is installed (for example, if geos_c.h >> is in /usr/local/include, and libgeos_c is in /usr/local/lib, >> set GEOS_DIR to /usr/local), or edit the setup.py script >> manually and set the variable GEOS_dir (right after the line >> that says "set GEOS_dir manually here". >> The problem seems to be with GEOS_DIR but I am not sure what I should >> set it to. >> Thanks >> D > David: > > The basemap setup.py is assuming that the geos library is installed in > <GEOS_DIR>/lib, and geos_c.h in<GEOS_DIR>/include. You should set > GEOS_DIR to the directory you specified with --prefix when you ran > configure for geos 3.2.0 (I think the default is /usr/local). However, > it looks like you have a redhat installed geos library in /usr/lib > (seems like it is version 3.3.1). You probably could just install the > -dev package (which would put the include file in /usr/include), and > the basemap setup.py would autodetect it. > > Also, the latest version of basemap is 1.0.2, not 1.0.1. > > -Jeff > > ------------------------------------------------------------------------------ > Better than sec? Nothing is better than sec when it comes to > monitoring Big Data applications. Try Boundary one-second > resolution app monitoring today. Free. > http://p.sf.net/sfu/Boundary-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: David C. <dcd...@gm...> - 2012-04-03 09:09:34
|
Hi again, So I removed everything and started again ( with version 1-0-2 :) ) but am still having trouble, GEOS_DIR seems to be set correctly but I get the following error when trying to make the GEOS library with, sudo make; make install make[3]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib" /bin/sh ../libtool --mode=install /usr/bin/install -c libgeos.la '/home/davcra/lib' libtool: install: /usr/bin/install -c .libs/libgeos-3.3.1.so /home/davcra/lib/libgeos-3.3.1.so libtool: install: (cd /home/davcra/lib && { ln -s -f libgeos-3.3.1.so libgeos.so || { rm -f libgeos.so && ln -s libgeos-3.3.1.so libgeos.so; }; }) libtool: install: /usr/bin/install -c .libs/libgeos.lai /home/davcra/lib/libgeos.la libtool: install: /usr/bin/install -c .libs/libgeos.a /home/davcra/lib/libgeos.a libtool: install: chmod 644 /home/davcra/lib/libgeos.a libtool: install: ranlib /home/davcra/lib/libgeos.a libtool: finish: PATH="/usr/ncl_files/bin:/usr/ncl_files/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/davcra/.local/bin:/home/davcra/bin:/sbin" ldconfig -n /home/davcra/lib ---------------------------------------------------------------------- Libraries have been installed in: /home/davcra/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src' Making install in capi make[1]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' make[2]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib" /bin/sh ../libtool --mode=install /usr/bin/install -c libgeos_c.la '/home/davcra/lib' libtool: install: warning: relinking `libgeos_c.la' libtool: install: (cd /home/davcra/basemap-1.0.2/geos-3.3.1/capi; /bin/sh /home/davcra/basemap-1.0.2/geos-3.3.1/libtool --tag CXX --mode=relink g++ -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -ffloat-store -g -O2 -version-info 8:1:7 -no-undefined -o libgeos_c.la -rpath /home/davcra/lib libgeos_c_la-geos_c.lo libgeos_c_la-geos_ts_c.lo ../src/libgeos.la ) mv: cannot move `libgeos_c.so.1.7.1' to `libgeos_c.so.1.7.1U': Permission denied libtool: install: error: relink `libgeos_c.la' with the above command before installing it make[2]: *** [install-libLTLIBRARIES] Error 1 make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' make[1]: *** [install-am] Error 2 make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi' make: *** [install-recursive] Error 1 any ideas?? thanks D On 3/31/12 5:48 AM, David Craig wrote: > Hi, I previously installed basemap by using the yum command. This > installed version 0.99.4. I want to install the latest version so I > can use shaded relief etc. This may be more of a linux problem but as > I am more familiar with python than linux I thought someone here may > be able to help. > Following the website instructions > (http://matplotlib.github.com/basemap/users/installing.html) I > downloaded the latest version and untarred it. Then in the basemap > directory (which contains geos-3.2.0) I try to set the environment > variable GEOS_DIR to point to the location of libgeos_c and geos_c.h. > I use the find command to locate the files, > /find / -name geos_c.h/ returns the location of that file as > //usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h/ > and > /find / -name libgeos*/ > returns > //libgeos_c_la-geos_c.Plo > /usr/lib/libgeos-3.3.1.so <http://libgeos-3.3.1.so> > /usr/lib/libgeos_c.so.1.7.1 > /usr/lib/libgeos_c.so.1/ > so I set GEOS_DIR to /usr/lib (not sure if this is correct). > I then cd to the basemap directory and run, > python setup.py install > [davcra@... basemap-1.0.1]$ sudo python setup.py install > [sudo] password for davcra: > checking for GEOS lib in /root .... > checking for GEOS lib in /usr .... > checking for GEOS lib in /usr/local .... > checking for GEOS lib in /sw .... > checking for GEOS lib in /opt .... > checking for GEOS lib in /opt/local .... > > Can't find geos library . Please set the > environment variable GEOS_DIR to point to the location > where geos is installed (for example, if geos_c.h > is in /usr/local/include, and libgeos_c is in /usr/local/lib, > set GEOS_DIR to /usr/local), or edit the setup.py script > manually and set the variable GEOS_dir (right after the line > that says "set GEOS_dir manually here". > The problem seems to be with GEOS_DIR but I am not sure what I should > set it to. > Thanks > D David: The basemap setup.py is assuming that the geos library is installed in <GEOS_DIR>/lib, and geos_c.h in <GEOS_DIR>/include. You should set GEOS_DIR to the directory you specified with --prefix when you ran configure for geos 3.2.0 (I think the default is /usr/local). However, it looks like you have a redhat installed geos library in /usr/lib (seems like it is version 3.3.1). You probably could just install the -dev package (which would put the include file in /usr/include), and the basemap setup.py would autodetect it. Also, the latest version of basemap is 1.0.2, not 1.0.1. -Jeff |
From: Jeff W. <jef...@no...> - 2012-04-02 22:23:57
|
On 4/2/12 4:02 PM, Mathew Topper wrote: > On 02/04/12 19:09, Jeff Whitaker wrote: >> >> Mat: I just updated git master to add the 'k_0' keyword when using >> projection='tmerc'. This is the scaling factor along the central >> meridian, and is needed to exactly match the UTM definition. I also >> added a utmtest.py example, that shows how to plot a UTM zone, and >> convert Basemap coordinates to UTM coordinates. >> >> -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 > > Jeff, thanks again for all your help with this. I tried the example > and it works great. My only question would be how to get the axis > labels into meters rather than degrees. Any hints? I have found the > customticks.py example. Is that the best route to take? Mat: Just use 'suppress_ticks=False' when creating the Basemap instance, and you will get axis ticks in meters. If you want to use a custom tick formatter, use the customticks.py example as a guide. -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 |
From: Emmanuel M. <ema...@ya...> - 2012-04-02 22:20:55
|
Well, not sure if that is supported, but I found a way !: [...] self.fig1 = Figure(figsize=(width, height), dpi=dpi) self.fig2 = Figure(figsize=(width, height), dpi=dpi) self.axes1 = self.fig1.add_subplot(223) self.axes2 = self.fig2.add_subplot(221) [...] self.axes2.plot([0,1]) (1) self.axes2.set_figure(self.fig1) (2) self.fig1.add_axes(self.axes2) Note that (1) and (2) are required in that order! From the code above, if I show the fig1, then I see axes1 and axes2 on the figure.... Summary: I created the axes2 independently of fig1 PS: I want to use my axes2 as an object to sent to my Qt widget (a blank figure/canvas) -- Emmanuel ________________________________ From: Eric Firing <ef...@ha...> To: mat...@li... Sent: Sunday, April 1, 2012 1:36 PM Subject: Re: [Matplotlib-users] assigning a plot object to a figure On 03/30/2012 01:23 PM, Emmanuel Mayssat wrote: > Hello all, > > I can create a figure > and get the corresponding axes/plots > > for examples: > 1/ > fig = Figure(figsize=(width, height), dpi=dpi) > ax = gif.add_subplot(111) > > 2/ > fig, ax = plt.subplots() > > but I would like to create my plot independently from the figure and > assign it to a figure > > I code I would like to do something like this > > my_ax = Axes(...) > my_ax.plot(x,y) > > > ax = my_ax > > or > > my_ax.set_figure(fig) > > How can I create the axes/plot object independently from the figure? As far as I can see, you can't. The figure is deeply embedded in the Axes object; that's why the figure is an argument in Axes.__init__(). > Better yet, how can I assign an axe to a figure? I don't think you can. It looks to me like Axes.set_figure should be clearly marked as a private method, not to be used except in Axes.__init__(). Short of a major refactoring of mpl, I think you will need to find some other way of accomplishing your ultimate aim. Eric > -- > Emmanuel ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Mathew T. <mat...@ed...> - 2012-04-02 22:04:27
|
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. |
From: Jeff W. <jef...@no...> - 2012-04-02 18:09:34
|
On 4/2/12 11:23 AM, Jeff Whitaker wrote: > On 4/2/12 10:03 AM, Mathew Topper wrote: >> On 02/04/12 16:21, Jeff Whitaker wrote: >>> On 4/2/12 9:10 AM, Mathew Topper wrote: >>>> Hi, >>>> >>>> I've been trawling round the internet for a while trying to work >>>> out if basemap could be made to plot using a UTM zone projection. >>>> I've found some references to pyproj that could be used to convert >>>> out of a UTM projection, but I haven't found any references to >>>> defining a custom projection for basemap. Is it possible? >>>> >>>> Also, there is not a lot of documentation regarding pyproj and I >>>> find this a little odd considering it comes packaged with basemap. >>>> >>>> Many Thanks, >>>> >>>> Mat >>> >>> >>> Mat: Basemap can plot in the tranverse mercator projection >>> (projecton='tmerc') - UTM zones are transverse mercator with >>> specific lat/lon boundaries and a WGS84 ellipsoid. I suppose I could >>> add UTM zone support if there is enough demand for it. >>> >>> -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 >> >> OK, thanks Jeff. So I just need to know the lon/lat bounds of the >> desired UTM zone and I have effectively created a UTM projection of >> that zone in basemap i.e. for UTM29 we have 12W to 6W. >> Will basemap then except coordinates in meters defined by UTM29 or do >> I have to convert to lon/lat first? > > Mat: If you use projection='tmerc' and then give the lat/lon coords > of the upper right and lower left corners with > llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat, the projection coordinates > will be such that x,y = 0 in the lower left corner. Since those will > not match the UTM coordinates exactly, you will have to add an offset > in x,y to make them match. > > -Jeff Mat: I just updated git master to add the 'k_0' keyword when using projection='tmerc'. This is the scaling factor along the central meridian, and is needed to exactly match the UTM definition. I also added a utmtest.py example, that shows how to plot a UTM zone, and convert Basemap coordinates to UTM coordinates. -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 |
From: Jeff W. <jef...@no...> - 2012-04-02 17:23:28
|
On 4/2/12 10:03 AM, Mathew Topper wrote: > On 02/04/12 16:21, Jeff Whitaker wrote: >> On 4/2/12 9:10 AM, Mathew Topper wrote: >>> Hi, >>> >>> I've been trawling round the internet for a while trying to work out >>> if basemap could be made to plot using a UTM zone projection. I've >>> found some references to pyproj that could be used to convert out of >>> a UTM projection, but I haven't found any references to defining a >>> custom projection for basemap. Is it possible? >>> >>> Also, there is not a lot of documentation regarding pyproj and I >>> find this a little odd considering it comes packaged with basemap. >>> >>> Many Thanks, >>> >>> Mat >> >> >> Mat: Basemap can plot in the tranverse mercator projection >> (projecton='tmerc') - UTM zones are transverse mercator with specific >> lat/lon boundaries and a WGS84 ellipsoid. I suppose I could add UTM >> zone support if there is enough demand for it. >> >> -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 > > OK, thanks Jeff. So I just need to know the lon/lat bounds of the > desired UTM zone and I have effectively created a UTM projection of > that zone in basemap i.e. for UTM29 we have 12W to 6W. > Will basemap then except coordinates in meters defined by UTM29 or do > I have to convert to lon/lat first? Mat: If you use projection='tmerc' and then give the lat/lon coords of the upper right and lower left corners with llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat, the projection coordinates will be such that x,y = 0 in the lower left corner. Since those will not match the UTM coordinates exactly, you will have to add an offset in x,y to make them match. -Jeff > > I have a bit of an interesting case where the region we are examining > lies between UTM29 and UTM30, and I was interested in displaying how > the change in projection effects the topography. > > Thanks > > Mat > -- > Dr. Mathew Topper > Institute for Energy Systems > School of Engineering > The University of Edinburgh > Faraday Building > The King's Buildings > Edinburgh EH9 3JL > Tel: +44 (0)131 650 5570 > School fax: +44 (0)131 650 6554 > mat...@ed... <mailto:mat...@ed...> > http://www.see.ed.ac.uk <http://www.see.ed.ac.uk/> > > > The University of Edinburgh is a charitable body, registered in > Scotland, with registration number SC005336. > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > > > _______________________________________________ > 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: Mathew T. <mat...@ed...> - 2012-04-02 16:09:38
|
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. |
From: Mathew T. <mat...@ed...> - 2012-04-02 16:03:32
|
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. |
From: Jeff W. <jef...@no...> - 2012-04-02 15:21:53
|
On 4/2/12 9:10 AM, Mathew Topper wrote: > Hi, > > I've been trawling round the internet for a while trying to work out > if basemap could be made to plot using a UTM zone projection. I've > found some references to pyproj that could be used to convert out of a > UTM projection, but I haven't found any references to defining a > custom projection for basemap. Is it possible? > > Also, there is not a lot of documentation regarding pyproj and I find > this a little odd considering it comes packaged with basemap. > > Many Thanks, > > Mat Mat: Basemap can plot in the tranverse mercator projection (projecton='tmerc') - UTM zones are transverse mercator with specific lat/lon boundaries and a WGS84 ellipsoid. I suppose I could add UTM zone support if there is enough demand for it. -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 |
From: Mathew T. <mat...@ed...> - 2012-04-02 15:10:55
|
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. |
From: Jeff W. <js...@fa...> - 2012-04-02 02:35:41
|
On 3/31/12 5:48 AM, David Craig wrote: > Hi, I previously installed basemap by using the yum command. This > installed version 0.99.4. I want to install the latest version so I > can use shaded relief etc. This may be more of a linux problem but as > I am more familiar with python than linux I thought someone here may > be able to help. > Following the website instructions > (http://matplotlib.github.com/basemap/users/installing.html) I > downloaded the latest version and untarred it. Then in the basemap > directory (which contains geos-3.2.0) I try to set the environment > variable GEOS_DIR to point to the location of libgeos_c and geos_c.h. > I use the find command to locate the files, > /find / -name geos_c.h/ returns the location of that file as > //usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h/ > and > /find / -name libgeos*/ > returns > //libgeos_c_la-geos_c.Plo > /usr/lib/libgeos-3.3.1.so <http://libgeos-3.3.1.so> > /usr/lib/libgeos_c.so.1.7.1 > /usr/lib/libgeos_c.so.1/ > so I set GEOS_DIR to /usr/lib (not sure if this is correct). > I then cd to the basemap directory and run, > python setup.py install > [davcra@David basemap-1.0.1]$ sudo python setup.py install > [sudo] password for davcra: > checking for GEOS lib in /root .... > checking for GEOS lib in /usr .... > checking for GEOS lib in /usr/local .... > checking for GEOS lib in /sw .... > checking for GEOS lib in /opt .... > checking for GEOS lib in /opt/local .... > > Can't find geos library . Please set the > environment variable GEOS_DIR to point to the location > where geos is installed (for example, if geos_c.h > is in /usr/local/include, and libgeos_c is in /usr/local/lib, > set GEOS_DIR to /usr/local), or edit the setup.py script > manually and set the variable GEOS_dir (right after the line > that says "set GEOS_dir manually here". > The problem seems to be with GEOS_DIR but I am not sure what I should > set it to. > Thanks > D David: The basemap setup.py is assuming that the geos library is installed in <GEOS_DIR>/lib, and geos_c.h in <GEOS_DIR>/include. You should set GEOS_DIR to the directory you specified with --prefix when you ran configure for geos 3.2.0 (I think the default is /usr/local). However, it looks like you have a redhat installed geos library in /usr/lib (seems like it is version 3.3.1). You probably could just install the -dev package (which would put the include file in /usr/include), and the basemap setup.py would autodetect it. Also, the latest version of basemap is 1.0.2, not 1.0.1. -Jeff |
From: Eric F. <ef...@ha...> - 2012-04-01 20:42:02
|
On 03/29/2012 06:29 AM, Chao YUE wrote: > Dear all, > > I make a contourf plot but I think the colorbar is too wide. Can I make > it narrower (slimmer)? > Yes, you can use the aspect kwarg. The default is 20. Try cbar = plt.colorbar(aspect=40) http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.colorbar Eric > plt.contourf(data) > cbar=plt.colorbar() > > ?? > > thanks for any suggestions. > > cheers, > > Chao > > -- > *********************************************************************************** > Chao YUE > Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) > UMR 1572 CEA-CNRS-UVSQ > Batiment 712 - Pe 119 > 91191 GIF Sur YVETTE Cedex > Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 > ************************************************************************************ > > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Eric F. <ef...@ha...> - 2012-04-01 20:37:44
|
On 03/30/2012 01:23 PM, Emmanuel Mayssat wrote: > Hello all, > > I can create a figure > and get the corresponding axes/plots > > for examples: > 1/ > fig = Figure(figsize=(width, height), dpi=dpi) > ax = gif.add_subplot(111) > > 2/ > fig, ax = plt.subplots() > > but I would like to create my plot independently from the figure and > assign it to a figure > > I code I would like to do something like this > > my_ax = Axes(...) > my_ax.plot(x,y) > > > ax = my_ax > > or > > my_ax.set_figure(fig) > > How can I create the axes/plot object independently from the figure? As far as I can see, you can't. The figure is deeply embedded in the Axes object; that's why the figure is an argument in Axes.__init__(). > Better yet, how can I assign an axe to a figure? I don't think you can. It looks to me like Axes.set_figure should be clearly marked as a private method, not to be used except in Axes.__init__(). Short of a major refactoring of mpl, I think you will need to find some other way of accomplishing your ultimate aim. Eric > -- > Emmanuel |
From: Skipper S. <jss...@gm...> - 2012-04-01 20:35:03
|
On Sun, Apr 1, 2012 at 4:23 PM, Skipper Seabold <jss...@gm...> wrote: > Hi, > > I wrote an abline_plot function, and I'm curious if what I'm doing is the > best way to go about this. I tried unsuccessfully to get the transforms to > do what I want, but I'm not sure if it's possible. What I came up with is > to use callbacks to draw an "infinite" line. It works, but it seems a bit > sluggish. Does anyone have any thoughts on improvements, anything I'm > missing, or an alternative implementation? The only problem I see right now > is that it assumes ax only has one ABLine2D child. > > Hmm, it actually seems to handle multiple ablines ok, though I don't know if it's robust. Should ABLine2D take a slope and intercept in its instantiation? > Thanks, > > Skipper > > import numpy as np > from matplotlib.lines import Line2D > import matplotlib.pyplot as plt > > > ### Generate some data > intercept = 1.3 > slope = .5 > x = np.random.random(25) > y_noise = intercept + slope * x + np.random.randn(25) > > ### Set up the plot > > fig = plt.figure() > ax = fig.add_subplot(111) > ax.scatter(x, y_noise) > > class ABLine2D(Line2D): > > def update_datalim(self, ax): > ax.set_autoscale_on(False) > > children = ax.get_children() > abline = [children[i] for i in range(len(children)) > if isinstance(children[i], ABLine2D)][0] > x = ax.get_xlim() > y = [x[0]*slope+intercept, x[1]*slope+intercept] > abline.set_data(x,y) > ax.figure.canvas.draw() > > line = ABLine2D(x, y) > ax.add_line(line) > ax.callbacks.connect('xlim_changed', line.update_datalim) > ax.callbacks.connect('ylim_changed', line.update_datalim) > > plt.show() > |
From: Skipper S. <jss...@gm...> - 2012-04-01 20:24:25
|
Hi, I wrote an abline_plot function, and I'm curious if what I'm doing is the best way to go about this. I tried unsuccessfully to get the transforms to do what I want, but I'm not sure if it's possible. What I came up with is to use callbacks to draw an "infinite" line. It works, but it seems a bit sluggish. Does anyone have any thoughts on improvements, anything I'm missing, or an alternative implementation? The only problem I see right now is that it assumes ax only has one ABLine2D child. Thanks, Skipper import numpy as np from matplotlib.lines import Line2D import matplotlib.pyplot as plt ### Generate some data intercept = 1.3 slope = .5 x = np.random.random(25) y_noise = intercept + slope * x + np.random.randn(25) ### Set up the plot fig = plt.figure() ax = fig.add_subplot(111) ax.scatter(x, y_noise) class ABLine2D(Line2D): def update_datalim(self, ax): ax.set_autoscale_on(False) children = ax.get_children() abline = [children[i] for i in range(len(children)) if isinstance(children[i], ABLine2D)][0] x = ax.get_xlim() y = [x[0]*slope+intercept, x[1]*slope+intercept] abline.set_data(x,y) ax.figure.canvas.draw() line = ABLine2D(x, y) ax.add_line(line) ax.callbacks.connect('xlim_changed', line.update_datalim) ax.callbacks.connect('ylim_changed', line.update_datalim) plt.show() |
From: Eric F. <ef...@ha...> - 2012-04-01 19:48:10
|
On 03/31/2012 07:26 AM, Marston wrote: > Hi, I'm trying to create a plot, with subplots where each row of x plots > have a common colorbar beneath it. Only the the top row will have > titles. I've tried creating a function to do this but I only achieve > partial success. Here is an image created in another program that I want > to duplicate: I made several functions to do this. Here's one of them: > def Plot(self,title,plist): for k in np.sort(self.vdic.keys()): > plt.subplot(5,13,self.window) cs = > plt.contourf(22,22,np.squeeze(self.vdic[k]),plist['levels'], > cmap=cm.get_cmap('jet',len(plist['levels'])-1)) plt.axis('off') if > title: plt.title(k,fontsize=tsize) window += 1 cbar = > plt.colorbar(cax=plist['cax'],orientation='h') I've given up in getting > the text on the left because every attempt using text fails. Now if this > is a horrible way and you have a better idea, please feel free to share. > I'm new at matplotlib and this is a great way to see how things can be > done better and in different ways. The problem is that what you are trying to do is a bit too complicated for the basic pyplot interface and for subplots. The axes_grid toolkit might be helpful, or you may want to calculate the axes positions yourself as in http://matplotlib.sourceforge.net/examples/pylab_examples/multi_image.html. For your text on the left, you can add text to a figure using the same coordinates as you use for specifying axes positions: (0,0) is lower left, (1,1) is upper right. E.g., in "ipython --pylab", fig = plt.figure() ax = fig.add_axes([0.4, 0.45, 0.5, 0.1]) lableft = fig.text(0.1, 0.5, "A Label") plt.draw() #needed only when interactive Eric > ------------------------------------------------------------------------ > View this message in context: Subplot array and colorbar > <http://old.nabble.com/Subplot-array-and-colorbar-tp33544950p33544950.html> > Sent from the matplotlib - users mailing list archive > <http://old.nabble.com/matplotlib---users-f2906.html> at Nabble.com. > > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: David C. <dcd...@gm...> - 2012-04-01 11:35:50
|
Hi, I am trying to use pcolor to visualise three variables. For example if I have a value for z at x and a value for z at y something like [x1, x2, x3] = [z1, z2, z3] and [y1, y2, y3] = [z2, z1, z3]. Then I use meshgrid to create the grid for x and y, X, Y = meshgrid(x, y) the result is two array's of shape (3,3). I then need to reshape Z to use pcolor, which is what I am having trouble with. I know I want a result like, y3 0 0 z3 y2 z1 0 0 y1 0 z2 0 x1 x2 x3 but have no idea how to create it. Anyone able to help?? thanks D |
From: Massimo Di S. <mas...@gm...> - 2012-04-01 10:42:06
|
i modified the code as follow : def bar_plot(data, Yval, datamin=None, datamax=None): """ doc """ x = data[0] y = data[1] # reduce dataset based on min max date if datamin != datamax != None : x = data[0][np.where((data[0]>=datamin) & (data[0]<=datamax))[0]] y = data[1][np.where((data[0]>=datamin) & (data[0]<=datamax))[0]] # index for labeling xp = np.where((y<=0))[0] xn = np.where((y>0))[0] xx = np.where((y>0) | (y<=0))[0] # extract positive and negative values x_p = x[np.where(y>=0)[0]] y_p = y[np.where(y>=0)[0]] x_n = x[np.where(y<0)[0]] y_n = y[np.where(y<0)[0]] # start plotting code fig = plt.figure(figsize=(15,5)) width = 0.7 plt.autoscale(enable=True, axis='both', tight=True) plt.bar(xn, y_n, width, color='blue', lw=2) plt.xticks(xx + (width/1.2), x) plt.autoscale(enable=True, axis='both', tight=True) plt.bar(xp, y_p, width, color='red', lw=2) plt.title(Yval) fig.autofmt_xdate() plt.xlabel("Year") plt.ylabel(Yval) plt.axhline(0, color='black', lw=2) plt.grid(True) Il giorno Mar 31, 2012, alle ore 10:21 PM, Massimo Di Stefano ha scritto: > > Hi All > > i'm bring to do simple bar plot formatting the xlabe as 'date' using a syntax like : fig.autofmt_xdate(bottom=0.1) > but something is wrong in my code, please have you any hints on ghow to proper display the dates (Year) along the x axis > and how to leave a margin on the left and on the right of the plot? (my example has a margin only on the right, while the first bar is adjacent to the Y axis) > > > ### > > import numpy as np > import matplotlib.pyplot as plt > > x = np.array([1969,1970,1971,1972,1973,1974]) > y = np.array([-3,10,23,-4,-5,6]) > data = [x,y] > > print x > print y > > > > > def bar_plot(data, Yval, datamin=None, datamax=None): > """ doc """ > fig = plt.figure() > fig.autofmt_xdate(bottom=0.1) > ax1 = fig.add_subplot(211) > x = data[0] > y = data[1] > if datamin != datamax != None : > x = data[0][np.where((data[0]>=datamin) & (data[0]<=datamax))[0]] > y = data[1][np.where((data[0]>=datamin) & (data[0]<=datamax))[0]] > x_p = x[np.where(y>=0)[0]] > y_p = y[np.where(y>=0)[0]] > x_n = x[np.where(y<0)[0]] > y_n = y[np.where(y<0)[0]] > ax1.bar(x_n, y_n, facecolor='b') > ax1.bar(x_p, y_p, facecolor='r') > ax1.grid(True) > ax1.set_xlabel('Year') > ax1.set_ylabel(Yval) > ax1.set_title(Yval) > ax1.axhline(0, color='black', lw=1) > plt.show() > > bar_plot(data, 'Var', datamin=1970, datamax=1973) > > ### |
From: Joseph M. <me...@as...> - 2012-04-01 03:09:17
|
Thanks Tony, I think this will work! Cheers, Joe On Mar 31, 2012, at 11:33 AM, Tony Yu wrote: > > > On Fri, Mar 30, 2012 at 12:25 PM, eoj <jos...@gm...> wrote: > > Basically the problem is like this. I have a relatively expensive (time wise) > figure to create, specifically a map with lots of detail in it. On top of > that, I'm making an inset set of axes to highlight some regions. I'm having > to recreate the base of the map, which is static, every time I want to make > an inset for a different region which is taking forever. What I want to do > is something like this: > > fig = figure() > > #do stuff that makes the expensive figure > > for region in regions: > fig2 = copy.copy(fig) > ax2 = fig.add_axes([0.1, 0.15, 0.25, 0.25]) > ax2.fill(x1,y1) > savefig(region_name) > close() > > > > The problem is that the clf() clear figure function seems to clear the base > of the map off, even if I try to make a copy of it inside a loop that is > generating the insets. Also, close() seems to close fig and not fig2. Does > this rambling make any sense, and if so, any suggestions? > > > If all your additions are confined to the inset axes, you can use `fig.delaxes` to remove the axes from the figure (see example below). If you want to save and restore, as you describe above, you should (in principal) be able to do so with `canvas.copy_from_bbox` and `canvas.restore_region`, but I couldn't get it to work (see bottom of the animation cookbook). > > Cheers, > -Tony > > # ~~~ example > import numpy as np > import matplotlib.pyplot as plt > > fig, ax = plt.subplots() > ax.imshow(np.random.uniform(size=(10, 10))) > > ax_inset = fig.add_axes([0.3, 0.3, 0.2, 0.2]) > ax_inset.plot([0, 1]) > plt.savefig('plot0') > > fig.delaxes(ax_inset) > ax_inset = fig.add_axes([0.5, 0.5, 0.2, 0.2]) > ax_inset.plot([1, 0]) > plt.savefig('plot1') > # ~~~ > ======================= Joseph D. Meiring Department of Astronomy LGRT 517 University of Massachusetts Amherst MA 01003 ======================= |
From: Massimo Di S. <mas...@gm...> - 2012-04-01 02:21:08
|
Hi All i'm bring to do simple bar plot formatting the xlabe as 'date' using a syntax like : fig.autofmt_xdate(bottom=0.1) but something is wrong in my code, please have you any hints on ghow to proper display the dates (Year) along the x axis and how to leave a margin on the left and on the right of the plot? (my example has a margin only on the right, while the first bar is adjacent to the Y axis) ### import numpy as np import matplotlib.pyplot as plt x = np.array([1969,1970,1971,1972,1973,1974]) y = np.array([-3,10,23,-4,-5,6]) data = [x,y] print x print y def bar_plot(data, Yval, datamin=None, datamax=None): """ doc """ fig = plt.figure() fig.autofmt_xdate(bottom=0.1) ax1 = fig.add_subplot(211) x = data[0] y = data[1] if datamin != datamax != None : x = data[0][np.where((data[0]>=datamin) & (data[0]<=datamax))[0]] y = data[1][np.where((data[0]>=datamin) & (data[0]<=datamax))[0]] x_p = x[np.where(y>=0)[0]] y_p = y[np.where(y>=0)[0]] x_n = x[np.where(y<0)[0]] y_n = y[np.where(y<0)[0]] ax1.bar(x_n, y_n, facecolor='b') ax1.bar(x_p, y_p, facecolor='r') ax1.grid(True) ax1.set_xlabel('Year') ax1.set_ylabel(Yval) ax1.set_title(Yval) ax1.axhline(0, color='black', lw=1) plt.show() bar_plot(data, 'Var', datamin=1970, datamax=1973) ### |