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
(9) |
4
(3) |
5
(2) |
6
(6) |
7
(12) |
8
(21) |
9
(4) |
10
(19) |
11
(7) |
12
(2) |
13
(28) |
14
(13) |
15
(27) |
16
(17) |
17
(21) |
18
(22) |
19
(3) |
20
(25) |
21
(17) |
22
(16) |
23
(28) |
24
(19) |
25
(4) |
26
(4) |
27
(23) |
28
(13) |
29
(15) |
30
(19) |
|
|
On 09/13/2010 12:08 PM, Virgil Stokes wrote: > On 2010年09月13日 21:55, Benjamin Root wrote: >> On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes <vs...@it... >> <mailto:vs...@it...>> wrote: >> >> I have tried to produce a very simple plot with my recent >> installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) >> using the following code (taken from the matplotlib tutorial >> material). >> >> *import matplotlib >> import numpy >> import matplotlib.pyplot as plt >> >> print matplotlib.__version__ >> print numpy.__version__ >> >> plt.plot([1,2,3,4]) >> plt.ylabel('some numbers') >> plt.show()* >> >> If I execute this in Windows 7 (64-bit) it works correctly. If I >> execute this in Windows Vista (32-bit) it works correctly. >> If I execute this in Ubuntu 10.04 64-bit the versions are printed >> out correctly and thus I believe that the packages are being >> imported; but, /no plot is produced!/ >> >> Why not? >> >> >> Virgil, >> >> Did you build matplotlib from source? > I did try this and believe that it succeeded (saw no errors displayed > during the build). >> If so, then chances are that one or more backends were not built >> properly. > But, I do not understand what you mean here... >> This typically happens if you do not have all the build dependencies. > And what can I do to correct this? >> >> Note, the build will not necessarily fail if some dependencies are >> missing because the core portions of matplotlib still build successfully. > Sorry Ben, bu I do not understand what you mean here. > Would you please explain how I can use some combination of the following > (with Python 2.6 on Ubuntu 10.04 both 64-bit) to get a working > matplotlib and numpy. > > * *python-numpy_1.4.1-4_amd64.deb* > * *python-numpy_1.5.0-1ppa1_amd64.deb* > * *numpy-1.5.0.tar.gz* > > and, > > * *matplotlib_0.99.3-1ubuntu1.debian.tar.gz* > * *matplotlib_0.99.3.orig.tar.gz* > * *matplotlib-1.0.0.tar.gz* > > This has become such a frustrating task that I would settle for vers. > 0.99.3 of matplotlib and/or vers. 1.4.1-4 of numpy. I thought I > understood Python and Ubuntu 10.04 enough to accomplish this task; but, > obviously this was not the case. And I have looked at the FAQs and help > given at matplotlib's homepage. If you would like up-to-date versions of both numpy and matplotlib, then you can either find and install the *dev packages individually, or do something like this: sudo apt-get build-dep python-matplotlib sudo apt-get remove python Now untar your numpy, go in, build and install: setup.py build sudo setup.py install And last, do the same for matplotlib, preferably with a checkout from svn. Some bugs have been fixed since the last release. Before all of this, you might do well to uninstall whatever versions or parts of numpy and matplotlib had been installed via your previous efforts. The point of the first apt-get is to install things like freetype and the gui toolkits. The only problem is that this also installs an old version of numpy, hence the second apt-get command. The good news is that once you get over the hump of having the dependencies installed, subsequent updates and compilations of numpy and matplotlib are easy. It is usually advisable to delete the build directory, since setup.py is not very smart with respect to knowing what needs to be recompiled. Sometimes it is also necessary to clean out the old version from its installation location. See attached script for an example of mpl uninstallation. Eric
On 09/11/2010 11:12 AM, freeeeeekk wrote: > > Im trying to do a very simple x vs y plot. Where the x values range between > 3247 and 3256 and y between 0 and 1. This data is stored in data.dat. I plot > it using the code below, the resulting plot is shown in the first of the two > plots below. Everything goes well except for the x axis, for some reason > tickmarks from 0 up to 9 appear. At the far end of the axis my xmin is > printed: 3.247e3. > I started looking for the cause and it turns out that as long as my range in > x is lower than 10, this happens. If I change the xlimits to xlim(3246,3256) > I get the plot at the bottom of this page, everything is fine. But if I > change this to for instance xlim(3246.01,3256) or xlim(3245, 3254.99) I get > the same behaviour as in the first graph. > > Does any one have any experience with this/ know the reason for this > happening? Thanks! > > from numpy import * > from pylab import * > > datafile = mlab.load('./data.dat') > xx=datafile[:,0] > yy=datafile[:,1] > > plot(xx,yy,'black') > xlim(3247,3256) > ylim(0,1.2) with older mpl, try this: gca().xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) with 1.0 or later try the following instead: ticklabel_format(useOffset=False) Eric > > show() > > > http://old.nabble.com/file/p29687404/wrong.png > http://old.nabble.com/file/p29687404/right.png
The solution incase anyone has a similar issue... data = np.random.randint(0,50,100*100).reshape(100, 100) m = Basemap(llcrnrlon=1.5, llcrnrlat=10.5, urcrnrlon=3.5, urcrnrlat=13.5, resolution='c', projection='cyl') fig = plt.figure(figsize=(8, 6)) ax = fig.add_axes([0.1, 0.1, 0.6, 0.7]) m.ax = ax ticks = [0, 10, 20, 30, 40, 50] colours = cm.Greys_r(np.linspace(0.3, 1.0, 6)) colourmap = colors.ListedColormap(colours) norm = colors.BoundaryNorm(ticks, colourmap.N) im = m.imshow(data, cmap=colourmap, norm=norm, interpolation='nearest') pos = ax.get_position() l, b, w, h = pos.bounds cax = plt.axes([l+w+0.045, b, 0.05, h]) cbar = mpl.colorbar.ColorbarBase(cax, cmap=colourmap, norm=norm, ticks=ticks) plt.show() -- View this message in context: http://old.nabble.com/Exclude-colour-from-a-colourbar-tp29699746p29703615.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Many thanks, that helper. After some more problems with scipy, I got a working EXE. PyQt4 is still in the library, though. Eating almost 15Mb... Now all I have to do is to find out how to remove it.. cheers Carlos On Mon, Sep 13, 2010 at 18:47, Goyo <goy...@gm...> wrote: > 2010年9月13日 Carlos Grohmann <car...@gm...>: >> Hello all, >> >> I'm trying to build an executable distribution of an app I'm working >> using py2exe. >> >> After a lot of googling, I found what it seems to be a good >> combination of parameters, but when I try to run the .exe, it fails. >> >> The .log file shows me that the module backend_qt4agg wasn't found: >> >>> ImportError: No module named backend_qt4agg >> >> Also, using py2exe -x shows me that PyQt4 is being imported by >> matplotlib.pyplot. >> >> The thing is, this is a WxPython application. >> >> Why is pyplot importing pyqt?? How do I stop it? > > Maybe it's specified in the matplotlib.rc. > Make sure your intended backend is in use *before* you import pyplot: > > import matplotlib as mpl > mpl.use('WXAgg') > import pyplot as plt > -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 ________________ Can’t stop the signal.
On 2010年09月13日 21:55, Benjamin Root wrote: > On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes <vs...@it... > <mailto:vs...@it...>> wrote: > > I have tried to produce a very simple plot with my recent > installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) > using the following code (taken from the matplotlib tutorial > material). > > *import matplotlib > import numpy > import matplotlib.pyplot as plt > > print matplotlib.__version__ > print numpy.__version__ > > plt.plot([1,2,3,4]) > plt.ylabel('some numbers') > plt.show()* > > If I execute this in Windows 7 (64-bit) it works correctly. If I > execute this in Windows Vista (32-bit) it works correctly. > If I execute this in Ubuntu 10.04 64-bit the versions are printed > out correctly and thus I believe that the packages are being > imported; but, /no plot is produced!/ > > Why not? > > > Virgil, > > Did you build matplotlib from source? I did try this and believe that it succeeded (saw no errors displayed during the build). > If so, then chances are that one or more backends were not built > properly. But, I do not understand what you mean here... > This typically happens if you do not have all the build dependencies. And what can I do to correct this? > > Note, the build will not necessarily fail if some dependencies are > missing because the core portions of matplotlib still build successfully. Sorry Ben, bu I do not understand what you mean here. Would you please explain how I can use some combination of the following (with Python 2.6 on Ubuntu 10.04 both 64-bit) to get a working matplotlib and numpy. * *python-numpy_1.4.1-4_amd64.deb* * *python-numpy_1.5.0-1ppa1_amd64.deb* * *numpy-1.5.0.tar.gz* and, * *matplotlib_0.99.3-1ubuntu1.debian.tar.gz* * *matplotlib_0.99.3.orig.tar.gz* * *matplotlib-1.0.0.tar.gz* This has become such a frustrating task that I would settle for vers. 0.99.3 of matplotlib and/or vers. 1.4.1-4 of numpy. I thought I understood Python and Ubuntu 10.04 enough to accomplish this task; but, obviously this was not the case. And I have looked at the FAQs and help given at matplotlib's homepage. --V
On 9/11/2010 3:10 PM, Oz Nahum wrote: > my question, how to remove the axes around the colorbar, or at least changed the to be non-visible, still stands... Did you resolve this? Alan Isaac
On Sat, Sep 11, 2010 at 2:10 PM, Oz Nahum <na...@gm...> wrote: > Hi Everyone again, > > So, with the weekend comes some time to think and I found an answer to > another question of mine. > > I know now how to remove xticks in colorbar, and I also know how to > customize the widths of the lines in the color bar. > > import matplotlib > import numpy as np > import matplotlib.cm as cm > import matplotlib.mlab as mlab > import matplotlib.pyplot as plt > from pylab import * > > matplotlib.rcParams['xtick.direction'] = 'out' > matplotlib.rcParams['ytick.direction'] = 'out' > > delta = 0.025 > x = np.arange(-3.0, 3.0, delta) > y = np.arange(-2.0, 2.0, delta) > X, Y = np.meshgrid(x, y) > Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) > Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) > # difference of Gaussians > Z = 10.0 * (Z2 - Z1) > > > > # Create a simple contour plot with labels using default colors. The > # inline argument to clabel will control whether the labels are draw > # over the line segments of the contour, removing the lines beneath > # the label > plt.figure() > CS = plt.contour(X, Y, Z) > plt.clabel(CS, inline=1, fontsize=10,inlinespacing=50) > a=plt.colorbar() > > ticks = a.ax.get_xticklines() > lines = a.ax.get_ygridlines() > children=a.ax.get_children() > > children=a.ax.get_children() > > children[4].set_linewidths([12,12,12,12,12,12]) > > for tick in ticks: > setp(tick, []) > > > plt.title('Customize colorbar') > > > I hope someone finds that useful. And someone is still following my > monologue, my question, how to remove the axes around the colorbar, or at > least changed the to be non-visible, still stands... > > Thanks, > > Oz > > Oz, I agree, Colorbar isn't the most elegant of objects and is probably due for some improvements. I am sure there is probably a better way to do what you have done, but I am not familiar with it. Anyway, to get rid of the box around the colorbar, the colorbar object has a member attribute called "outline" which you can set_visible(False). a = plt.colorbar() a.outline.set_visible(False) Should do the trick for that part. I hope this helps! Ben Root
On Sat, Sep 11, 2010 at 6:57 PM, freeeeeekk <fre...@gm...> wrote: > > Im trying to do a very simple x vs y plot. Where the x values range between > 3247 and 3256 and y between 0 and 1. This data is stored in data.dat. I > plot > it using the code below, the resulting plot is shown in the first of the > two > plots below. Everything goes well except for the x axis, for some reason > tickmarks from 0 up to 9 appear. At the far end of the axis my xmin is > printed: 3.247e3. > I started looking for the cause and it turns out that as long as my range > in > x is lower than 10, this happens. If I change the xlimits to > xlim(3246,3256) > I get the plot at the bottom of this page, everything is fine. But if I > change this to for instance xlim(3246.01,3256) or xlim(3245, 3254.99) I get > the same behaviour as in the first graph. > > Does any one have any experience with this/ know the reason for this > happening? Thanks! > > from numpy import * > from pylab import * > > datafile = mlab.load('./data.dat') > xx=datafile[:,0] > yy=datafile[:,1] > > plot(xx,yy,'black') > xlim(3247,3256) > ylim(0,1.2) > > show() > > > http://old.nabble.com/file/p29687404/wrong.png > http://old.nabble.com/file/p29687404/right.png > What is happening isn't a bug, it is a feature, although it probably could be done a little bit better. When the range of values to display for ticks is fairly small compared to the size of the values, then matplotlib displays only the part that changes as a value relative to some constant offset. In your case, the constant offset is the +3.247e3 on the right hand side of the axis. This can also happen for the y-axis as well. This is similar to the idea of how matplotlib would display very large numbers like range(1e7, 10e7, 1e7) as "1 2 3 4 5 6 7 8 9" with a 1e7 at the end of the axis. I hope this makes sense. Ben Root
So far I have tried this... colourmap = cm.get_cmap("Greys_r") colourmap = colourmap._segmentdata # exclude 0, 0, 0...i.e. black from dictionary bvals = colourmap['blue'][1:] gvals = colourmap['green'][1:] rvals = colourmap['red'][1:] colourmap = { "blue":bvals, "green":gvals, "red":rvals } colourmap = cm.set_cmap(colourmap) But it doesn't seem to like the set_cmap command colourmap = cm.set_cmap(colourmap) AttributeError: 'module' object has no attribute 'set_cmap' So I guess that isn't the way, nor I suspect is that all that elegant. Martin mdekauwe wrote: > > Hi, > > I am setting a colourbar where I explictly set the tick intervals. However > I would like to exclude the colour black from this colourbar. The reason > for this is I would like to overplot some contour lines in black, so would > like to make them stand out. > > An example...where I would like to exclude black as the bottom colour of > the colourbar, i.e. use the next level of gray. > > import numpy as np > from mpl_toolkits.basemap import Basemap > import matplotlib.pyplot as plt > import matplotlib.colors as colors > import matplotlib as mpl > > data = np.random.randint(0,50,100*100).reshape(100, 100) > m = Basemap(llcrnrlon=1.5, llcrnrlat=10.5, urcrnrlon=3.5, urcrnrlat=13.5, > resolution='c', projection='cyl') > fig = plt.figure(figsize=(8, 6)) > ax = fig.add_axes([0.1, 0.1, 0.6, 0.7]) > m.ax = ax > > colourmap = plt.cm.Greys_r > ticks = [0, 10, 20, 30, 40, 50] > norm = colors.BoundaryNorm(ticks, colourmap.N) > im = m.imshow(data, colourmap, norm=norm, interpolation='nearest') > pos = ax.get_position() > l, b, w, h = pos.bounds > cax = plt.axes([l+w+0.045, b, 0.05, h]) > cbar = mpl.colorbar.ColorbarBase(cax, cmap=colourmap, norm=norm, > ticks=ticks) > plt.show() > > Many thanks, > > Martin > -- View this message in context: http://old.nabble.com/Exclude-colour-from-a-colourbar-tp29699746p29702394.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Mon, Sep 13, 2010 at 2:38 PM, Virgil Stokes <vs...@it...> wrote: > I have tried to produce a very simple plot with my recent installation of > matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code > (taken from the matplotlib tutorial material). > > *import matplotlib > import numpy > import matplotlib.pyplot as plt > > print matplotlib.__version__ > print numpy.__version__ > > plt.plot([1,2,3,4]) > plt.ylabel('some numbers') > plt.show()* > > If I execute this in Windows 7 (64-bit) it works correctly. If I execute > this in Windows Vista (32-bit) it works correctly. > If I execute this in Ubuntu 10.04 64-bit the versions are printed out > correctly and thus I believe that the packages are being imported; but, *no > plot is produced!* > > Why not? > > Virgil, Did you build matplotlib from source? If so, then chances are that one or more backends were not built properly. This typically happens if you do not have all the build dependencies. Note, the build will not necessarily fail if some dependencies are missing because the core portions of matplotlib still build successfully. Ben Root
On 9/13/10 1:38 PM, Virgil Stokes wrote: > I have tried to produce a very simple plot with my recent installation > of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the > following code (taken from the matplotlib tutorial material). > > *import matplotlib > import numpy > import matplotlib.pyplot as plt > > print matplotlib.__version__ > print numpy.__version__ > > plt.plot([1,2,3,4]) > plt.ylabel('some numbers') > plt.show()* > > If I execute this in Windows 7 (64-bit) it works correctly. If I > execute this in Windows Vista (32-bit) it works correctly. > If I execute this in Ubuntu 10.04 64-bit the versions are printed out > correctly and thus I believe that the packages are being imported; > but, /no plot is produced!/ > > Why not? > Virgil: Probably your default backend on Ubuntu is a non-gui backend (like Agg). See http://matplotlib.sourceforge.net/faq/installing_faq.html#backends for the definition of a "backend" and how to change the default. -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
I have tried to produce a very simple plot with my recent installation of matplotlib (1.0.0 64-bit) and numpy (1.5.0 64-bit) using the following code (taken from the matplotlib tutorial material). *import matplotlib import numpy import matplotlib.pyplot as plt print matplotlib.__version__ print numpy.__version__ plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show()* If I execute this in Windows 7 (64-bit) it works correctly. If I execute this in Windows Vista (32-bit) it works correctly. If I execute this in Ubuntu 10.04 64-bit the versions are printed out correctly and thus I believe that the packages are being imported; but, /no plot is produced!/ Why not?
Hello all, I'm trying to build an executable distribution of an app I'm working using py2exe. After a lot of googling, I found what it seems to be a good combination of parameters, but when I try to run the .exe, it fails. The .log file shows me that the module backend_qt4agg wasn't found: > ImportError: No module named backend_qt4agg Also, using py2exe -x shows me that PyQt4 is being imported by matplotlib.pyplot. The thing is, this is a WxPython application. Why is pyplot importing pyqt?? How do I stop it? thanks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 ________________ Can’t stop the signal.
On Mon, Sep 13, 2010 at 9:23 AM, Jeff Whitaker <js...@fa...> wrote: > Martin: > > You need a meshgrid > > x,y = np.meshgrid(x,y) > > just *before* (not after) > > px,py = m(x,y) > > so that x and y have the same shape as data2. Yeah, my bad. That's what I get for responding *before* coffee this morning. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma
Hi, I am setting a colourbar where I explictly set the tick intervals. However I would like to exclude the colour black from this colourbar. The reason for this is I would like to overplot some contour lines in black, so would like to make them stand out. An example...where I would like to exclude black as the bottom colour of the colourbar, i.e. use the next level of gray. import numpy as np from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib as mpl data = np.random.randint(0,50,100*100).reshape(100, 100) m = Basemap(llcrnrlon=1.5, llcrnrlat=10.5, urcrnrlon=3.5, urcrnrlat=13.5, resolution='c', projection='cyl') fig = plt.figure(figsize=(8, 6)) ax = fig.add_axes([0.1, 0.1, 0.6, 0.7]) m.ax = ax colourmap = plt.cm.Greys_r ticks = [0, 10, 20, 30, 40, 50] norm = colors.BoundaryNorm(ticks, colourmap.N) im = m.imshow(data, colourmap, norm=norm, interpolation='nearest') pos = ax.get_position() l, b, w, h = pos.bounds cax = plt.axes([l+w+0.045, b, 0.05, h]) cbar = mpl.colorbar.ColorbarBase(cax, cmap=colourmap, norm=norm, ticks=ticks) plt.show() Many thanks, Martin -- View this message in context: http://old.nabble.com/Exclude-colour-from-a-colourbar-tp29699746p29699746.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Hi! I want to use polar plot and write contour in semi-circle domain.But I can't do so. Here is a part of my code. ----------------------------- from pylab import * from scipy import * fig=figure(figsize=(10,10)) ax=fig.add_axes([0.1,0.1,0.8,0.8],polar=True) axis([0, pi, 0, 1]) show() ---------------------------- I thought that "axis([0,pi,0,1])" make the writing domain semi-circle, but complete circle was written as domain. Does anyone know how I should write? Many thanks, Kenshi -- View this message in context: http://old.nabble.com/contour-plot-in-semi-circle-domain-tp29699332p29699332.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Mon, Sep 13, 2010 at 9:02 AM, mdekauwe <mde...@gm...> wrote: > > Hi, > > Well I tried... > > numrows = 17 > numcols = 16 > ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 > m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, > llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, > resolution='c') > > data2 = np.random.sample((17,16)) > print 'DATA2 shape:', data2.shape > x = np.linspace(-1.74, -1.32, 16) > y = np.linspace(15.15, 15.61, 17) > print 'x shape:', x.shape > print 'y shape:', y.shape > px, py = m(x, y) > > > which gives... > > DATA2 shape: (17, 16) > x shape: (16,) > y shape: (17,) > > So that looks OK. Turns out the error now comes at the line px, py = m(x, > y). So perhaps I am doing the basemap step incorrectly? > > Traceback (most recent call last): > File "./recontour_plot.py", line 83, in <module> > px, py = m(x, y) > File > "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py", > line 823, in __call__ > return self.projtran(x,y,inverse=inverse) > File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py", > line 241, in __call__ > outx,outy = self._proj4(x, y, inverse=inverse) > File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py", > line 193, in __call__ > _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) > File "_proj.pyx", line 56, in _proj.Proj._fwd (src/_proj.c:725) > RuntimeError: Buffer lengths not the same > > Martin, It would be more useful to see what are the shapes of px, py, X, and Y. Ben Root
Hi Jeff, many thanks that was exactly the problem! Martin Jeff Whitaker wrote: > > On 9/13/10 8:02 AM, mdekauwe wrote: >> Hi, >> >> Well I tried... >> >> numrows = 17 >> numcols = 16 >> ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 >> m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, >> llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, >> resolution='c') >> >> data2 = np.random.sample((17,16)) >> print 'DATA2 shape:', data2.shape >> x = np.linspace(-1.74, -1.32, 16) >> y = np.linspace(15.15, 15.61, 17) >> print 'x shape:', x.shape >> print 'y shape:', y.shape >> px, py = m(x, y) >> >> >> which gives... >> >> DATA2 shape: (17, 16) >> x shape: (16,) >> y shape: (17,) >> >> So that looks OK. Turns out the error now comes at the line px, py = m(x, >> y). So perhaps I am doing the basemap step incorrectly? >> >> Traceback (most recent call last): >> File "./recontour_plot.py", line 83, in<module> >> px, py = m(x, y) >> File >> "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py", >> line 823, in __call__ >> return self.projtran(x,y,inverse=inverse) >> File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py", >> line 241, in __call__ >> outx,outy = self._proj4(x, y, inverse=inverse) >> File >> "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py", >> line 193, in __call__ >> _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) >> File "_proj.pyx", line 56, in _proj.Proj._fwd (src/_proj.c:725) >> RuntimeError: Buffer lengths not the same >> >> > Martin: > > You need a meshgrid > > x,y = np.meshgrid(x,y) > > just *before* (not after) > > px,py = m(x,y) > > so that x and y have the same shape as data2. > > -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 > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29699166.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On 9/13/10 8:02 AM, mdekauwe wrote: > Hi, > > Well I tried... > > numrows = 17 > numcols = 16 > ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 > m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, > llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, > resolution='c') > > data2 = np.random.sample((17,16)) > print 'DATA2 shape:', data2.shape > x = np.linspace(-1.74, -1.32, 16) > y = np.linspace(15.15, 15.61, 17) > print 'x shape:', x.shape > print 'y shape:', y.shape > px, py = m(x, y) > > > which gives... > > DATA2 shape: (17, 16) > x shape: (16,) > y shape: (17,) > > So that looks OK. Turns out the error now comes at the line px, py = m(x, > y). So perhaps I am doing the basemap step incorrectly? > > Traceback (most recent call last): > File "./recontour_plot.py", line 83, in<module> > px, py = m(x, y) > File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py", > line 823, in __call__ > return self.projtran(x,y,inverse=inverse) > File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py", > line 241, in __call__ > outx,outy = self._proj4(x, y, inverse=inverse) > File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py", > line 193, in __call__ > _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) > File "_proj.pyx", line 56, in _proj.Proj._fwd (src/_proj.c:725) > RuntimeError: Buffer lengths not the same > > Martin: You need a meshgrid x,y = np.meshgrid(x,y) just *before* (not after) px,py = m(x,y) so that x and y have the same shape as data2. -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
Thanks Alan. working nicely now. Ted On 13 September 2010 13:27, Alan G Isaac <ala...@gm...> wrote: > On 9/13/2010 6:46 AM, Ted Kord wrote: > > How do I increase the distance/padding between the tick labels (numbers) > and the axis/axes? > > > http://matplotlib.sourceforge.net/users/customizing.html#customizing-matplotlib > (see the pad options) > > hth, > Alan Isaac > > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Hi, Well I tried... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) print 'DATA2 shape:', data2.shape x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) print 'x shape:', x.shape print 'y shape:', y.shape px, py = m(x, y) which gives... DATA2 shape: (17, 16) x shape: (16,) y shape: (17,) So that looks OK. Turns out the error now comes at the line px, py = m(x, y). So perhaps I am doing the basemap step incorrectly? Traceback (most recent call last): File "./recontour_plot.py", line 83, in <module> px, py = m(x, y) File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py", line 823, in __call__ return self.projtran(x,y,inverse=inverse) File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py", line 241, in __call__ outx,outy = self._proj4(x, y, inverse=inverse) File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py", line 193, in __call__ _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) File "_proj.pyx", line 56, in _proj.Proj._fwd (src/_proj.c:725) RuntimeError: Buffer lengths not the same Benjamin Root-2 wrote: > > On Mon, Sep 13, 2010 at 8:21 AM, mdekauwe <mde...@gm...> wrote: > >> >> Hi, >> >> Well hopefully doing what you suggested correctly... >> >> numrows = 17 >> numcols = 16 >> ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 >> m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, >> llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, >> resolution='c') >> >> data2 = np.random.sample((17,16)) >> x = np.linspace(-1.74, -1.32, 16) >> y = np.linspace(15.15, 15.61, 17) >> px, py = m(x, y) >> X, Y = np.meshgrid(px, py) >> m.contourf(X, Y, data2, colors='black') >> plt.show() >> >> Doesn't seem to work either? >> >> thanks, >> >> Martin >> >> > Martin, > > Double-check the shape of the X and the Y arrays. Make sure they have the > same shape as data2. I would be willing to bet that some of the shapes > got > reversed. > > Ben Root > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29698610.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Mon, Sep 13, 2010 at 8:21 AM, mdekauwe <mde...@gm...> wrote: > > Hi, > > Well hopefully doing what you suggested correctly... > > numrows = 17 > numcols = 16 > ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 > m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, > llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, > resolution='c') > > data2 = np.random.sample((17,16)) > x = np.linspace(-1.74, -1.32, 16) > y = np.linspace(15.15, 15.61, 17) > px, py = m(x, y) > X, Y = np.meshgrid(px, py) > m.contourf(X, Y, data2, colors='black') > plt.show() > > Doesn't seem to work either? > > thanks, > > Martin > > Martin, Double-check the shape of the X and the Y arrays. Make sure they have the same shape as data2. I would be willing to bet that some of the shapes got reversed. Ben Root
Hi, Well hopefully doing what you suggested correctly... numrows = 17 numcols = 16 ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) px, py = m(x, y) X, Y = np.meshgrid(px, py) m.contourf(X, Y, data2, colors='black') plt.show() Doesn't seem to work either? thanks, Martin Ryan May-3 wrote: > > On Mon, Sep 13, 2010 at 7:45 AM, mdekauwe <mde...@gm...> wrote: >> >> Hi, >> >> If I set up a random example and plot it as a contour it seems to work >> fine...e.g. >> >> import matplotlb.pyplot as plt >> import numpy as np >> >> data2 = np.random.sample((17,16)) >> x = np.linspace(-1.74, -1.32, 16) >> y = np.linspace(15.15, 15.61, 17) >> X, Y = np.meshgrid(x, y) >> plt.contour(X, Y, data2, colors='black') >> plt.show() >> >> However if instead I try use a basemap projection to do the contouring I >> run >> into trouble. For example... >> >> import numpy as np >> from mpl_toolkits.basemap import Basemap >> >> ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 >> m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, >> llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, >> resolution='c') >> >> data2 = np.random.sample((17,16)) >> x = np.linspace(-1.74, -1.32, 16) >> y = np.linspace(15.15, 15.61, 17) >> X, Y = m(x, y) >> m.contourf(X, Y, data2, colors='black') >> plt.show() > > You replaced the call to meshgrid with a call to the Basemap object. > You need to use both: > > px,py = m(x, y) > X,Y = np.meshgrid(px, py) > > Ryan > > -- > Ryan May > Graduate Research Assistant > School of Meteorology > University of Oklahoma > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29698213.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Mon, Sep 13, 2010 at 7:45 AM, mdekauwe <mde...@gm...> wrote: > > Hi, > > If I set up a random example and plot it as a contour it seems to work > fine...e.g. > > import matplotlb.pyplot as plt > import numpy as np > > data2 = np.random.sample((17,16)) > x = np.linspace(-1.74, -1.32, 16) > y = np.linspace(15.15, 15.61, 17) > X, Y = np.meshgrid(x, y) > plt.contour(X, Y, data2, colors='black') > plt.show() > > However if instead I try use a basemap projection to do the contouring I run > into trouble. For example... > > import numpy as np > from mpl_toolkits.basemap import Basemap > > ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 > m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, > llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, > resolution='c') > > data2 = np.random.sample((17,16)) > x = np.linspace(-1.74, -1.32, 16) > y = np.linspace(15.15, 15.61, 17) > X, Y = m(x, y) > m.contourf(X, Y, data2, colors='black') > plt.show() You replaced the call to meshgrid with a call to the Basemap object. You need to use both: px,py = m(x, y) X,Y = np.meshgrid(px, py) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma
Hi, If I set up a random example and plot it as a contour it seems to work fine...e.g. import matplotlb.pyplot as plt import numpy as np data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = np.meshgrid(x, y) plt.contour(X, Y, data2, colors='black') plt.show() However if instead I try use a basemap projection to do the contouring I run into trouble. For example... import numpy as np from mpl_toolkits.basemap import Basemap ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74 m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='c') data2 = np.random.sample((17,16)) x = np.linspace(-1.74, -1.32, 16) y = np.linspace(15.15, 15.61, 17) X, Y = m(x, y) m.contourf(X, Y, data2, colors='black') plt.show() The errors I am getting are.... x, y = m(lons, lats) File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py", line 823, in __call__ return self.projtran(x,y,inverse=inverse) File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py", line 241, in __call__ outx,outy = self._proj4(x, y, inverse=inverse) File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py", line 193, in __call__ _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck) File "_proj.pyx", line 56, in _proj.Proj._fwd (src/_proj.c:725) RuntimeError: Buffer lengths not the same Many thanks, Martin -- View this message in context: http://old.nabble.com/basemap-and-contouring-tp29697864p29697864.html Sent from the matplotlib - users mailing list archive at Nabble.com.