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) |
|
|
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.
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
Since I haven't found an example, that shows howto plot in 3d a cube and pyramid, respectively, I wanted to show how I accomplished this without using vtk or mayavi. Unfortunately, it is a bit of an ugly hack, since as far as i know the plotsurface method cannot directly plot arrays with shape (,x).
Hi How do I increase the distance/padding between the tick labels (numbers) and the axis/axes? Ted
Dear all, I have recently set up a simple tutorial on how to create gui applications with wxPython. One of the examples shows how to embed matplotlib plots in the application. It is only a recompilation of tutorials found on the web, including the matplotlib website, but the example is provided as a template application that can be downloaded and used to spawn plotting applications in minutes. In case you are interested, the tutorial is at www.oneminutepython.com. Best regards, Giancarlo
Hello, How is it possible to increase the space between xticks in the following code: from pylab import * import matplotlib.pyplot as plt y1 = [20, 24, 8, 4, 12, 22, 31, 25, 15, 28, 12, 27, 22, 22, 27, 14, 32, 28, 8, 17, 2, 8, 29, 13, 14, 20, 11, 28, 8] y2= [2, 32, 28, 1, 22, 11, 14, 27, 3, 31, 12, 20, 32, 24, 24, 16, 7, 10, 12, 11, 3, 32, 10, 20, 14, 14, 3, 25, 14] point_labels1 = ['A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1'] point_labels2 = ['B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1', 'B=1'] #fig = plt.figure(figsize=(40,40)) fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('The red point should be on the path') ax.grid(True) maxy = max(max(y1), max(y2)) maxx = max(len(y1), len(y2)) x = range(1,maxx+1) plt.plot(x, y1, '--bo', x, y2, '--go') # rotates and right aligns the x labels, and moves the bottom of the # axes up to make room for them fig.autofmt_xdate() # set x and y labels plt.xticks(range(1, maxx+2, 1)) #ax.set_xticks(4.5) plt.yticks(range(1, maxy+1, 1)) plt.xlabel('Longitude') plt.ylabel('Latitude') plt.legend(('Model length', 'Data length'), 'best', shadow=True, fancybox=True) for i, label in enumerate(y1): plt.text (x[i], y1[i]+0.2, label, horizontalalignment='center', fontsize=8 ) for i, label in enumerate(y2): plt.text (x[i], y2[i]+0.2, label, horizontalalignment='center', fontsize=8 ) plt.savefig('test.png') Thank you in advance.
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 -- View this message in context: http://old.nabble.com/weird-behaviour-in-x-axis-tp29687404p29687404.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On 9/10/2010 5:27 AM, Nils Wagner wrote: > what is needed to save a figure when the size is given in > pixels, i.e. 1024x772 ? > The default is 800x600 pixels. Did you already get an answer? My understanding is that you set the figure size in *inches*, and then by setting its ``dpi`` you determine the number of pixels. (So "inches" are purely virtual, unless you match the ppi of your display/printer.) hth, Alan Isaac
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 Nahum Graduate Student Zentrum für Angewandte Geologie Universität Tübingen --- Imagine there's no countries it isn't hard to do Nothing to kill or die for And no religion too Imagine all the people Living life in peace
2010年9月4日 Thomas Robitaille <tho...@gm...>: > export MACOSX_DEPLOYMENT_TARGET=10.6 > export CFLAGS="-arch i386 -arch x86_64" > export CPPFLAGS="-arch i386 -arch x86_64" > export FFLAGS="-arch i386 -arch x86_64" > export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64" So you're on 10.6? (Because of the DEPLOYMENT_TARGET.) In general, distutils chooses the flags and tweaks them to match the options used when compiling Python. Did you install Python from source, and if yes, maybe with ppc? > ARCH_FLAGS="-arch i386-arch x86_64" I don't know how the ARCH_FLAGS are interpreted. > gcc-4.0 -DNDEBUG -g -O3 -arch i386 -arch x86_64 [...] -isysroot /Developer/SDKs/MacOSX10.6.sdk [...] gcc-4.0? Thought you are on 10.6, there gcc-4.2 is the default. Further, this looks to me like you're using python.org Python, which is indeed gcc-4.0 compiled afaik. Maybe you're even using Apple Python?? (Don't know which compiler this is using.) So far, it's a bit incomplete, and sorry for the huge delay, Friedrich
2010年9月10日 Yannis Haralambous <yan...@te...>: > when I launch the DMG installer matplotlib-1.0.0-python.org-py2.6-macosx10.4.mpkg > I get an error message, that my volume does not contain "System Python 2.6". > I'm running a standard MacOS X 10.6.4 with python 2.6.1 running from /usr/bin > And I do have Python 2.6 installed in > /System/Library/Frameworks/Python.framework/Versions/2.6 > Why does the installer doesn't sees it? Several possible reasons: 1) You installed Python from source. In this case, since the mpl installer checks using the Apple package system (yes, there is actually a package system on Mac!), and installing from source of course does not register with this, the installer wouldn't be able to find the "Python" package. 2) There is a mistake in the matplotlib installer. This happened before already. 3) You're not running Python from the python.org installer, but rather Python from Apple. 4) I noticed that you're using the macosx10.4 installer, but you said you're on 10.6? Libraries on 10.6 are built with gcc-4.2, and the libs from the 10.4 bundle are built certainly with gcc-4.0. In this case it cannot load the gcc-4.2 built libraries. You can try to search the /matplotlib/ threads for this, we had several threads on this before. I remember no issue atm on this list about this not solved. But I may overestimate. You can also keep asking. Btw, where does your freetype2 come from? How did your build find it (i.e., do you have pkg-config or not)? Friedrich
On Sep 11, 2010, at 12:00 PM, Radek Machulka wrote: > Hi Folks, > > I am trying to do something similar to > http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html, > but with a line plots instead of histograms. > My problem is how to set orientation of line plot if there is no > 'orientation' argument (line axHisty.hist(y, bins=bins, > orientation='horizontal') in the example). > > Thanks a lot > Radek Since a line plot doesn't really have an orientation, this might be a lot simpler than you think. If I understand your question, you can just switch your x and y data to get the desired behavior. Continuing the example you link to, just remove the lines that create the histogram (last 4 lines before plt.show) and replace with normal plot commands; for example: bins = np.arange(-lim, lim + binwidth, binwidth) x_hist, _ = np.histogram(x, bins=bins) y_hist, _ = np.histogram(y, bins=bins) x_bin_centers = y_bin_centers = (bins[:-1] + bins[1:])/2. axHistx.plot(x_bin_centers, x_hist) axHisty.plot(y_hist, y_bin_centers) plt.show() The first line above marks the last line in the example script that you should keep. Note that you don't have to use histogram data (x_hist, y_hist); I only do so to simplify the example. Also, x_bin_centers and y_bin_centers are only equal because the scatter data is square. Is this what you were going for? -Tony
Hi Folks, I am trying to do something similar to http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html, but with a line plots instead of histograms. My problem is how to set orientation of line plot if there is no 'orientation' argument (line axHisty.hist(y, bins=bins, orientation='horizontal') in the example). Thanks a lot Radek
On 09/10/2010 10:54 AM, Brian Larsen wrote: > Hello all, > > I feel like this is possible but I am having trouble figuring it out. > > I want to put extra labels on the ticks on the xaxis like in the upper > panel of the figure > http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif > > Following > http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html > doesn't seem to be the right thing. > > It seems that I can get the tick values from > ax= gca() > ax.get_xticks() > > and from here do the calculations on what the other labels should be > (interpolate the spacecraft position). > > but then how do a create another row of labels with the values that > compute? For some reason > ax.get_xmajorticklabels()[0].get_text() returns '' > > Thanks much, > > Brian Brian, Tick labels can have multiple lines, so you don't need extra axes. If you don't mind setting the tick locations yourself, then you can do this: plot([1,2,3]) ax = gca() ax.set_xticks([0,1,2]) ax.set_xticklabels(['abc\nABC', 'def\nDEF\n123', 'qrz']) draw() # or show() if you are not in interactive mode If you need to have the ticks auto-generated using a Locator, then you can write a custom Formatter that does the calculations and generates the multi-line labels. Eric
Hello all, I feel like this is possible but I am having trouble figuring it out. I want to put extra labels on the ticks on the xaxis like in the upper panel of the figure http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif Following http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html doesn't seem to be the right thing. It seems that I can get the tick values from ax= gca() ax.get_xticks() and from here do the calculations on what the other labels should be (interpolate the spacecraft position). but then how do a create another row of labels with the values that compute? For some reason ax.get_xmajorticklabels()[0].get_text() returns '' Thanks much, Brian -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: bal...@la... Correspondence / Technical data or Software Publicly Available
On 9/10/10 11:06 AM, izzybitsie wrote: > Hi, > I'm new to matplotlib and I'm looking for an easy way to plot geographical > data on a background map: bkgmap.png > http://old.nabble.com/file/p29679002/bkgmap.png > So far I only found out about warpimage() to do this but only part of > bkgmap.png comes up in the output image. I think this is because this image > has no pixels covering all the world. > http://old.nabble.com/file/p29679002/partialbkg_polygon.png > > Any idea on how to insert this image as background? > THANKS > > Code: the polygon displays in right position even though background doesn't > show OK (tested with map,lat/lon lines drawn too) > > import sys > import Image, ImageDraw # PIL > from matplotlib.patches import Polygon > from mpl_toolkits.basemap import Basemap > import matplotlib.image as mpimg > import matplotlib.pyplot as plt > import numpy as np > > lat0=48 > lon0=13 > lllon=-15 > lllat=20 > urlon=73 > urlat=57 > map = > Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, > resolution='c',area_thresh=1000.) > map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) > # points > lat = [50.,55.,45.,40.,50.] > lon = [-20.,-10.,10.,-10.,-20.] > x0,y0 = map(lon[0],lat[0]) > x1,y1 = map(lon[1],lat[1]) > x2,y2 = map(lon[2],lat[2]) > x3,y3 = map(lon[3],lat[3]) > x4,y4 = map(lon[4],lat[4]) > plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) > plt.show() Here is an example of how to make this work if the map projection on the image is exactly the same as the map projection in Basemap: import sys import Image, ImageDraw # PIL from matplotlib.patches import Polygon from mpl_toolkits.basemap import Basemap import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np from matplotlib.image import pil_to_array lat0=48 lon0=13 lllon=-15 lllat=20 urlon=73 urlat=57 map =\ Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, resolution='l') #map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) pilImage = Image.open('bkgmap.png') rgba = pil_to_array(pilImage) im = map.imshow(rgba) # points lat = [50.,55.,45.,40.,50.] lon = [-20.,-10.,10.,-10.,-20.] x0,y0 = map(lon[0],lat[0]) x1,y1 = map(lon[1],lat[1]) x2,y2 = map(lon[2],lat[2]) x3,y3 = map(lon[3],lat[3]) x4,y4 = map(lon[4],lat[4]) plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) map.drawmapboundary() map.drawcoastlines() plt.show() Note that the coastlines drawn by drawcoastlines don't match the coastlines in the image (attached png). This means the Basemap projection doesn't match the image projection. Unless you can make them match, you'll have to write your own transformations. Of course, you can't write your own transformation unless you know exactly what the map projection of the image is, so the simplest approach will be to make the Basemap projection match the image. -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
Hi Everyone, First I must cryout a little bit :-) Why colorbar is always so tricky ??? I'm trying to fine tune the colorbar of my contour plots. I would like to do the following things: 1) remove the box around it 2) hide the xticks 3) make the lines with the indicating colors with custom widths so far I succeeded only with task 2 ! here is what I did: cs=axs[4].contour(x,y,phcr1t,linestyles='solid',cmap=cm.jet_r) a=fig.colorbar(cs,ax=axs[4],orientation='horizontal') ticks = a.ax.get_xticklines() #print getp(a.ax) for tick in ticks: setp(tick,alpha=0) Would be great if someone could tell me how to do the 2 other things ... Many thanks -- Oz Nahum Graduate Student Zentrum für Angewandte Geologie Universität Tübingen --- Imagine there's no countries it isn't hard to do Nothing to kill or die for And no religion too Imagine all the people Living life in peace
On Fri, Sep 10, 2010 at 14:46, izzybitsie <is...@ju...> wrote: > I did not understand the need for me to write my own transformation > functions. I only used lat/lon->x/y for the points in the curve and the > polygon shows up OK. What should I write my own transformations for? Because matplotlib (and possibly any other tool out there) have absolutely no idea what transformation have you used to generate your background picture in the first place. If you want to match grid of coordinates of you picture with the grid of coordinates of what you are trying to plot on top of it, you have to input this information somehow. And one possible way of doing this is taking a transformation function which will be exactly the same as one used to generate your background. I do not think there is some other, magical way of doing this. This is not a matplotlib specific problem, it is a general problem. But maybe someone else will correct me if I am wrong. JS
I tested the same plot with a background image in Mercator with same results and I also tested with Mercator covering almost the entire world with the same results. Only a little portion of the background image shows as background although the polygon looks OK in all cases (with maps drawn and with either background image). Unfortunately, I must use the provided background images for my project. I may need to look for some other tool to accomplish drawing curves on a provided background image instead of relying on matplotlib. I did not understand the need for me to write my own transformation functions. I only used lat/lon->x/y for the points in the curve and the polygon shows up OK. What should I write my own transformations for? THANKS izzybitsie wrote: > > Thanks for your answer. I'm actually looking to plot filled curves whose > points are lat/lon points on top of a given background map. The problem > experienced is misrepresentation of background map when I insert it using > warpimage(), the only function to do this I found so far. > > > Aman Thakral wrote: >> >> If you're just looking for points, you can use ax.scatter(). It will >> plot >> the points. Also, make sure you set the zorder keyword argument in the >> scatter. >> >> Example: >> x=range(10) >> y=range(10) >> z=range(10,20) >> ax.scatter(x,y,c=z,zorder=10) >> >> Hope this helps, >> Aman >> >> On Fri, Sep 10, 2010 at 1:06 PM, izzybitsie <is...@ju...> wrote: >> >>> >>> Hi, >>> I'm new to matplotlib and I'm looking for an easy way to plot >>> geographical >>> data on a background map: bkgmap.png >>> http://old.nabble.com/file/p29679002/bkgmap.png >>> So far I only found out about warpimage() to do this but only part of >>> bkgmap.png comes up in the output image. I think this is because this >>> image >>> has no pixels covering all the world. >>> http://old.nabble.com/file/p29679002/partialbkg_polygon.png >>> >>> Any idea on how to insert this image as background? >>> THANKS >>> >>> Code: the polygon displays in right position even though background >>> doesn't >>> show OK (tested with map,lat/lon lines drawn too) >>> >>> import sys >>> import Image, ImageDraw # PIL >>> from matplotlib.patches import Polygon >>> from mpl_toolkits.basemap import Basemap >>> import matplotlib.image as mpimg >>> import matplotlib.pyplot as plt >>> import numpy as np >>> >>> lat0=48 >>> lon0=13 >>> lllon=-15 >>> lllat=20 >>> urlon=73 >>> urlat=57 >>> map = >>> >>> Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, >>> resolution='c',area_thresh=1000.) >>> map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) >>> # points >>> lat = [50.,55.,45.,40.,50.] >>> lon = [-20.,-10.,10.,-10.,-20.] >>> x0,y0 = map(lon[0],lat[0]) >>> x1,y1 = map(lon[1],lat[1]) >>> x2,y2 = map(lon[2],lat[2]) >>> x3,y3 = map(lon[3],lat[3]) >>> x4,y4 = map(lon[4],lat[4]) >>> >>> plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) >>> plt.show() >>> -- >>> View this message in context: >>> http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html >>> Sent from the matplotlib - users mailing list archive at Nabble.com. >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> 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 >>> >> >> >> >> -- >> Aman Thakral >> B.Eng & Biosci, M.Eng Design >> >> ------------------------------------------------------------------------------ >> 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/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679934.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Hi, documentation of mpl_toolkits.basemap.warpimage (http://matplotlib.sourceforge.net/basemap/doc/html/api/basemap_api.html#mpl_toolkits.basemap.Basemap.warpimage) states that it could only be used with a very specific set of images: "Specified image must have pixels covering the whole globe in a regular lat/lon grid, starting and -180W and the South Pole.", so your image won't work - it is curved, there is no obvious (linear) transformation from (x,y) to (lat, long). Examples of good images are given here: http://earthobservatory.nasa.gov/Features/BlueMarble/BlueMarble_monthlies.php There are easy ways to mimic your picture with native Basemap tools, like in this examples: http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html But if you would specifically use your own image, the only way I see is to come up with a transformation function transforming lat and long coordinates to x,y coordinates of your specific picture. If you would write such a function yourself than you could easily use ax.plot, ax.scatter or any other plotting routine to place stuff in correct place in respect to your picture. Giving (lat, long) of stuff you would like to draw, than transforming to (x,y) with the function, and than using those with plotting routines at the same axis you have place your picture, with for example imshow routine with proper zorder. Hope this clears a problem a little bit, JS On Fri, Sep 10, 2010 at 13:06, izzybitsie <is...@ju...> wrote: > > Hi, > I'm new to matplotlib and I'm looking for an easy way to plot geographical > data on a background map: bkgmap.png > http://old.nabble.com/file/p29679002/bkgmap.png > So far I only found out about warpimage() to do this but only part of > bkgmap.png comes up in the output image. I think this is because this image > has no pixels covering all the world. > http://old.nabble.com/file/p29679002/partialbkg_polygon.png > > Any idea on how to insert this image as background? > THANKS > > Code: the polygon displays in right position even though background doesn't > show OK (tested with map,lat/lon lines drawn too) > > import sys > import Image, ImageDraw # PIL > from matplotlib.patches import Polygon > from mpl_toolkits.basemap import Basemap > import matplotlib.image as mpimg > import matplotlib.pyplot as plt > import numpy as np > > lat0=48 > lon0=13 > lllon=-15 > lllat=20 > urlon=73 > urlat=57 > map = > Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, > resolution='c',area_thresh=1000.) > map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) > # points > lat = [50.,55.,45.,40.,50.] > lon = [-20.,-10.,10.,-10.,-20.] > x0,y0 = map(lon[0],lat[0]) > x1,y1 = map(lon[1],lat[1]) > x2,y2 = map(lon[2],lat[2]) > x3,y3 = map(lon[3],lat[3]) > x4,y4 = map(lon[4],lat[4]) > plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) > plt.show() > -- > View this message in context: http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > 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 >
Thanks for your answer. I'm actually looking to plot filled curves whose points are lat/lon points on top of a given background map. The problem experienced is misrepresentation of background map when I insert it using warpimage(), the only function to do this I found so far. Aman Thakral wrote: > > If you're just looking for points, you can use ax.scatter(). It will plot > the points. Also, make sure you set the zorder keyword argument in the > scatter. > > Example: > x=range(10) > y=range(10) > z=range(10,20) > ax.scatter(x,y,c=z,zorder=10) > > Hope this helps, > Aman > > On Fri, Sep 10, 2010 at 1:06 PM, izzybitsie <is...@ju...> wrote: > >> >> Hi, >> I'm new to matplotlib and I'm looking for an easy way to plot >> geographical >> data on a background map: bkgmap.png >> http://old.nabble.com/file/p29679002/bkgmap.png >> So far I only found out about warpimage() to do this but only part of >> bkgmap.png comes up in the output image. I think this is because this >> image >> has no pixels covering all the world. >> http://old.nabble.com/file/p29679002/partialbkg_polygon.png >> >> Any idea on how to insert this image as background? >> THANKS >> >> Code: the polygon displays in right position even though background >> doesn't >> show OK (tested with map,lat/lon lines drawn too) >> >> import sys >> import Image, ImageDraw # PIL >> from matplotlib.patches import Polygon >> from mpl_toolkits.basemap import Basemap >> import matplotlib.image as mpimg >> import matplotlib.pyplot as plt >> import numpy as np >> >> lat0=48 >> lon0=13 >> lllon=-15 >> lllat=20 >> urlon=73 >> urlat=57 >> map = >> >> Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, >> resolution='c',area_thresh=1000.) >> map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) >> # points >> lat = [50.,55.,45.,40.,50.] >> lon = [-20.,-10.,10.,-10.,-20.] >> x0,y0 = map(lon[0],lat[0]) >> x1,y1 = map(lon[1],lat[1]) >> x2,y2 = map(lon[2],lat[2]) >> x3,y3 = map(lon[3],lat[3]) >> x4,y4 = map(lon[4],lat[4]) >> >> plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) >> plt.show() >> -- >> View this message in context: >> http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> >> ------------------------------------------------------------------------------ >> 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 >> > > > > -- > Aman Thakral > B.Eng & Biosci, M.Eng Design > > ------------------------------------------------------------------------------ > 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/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679748.html Sent from the matplotlib - users mailing list archive at Nabble.com.