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
(11) |
2
(24) |
3
(24) |
4
(31) |
5
(30) |
6
(27) |
7
(25) |
8
(8) |
9
(2) |
10
(12) |
11
(16) |
12
(33) |
13
(18) |
14
(17) |
15
(3) |
16
(7) |
17
(8) |
18
(22) |
19
(20) |
20
(25) |
21
(10) |
22
(17) |
23
(18) |
24
(23) |
25
(15) |
26
(19) |
27
(6) |
28
(7) |
29
(6) |
30
(1) |
31
(12) |
|
|
|
|
|
From: Tom V. <to...@so...> - 2009-08-12 20:04:18
|
Great. That worked. Thanks! -Tom On Thu, Jul 16, 2009 at 11:23, Jae-Joon Lee<lee...@gm...> wrote: > One work around is to call > > self.figure.subplots_adjust() > > after geometry changed. After this call, the twinx-ed axes will have > the same axes position as the original one. > > Another option is to use mpl_toolkits.axes_grid > (http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#parasiteaxes). > But the previous solution seems to be much easier for you. > Regards, > > -JJ > > > On Thu, Jul 16, 2009 at 1:16 PM, Tom Vaughan<to...@so...> wrote: >> On Tue, Jun 2, 2009 at 07:33, John Hunter<jd...@gm...> wrote: >>> On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan <to...@so...> wrote: >>>> Is it possible to add subplots to a figure if I don't know in advance >>>> how many subplots I need to add? >>>> >>>> What I do now is I call add_subplot like add_subplot(i, 1, i) where i >>>> is 1 initially, and just increases by 1 on each call. This almost >>>> works. Except the first plot takes up the whole figure, the second >>>> plot is placed on top of the bottom half of the first plot, etc. Is >>>> there a way to "resize" the plots when a subplot is added? Or how >>>> would I "re-plot" the previous subplots? >>> >>> See the Axes.change_geometry command >>> >>> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry >> >> twinx() does not return an axes that contains the change_geometry >> method. How then can I do the equivalent on this axes? Calling twinx() >> again on the original axes after change_geometry() has been called >> does not do the trick. Thanks. >> >> -Tom >> >> ------------------------------------------------------------------------------ >> Enter the BlackBerry Developer Challenge >> This is your chance to win up to $100,000 in prizes! For a limited time, >> vendors submitting new applications to BlackBerry App World(TM) will have >> the opportunity to enter the BlackBerry Developer Challenge. See full prize >> details at: http://p.sf.net/sfu/Challenge >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > -- Website: www.software6.net E-mail/Google Talk: tom (at) software6 (dot) net Mobile: +1 (310) 751-0187 |
From: Uri L. <las...@mi...> - 2009-08-12 19:16:51
|
Hi, I am trying to overlay a few Axes object that need to share axes. I would like it to be the case that if I change the properties of one axis (e.g., scale), the corresponding axis of the other axes will have the properties changed automatically. I was trying to use twinx/twiny, but this behavior failed. After looking at the code, it appears to me that the sharex/sharey parameters to the Axes class never actually copies the axis instances of the given axes object. Is this intentional? If I want to get properties to be connected between axis objects in different axes, could I manually assign the xaxis attribute of one axes to reference an Axis instance in a different axes object? Or would this make everything break? Thanks! Uri -- Uri Laserson PhD Candidate, Biomedical Engineering Harvard Medical School (Genetics) Massachusetts Institute of Technology (Mathematics) phone +1 917 742 8019 las...@mi... |
From: Ryan M. <rm...@gm...> - 2009-08-12 18:17:45
|
On Wed, Aug 12, 2009 at 10:47 AM, per freem <per...@gm...> wrote: > hi all, > > thanks for these comments. i tried loadtxt and genfromtxt and am > having similar problems. my data looks like this: > > my;header1 myheader-2_a myheader-2_b > a:5-X:b 3;0;5;0;0;0 3.015 > c:6-Y:d 0;0;0;0;0;0 2.5 > > i simply want to read these in, and have all numbers be read in as > floats and all things that don't look like numbers (in this case the > first and second columns) to be parsed in as strings. > > i tried: > > data = genfromtxt(myfile, delimiter='\t', dtype=None) > > (if i don't specify dtype=None, it reads everything as NaN) > > the first problem is that with dtype=None all the entries are parsed > as strings. i'd like to be able to read in the unambiguously numeric > values as numbers (column 3 in this case.) That's because you aren't skipping the header row, so it's trying to infer the proper dtype from the header names -- hence, string. If you didn't want to use the header names, you could use skiprows=1. > the second problem is that if i try to use headers as column names using: > > data = genfromtxt(myfile, delimiter='\t', dtype=None, names=True) > > then it converts my headers into different strings: > > >> data > array([('a:5-X:b', '3;0;5;0;0;0', 3.0150000000000001), > ('c:6-Y:d', '0;0;0;0;0;0', 2.5)], > dtype=[('myheader1', '|S7'), ('myheader2_a', '|S11'), > ('myheader2_b', '<f8')]) > > i would only like to refer to my headers using this notation: > > data['my;header1'] > try adding: deletechars='' If you really just want the values from specific columns, you can also pass in a list of column numbers (or names) to keep: arr = np.genfromtxt('test.txt', delimiter='\t', dtype=None, names=True, deletechars='', usecols=[2]) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |
From: Damon M. <d.m...@wa...> - 2009-08-12 18:05:05
|
Jae-Joon, Brilliant! An even simpler solution! Thank you very much :) Figure.savefig() also takes pad_inches as a keyword argument and it's default is 0.1 inches. If you set it to 0.0 inches it can sometimes crop some of the x-axis label. I have found that if you do fig.savefig("a.pdf", bbox_inches='tight', pad_inches=0.03) It's pretty good. Just for anybody who was interested. Thanks again, Jae-Joon! Regards, --Damon On 12 Aug 2009, at 17:22, Jae-Joon Lee wrote: > get_tightbbox is a bit experimental feature and it is discouraged for > an ordinary user (maybe the method should not be an public method). > Unless you understand how the internal transformation thing works, I'm > afraid there is not much thing you can do with its return value. > > Instead, you should use the savefig function with bbox_inches="tight" > (it actually calls the get_tightbbox method with the proper renderer > for you). For example, > > fig.savefig("a.pdf", bbox_inches="tight") > > > Another approach to eliminate the space is to adjust the subplot > parameters (note that the script you posted does not use Subplot, but > it can be easily modified). > > http://matplotlib.sourceforge.net/faq/howto_faq.html?#automatically-make-room-for-tick-labels > > -JJ > > > > > On Wed, Aug 12, 2009 at 11:35 AM, Damon > McDougall<dam...@gm...> wrote: >> Hello all, >> >> So I'm trying to use matplotlib's OO interface (so programming >> without using >> 'from pylab import *') and found this useful >> page:http://matplotlib.sourceforge.net/leftwich_tut.txt after much >> googling. >> >> My problem is that, in general, after producing a plot, I would >> open the >> .pdf produced to find lots of whitespace that I don't want. The >> reason I >> don't want the whitespace is that I want to include these figures >> in a latex >> document and I want to maximise space. I did some reading and from >> what I >> understand, Axes.get_tightbbox() is the correct tool to use to >> return a >> tight bounding box which I can then use to adjust the Axes limits. >> Here is >> the code I currently have: >> >> >> import numpy as np >> import matplotlib >> >> fig_width_pt = 483.69687 # figure width in pt as >> returned by \showthe in LaTeX >> inches_per_pt = 1.0/72.27 >> golden_ratio = (np.sqrt(5) - 1.0) / 2.0 >> fig_width_in = fig_width_pt * inches_per_pt # figure width in >> inches >> fig_height_in = fig_width_in * golden_ratio # figure height in >> inches >> fig_dims = [fig_width_in, fig_height_in] # fig dims as a list >> >> matplotlib.use('PDF') >> matplotlib.rc('font',**{'family':'serif','serif':['Computer Modern >> Roman']}) >> matplotlib.rc('text', usetex=True) >> matplotlib.rc('axes', labelsize=10) >> matplotlib.rc('legend', fontsize=10) >> matplotlib.rc('xtick', labelsize=10) >> matplotlib.rc('ytick', labelsize=10) >> matplotlib.rc('font', size=10) >> matplotlib.rc('figure', figsize=fig_dims) >> >> from matplotlib.backends.backend_pdf import FigureCanvasPdf as >> FigureCanvas >> from matplotlib.figure import Figure >> fig = Figure() >> canvas = FigureCanvas(fig) >> ax.fig_add_axes([0.2, 0.2, 0.5, 0.7]) >> ax.hold(True) >> ax.grid(True) >> plot_means = ax.plot(means, 'b', label='$m_k$') >> plot_vars = ax.plot(vars, 'g', label='$\sigma_k^2$') >> plot_ictruth = ax.axhline(y = x_0, xmin = 0, xmax = numtimes, >> color='r', >> label='$x_0$') >> ax.set_xlabel('$k$') >> ax.legend(loc='upper right') >> tightbox = ax.get_tightbbox() >> canvas.print_pdf(a) >> >> The problem here is that get_tightbbox() takes 2 arguments, namely >> self and >> renderer. My question is, what is a renderer and how do I >> instantiate/create >> one? After some reading I think it's something to do with >> maplotlib.backend_bases or something. Am I on the right track? >> After the >> call I want to adjust the Axes limits to the thing returned by >> get_tightbbox(), would ax.set_position(tightbox) do that here? >> >> Any help would be greatly appreciated. >> Regards, >> --Damon >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports >> 2008 30-Day >> trial. Simplify your report design, integration and deployment - >> and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> |
From: Eric F. <ef...@ha...> - 2009-08-12 16:59:47
|
marc desmarais wrote: > I found a typo at > "http://matplotlib.sourceforge.net/users/navigation_toolbar.html" > > "If you press ‘x’ or ‘y’ while panning the motion will be contrained to > the x or y axis, respectively." > Thank you. Now it is fixed. > BTW, do you know how to constrain the panning function to left/right > programmatically? I'm try to make a logic analyzer. I don't know offhand, but I don't think that capability is in place. I find holding down a key while panning to be a bit awkward, so I am also interested in alternatives. > > Finally, is this the best place to post my questions? (I suspect not...) Yes, matplotlib-users is the right place. I assume you intended to "reply-to-all" on that last one, so intended it to go to the list. Apparently the settings on this list are unusual in that one must explicitly "reply-to-all"; it is not automatic that one's reply goes to the list. Eric > > --- On *Mon, 8/10/09, Eric Firing /<ef...@ha...>/* wrote: > > > From: Eric Firing <ef...@ha...> > Subject: Re: [Matplotlib-users] pylab > To: "marc desmarais" <mde...@ya...> > Cc: mat...@li... > Date: Monday, August 10, 2009, 7:22 PM > > marc desmarais wrote: > > Are there still two pylabs? Are the following two web pages > referring to the same pylab? > > Not exactly: > > > This one is a vision or proposal, open for discussion: > > http://www.scipy.org/PyLab > > This one is real: > > http://matplotlib.sourceforge.net/ > > > > The pylab interface to the matplotlib plotting library has some of > the characteristics the author of the first link is talking about, > but the trend has been away from some aspects of that vision, not > towards it. > > For more about the real pylab, see > http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related > > > > I'm a bit confused (trying to get the Scipy, Numpy, Pylab, > Matplolib story straight, before I plunge in) > > Numpy is the common core, providing N-dimensional arrays and math; > matplotlib is a plotting library, using numpy; scipy is a collection > of math/science functionality, also using numpy. > > But don't forget ipython, which provides a nice interactive shell: > http://ipython.scipy.org/moin/ > > Eric > > > > > Marc Desmarais > > Long Beach, CA, 90814 > > |
From: Christopher B. <Chr...@no...> - 2009-08-12 16:42:09
|
John [H2O] wrote: > Impatiently I somewhat double posted (though, actually, I thought this was a > better list than scipy for the question). Regardless... the conversation is > mostly here: > http://www.nabble.com/2d-interpolation%2C-non-regular-lat-lon-grid-td24909685.html One comment: mgrid() is designed to interpolate form unstructured data to a regular grid. Given that your data is, in fact, quite structured, I suspect you may get better results from a a custom-written interpolator -- simple bi-linear (or bspline) interpolation would be pretty easy to write, and may give you a cleaner result. You may even be able to grab code straight from scipy.interpolate, an apply it on the different portions of your grid separately. HTH, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Darren D. <dsd...@gm...> - 2009-08-12 16:28:48
|
On Wed, Aug 12, 2009 at 12:22 PM, <spi...@th...> wrote: > hmm ok i post it in a more shorter way... but with the point raw settings > i dont know how it should works I directed you to the documentation. An improved script is attached. |
From: Jae-Joon L. <lee...@gm...> - 2009-08-12 16:22:30
|
get_tightbbox is a bit experimental feature and it is discouraged for an ordinary user (maybe the method should not be an public method). Unless you understand how the internal transformation thing works, I'm afraid there is not much thing you can do with its return value. Instead, you should use the savefig function with bbox_inches="tight" (it actually calls the get_tightbbox method with the proper renderer for you). For example, fig.savefig("a.pdf", bbox_inches="tight") Another approach to eliminate the space is to adjust the subplot parameters (note that the script you posted does not use Subplot, but it can be easily modified). http://matplotlib.sourceforge.net/faq/howto_faq.html?#automatically-make-room-for-tick-labels -JJ On Wed, Aug 12, 2009 at 11:35 AM, Damon McDougall<dam...@gm...> wrote: > Hello all, > > So I'm trying to use matplotlib's OO interface (so programming without using > 'from pylab import *') and found this useful > page:http://matplotlib.sourceforge.net/leftwich_tut.txt after much googling. > > My problem is that, in general, after producing a plot, I would open the > .pdf produced to find lots of whitespace that I don't want. The reason I > don't want the whitespace is that I want to include these figures in a latex > document and I want to maximise space. I did some reading and from what I > understand, Axes.get_tightbbox() is the correct tool to use to return a > tight bounding box which I can then use to adjust the Axes limits. Here is > the code I currently have: > > > import numpy as np > import matplotlib > > fig_width_pt = 483.69687 # figure width in pt as > returned by \showthe in LaTeX > inches_per_pt = 1.0/72.27 > golden_ratio = (np.sqrt(5) - 1.0) / 2.0 > fig_width_in = fig_width_pt * inches_per_pt # figure width in inches > fig_height_in = fig_width_in * golden_ratio # figure height in inches > fig_dims = [fig_width_in, fig_height_in] # fig dims as a list > > matplotlib.use('PDF') > matplotlib.rc('font',**{'family':'serif','serif':['Computer Modern Roman']}) > matplotlib.rc('text', usetex=True) > matplotlib.rc('axes', labelsize=10) > matplotlib.rc('legend', fontsize=10) > matplotlib.rc('xtick', labelsize=10) > matplotlib.rc('ytick', labelsize=10) > matplotlib.rc('font', size=10) > matplotlib.rc('figure', figsize=fig_dims) > > from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas > from matplotlib.figure import Figure > fig = Figure() > canvas = FigureCanvas(fig) > ax.fig_add_axes([0.2, 0.2, 0.5, 0.7]) > ax.hold(True) > ax.grid(True) > plot_means = ax.plot(means, 'b', label='$m_k$') > plot_vars = ax.plot(vars, 'g', label='$\sigma_k^2$') > plot_ictruth = ax.axhline(y = x_0, xmin = 0, xmax = numtimes, color='r', > label='$x_0$') > ax.set_xlabel('$k$') > ax.legend(loc='upper right') > tightbox = ax.get_tightbbox() > canvas.print_pdf(a) > > The problem here is that get_tightbbox() takes 2 arguments, namely self and > renderer. My question is, what is a renderer and how do I instantiate/create > one? After some reading I think it's something to do with > maplotlib.backend_bases or something. Am I on the right track? After the > call I want to adjust the Axes limits to the thing returned by > get_tightbbox(), would ax.set_position(tightbox) do that here? > > Any help would be greatly appreciated. > Regards, > --Damon > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Darren D. <dsd...@gm...> - 2009-08-12 16:11:12
|
Try googling "python raw strings" and read the first hit. By the way, please post self-contained scripts that are as short as possible. We can't run the script you posted, the data is missing. On Wed, Aug 12, 2009 at 12:00 PM, <spi...@th...> wrote: > how i use raw settings ? > >> On Wed, Aug 12, 2009 at 10:42 AM, Timo >> Spielmann<spi...@th...> wrote: >>> hey people >>> >>> i have an problem on plotting some functions with latex texts. i cant >>> plot some latex symbols like \bar or something else.... the normal latex >>> stuff works perect, but such keys doessent and i dont know why... >>> >>> hope someone can help me >> >> Try using raw strings? >> > > > -- "In our description of nature, the purpose is not to disclose the real essence of the phenomena but only to track down, so far as it is possible, relations between the manifold aspects of our experience" - Niels Bohr "It is a bad habit of physicists to take their most successful abstractions to be real properties of our world." - N. David Mermin "Once we have granted that any physical theory is essentially only a model for the world of experience, we must renounce all hope of finding anything like the correct theory ... simply because the totality of experience is never accessible to us." - Hugh Everett III |
From: <spi...@th...> - 2009-08-12 16:01:08
|
how i use raw settings ? > On Wed, Aug 12, 2009 at 10:42 AM, Timo > Spielmann<spi...@th...> wrote: >> hey people >> >> i have an problem on plotting some functions with latex texts. i cant >> plot some latex symbols like \bar or something else.... the normal latex >> stuff works perect, but such keys doessent and i dont know why... >> >> hope someone can help me > > Try using raw strings? > |
From: per f. <per...@gm...> - 2009-08-12 15:48:09
|
hi all, thanks for these comments. i tried loadtxt and genfromtxt and am having similar problems. my data looks like this: my;header1 myheader-2_a myheader-2_b a:5-X:b 3;0;5;0;0;0 3.015 c:6-Y:d 0;0;0;0;0;0 2.5 i simply want to read these in, and have all numbers be read in as floats and all things that don't look like numbers (in this case the first and second columns) to be parsed in as strings. i tried: data = genfromtxt(myfile, delimiter='\t', dtype=None) (if i don't specify dtype=None, it reads everything as NaN) the first problem is that with dtype=None all the entries are parsed as strings. i'd like to be able to read in the unambiguously numeric values as numbers (column 3 in this case.) the second problem is that if i try to use headers as column names using: data = genfromtxt(myfile, delimiter='\t', dtype=None, names=True) then it converts my headers into different strings: >> data array([('a:5-X:b', '3;0;5;0;0;0', 3.0150000000000001), ('c:6-Y:d', '0;0;0;0;0;0', 2.5)], dtype=[('myheader1', '|S7'), ('myheader2_a', '|S11'), ('myheader2_b', '<f8')]) i would only like to refer to my headers using this notation: data['my;header1'] i don't need to be able to write data.headername at all. is there a way to make genfromtxt not mess with any of the header names, and read in the numeric values? thanks very much. On Wed, Aug 12, 2009 at 11:16 AM, Ryan May<rm...@gm...> wrote: > On Wed, Aug 12, 2009 at 10:01 AM, Sandro Tosi <mo...@de...> wrote: >> >> On Wed, Aug 12, 2009 at 16:56, per freem<per...@gm...> wrote: >> > hi all, >> > >> > i have tab-separated text files that i would like to parse into arrays >> > in numpy/scipy. i simply want to be able to read in the data into an >> >> numpy's loadtxt() > > With numpy 1.3 and newer, there's also numpy.genfromtxt (which actually > should behave very similar to mlab.csv2rec): > > import numpy as np > from StringIO import StringIO > data = StringIO(""" > #gender age weight > M 21 72.100000 > F 35 58.330000 > M 33 21.99 > """) > > arr = np.genfromtxt(data, names=True, dtype=None) > print arr['gender'] > print arr['age'] > > Writing this back out to a file in the same format will require a bit more > of manual (though) straightforward work. There's no simple method that will > do it for you. The best one liner here is: > > arr.tofile('test.txt', sep='\n') > >>cat arr.txt > ('M', 21, 72.099999999999994) > ('F', 35, 58.329999999999998) > ('M', 33, 21.989999999999998) > > That should get you going. If it's not enough, feel free to post a sample > of your data file (or a representative example) and I can try to point you > further in the right direction. > > Ryan > > -- > Ryan May > Graduate Research Assistant > School of Meteorology > University of Oklahoma > |
From: Damon M. <dam...@gm...> - 2009-08-12 15:40:52
|
Sorry, I forgot to use a sensible subject for the email! Regards, --Damon On 12 Aug 2009, at 16:35, Damon McDougall wrote: > Hello all, > > So I'm trying to use matplotlib's OO interface (so programming > without using 'from pylab import *') and found this useful page:http://matplotlib.sourceforge.net/leftwich_tut.txt > after much googling. > > My problem is that, in general, after producing a plot, I would open > the .pdf produced to find lots of whitespace that I don't want. The > reason I don't want the whitespace is that I want to include these > figures in a latex document and I want to maximise space. I did some > reading and from what I understand, Axes.get_tightbbox() is the > correct tool to use to return a tight bounding box which I can then > use to adjust the Axes limits. Here is the code I currently have: > > > import numpy as np > import matplotlib > > fig_width_pt = 483.69687 # figure width in pt > as returned by \showthe in LaTeX > inches_per_pt = 1.0/72.27 > golden_ratio = (np.sqrt(5) - 1.0) / 2.0 > fig_width_in = fig_width_pt * inches_per_pt # figure width in inches > fig_height_in = fig_width_in * golden_ratio # figure height in > inches > fig_dims = [fig_width_in, fig_height_in] # fig dims as a list > > matplotlib.use('PDF') > matplotlib.rc('font',**{'family':'serif','serif':['Computer Modern > Roman']}) > matplotlib.rc('text', usetex=True) > matplotlib.rc('axes', labelsize=10) > matplotlib.rc('legend', fontsize=10) > matplotlib.rc('xtick', labelsize=10) > matplotlib.rc('ytick', labelsize=10) > matplotlib.rc('font', size=10) > matplotlib.rc('figure', figsize=fig_dims) > > from matplotlib.backends.backend_pdf import FigureCanvasPdf as > FigureCanvas > from matplotlib.figure import Figure > fig = Figure() > canvas = FigureCanvas(fig) > ax.fig_add_axes([0.2, 0.2, 0.5, 0.7]) > ax.hold(True) > ax.grid(True) > plot_means = ax.plot(means, 'b', label='$m_k$') > plot_vars = ax.plot(vars, 'g', label='$\sigma_k^2$') > plot_ictruth = ax.axhline(y = x_0, xmin = 0, xmax = numtimes, > color='r', label='$x_0$') > ax.set_xlabel('$k$') > ax.legend(loc='upper right') > tightbox = ax.get_tightbbox() > canvas.print_pdf(a) > > The problem here is that get_tightbbox() takes 2 arguments, namely > self and renderer. My question is, what is a renderer and how do I > instantiate/create one? After some reading I think it's something to > do with maplotlib.backend_bases or something. Am I on the right > track? After the call I want to adjust the Axes limits to the thing > returned by get_tightbbox(), would ax.set_position(tightbox) do that > here? > > Any help would be greatly appreciated. > Regards, > --Damon > |
From: Damon M. <dam...@gm...> - 2009-08-12 15:35:59
|
Hello all, So I'm trying to use matplotlib's OO interface (so programming without using 'from pylab import *') and found this useful page:http://matplotlib.sourceforge.net/leftwich_tut.txt after much googling. My problem is that, in general, after producing a plot, I would open the .pdf produced to find lots of whitespace that I don't want. The reason I don't want the whitespace is that I want to include these figures in a latex document and I want to maximise space. I did some reading and from what I understand, Axes.get_tightbbox() is the correct tool to use to return a tight bounding box which I can then use to adjust the Axes limits. Here is the code I currently have: import numpy as np import matplotlib fig_width_pt = 483.69687 # figure width in pt as returned by \showthe in LaTeX inches_per_pt = 1.0/72.27 golden_ratio = (np.sqrt(5) - 1.0) / 2.0 fig_width_in = fig_width_pt * inches_per_pt # figure width in inches fig_height_in = fig_width_in * golden_ratio # figure height in inches fig_dims = [fig_width_in, fig_height_in] # fig dims as a list matplotlib.use('PDF') matplotlib.rc('font',**{'family':'serif','serif':['Computer Modern Roman']}) matplotlib.rc('text', usetex=True) matplotlib.rc('axes', labelsize=10) matplotlib.rc('legend', fontsize=10) matplotlib.rc('xtick', labelsize=10) matplotlib.rc('ytick', labelsize=10) matplotlib.rc('font', size=10) matplotlib.rc('figure', figsize=fig_dims) from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas from matplotlib.figure import Figure fig = Figure() canvas = FigureCanvas(fig) ax.fig_add_axes([0.2, 0.2, 0.5, 0.7]) ax.hold(True) ax.grid(True) plot_means = ax.plot(means, 'b', label='$m_k$') plot_vars = ax.plot(vars, 'g', label='$\sigma_k^2$') plot_ictruth = ax.axhline(y = x_0, xmin = 0, xmax = numtimes, color='r', label='$x_0$') ax.set_xlabel('$k$') ax.legend(loc='upper right') tightbox = ax.get_tightbbox() canvas.print_pdf(a) The problem here is that get_tightbbox() takes 2 arguments, namely self and renderer. My question is, what is a renderer and how do I instantiate/create one? After some reading I think it's something to do with maplotlib.backend_bases or something. Am I on the right track? After the call I want to adjust the Axes limits to the thing returned by get_tightbbox(), would ax.set_position(tightbox) do that here? Any help would be greatly appreciated. Regards, --Damon |
From: Darren D. <dsd...@gm...> - 2009-08-12 15:21:47
|
On Wed, Aug 12, 2009 at 10:42 AM, Timo Spielmann<spi...@th...> wrote: > hey people > > i have an problem on plotting some functions with latex texts. i cant > plot some latex symbols like \bar or something else.... the normal latex > stuff works perect, but such keys doessent and i dont know why... > > hope someone can help me Try using raw strings? |
From: Timo S. <spi...@th...> - 2009-08-12 15:17:03
|
hey people i have an problem on plotting some functions with latex texts. i cant plot some latex symbols like \bar or something else.... the normal latex stuff works perect, but such keys doessent and i dont know why... hope someone can help me as you can see i attached a sample plot file... you find the latex problem in line pl.ylabel() ... the \bar doessent work here is the error message i got mK_massnumber$ python mK_massnumber1.py (3.196543428131772e-09, -4.8707876140789696e-08) /usr/lib/python2.6/dist-packages/matplotlib/texmanager.py:55: DeprecationWarning: os.popen4 is deprecated. Use the subprocess module. stdin, stdout = os.popen4('dvipng -version') Traceback (most recent call last): File "mK_massnumber1.py", line 79, in <module> pl.savefig('mK_massnumber1.eps') File "/usr/lib/python2.6/dist-packages/matplotlib/pyplot.py", line 345, in savefig return fig.savefig(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/figure.py", line 990, in savefig self.canvas.print_figure(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backend_bases.py", line 1419, in print_figure **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backend_bases.py", line 1308, in print_eps return ps.print_eps(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 869, in print_eps return self._print_ps(outfile, 'eps', *args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 892, in _print_ps orientation, isLandscape, papertype) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 1140, in _print_figure_tex orientation) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 1227, in convert_psfrags \nHere is the full report generated by LaTeX: \n\n%s'% fh.read()) RuntimeError: LaTeX was not able to process your file: Here is the full report generated by LaTeX: This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) %&-line parsing enabled. entering extended mode (/tmp/4255a479ce229709468650a987deaac6.tex LaTeX2e <2005/12/01> Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, ukrainian, russian, bulgarian, loaded. (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size10.clo)) (/usr/share/texmf-texlive/tex/latex/type1cm/type1cm.sty) (/usr/share/texmf-texlive/tex/latex/psnfss/helvet.sty (/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)) (/usr/share/texmf-texlive/tex/latex/psnfss/courier.sty) (/usr/share/texmf-texlive/tex/latex/base/textcomp.sty (/usr/share/texmf-texlive/tex/latex/base/ts1enc.def)) (/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty (/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg) Package geometry Warning: Over-specification in `h'-direction. `width' (614.295pt) is ignored. Package geometry Warning: Over-specification in `v'-direction. `height' (794.96999pt) is ignored. ) (/usr/share/texmf-texlive/tex/latex/psfrag/psfrag.sty (/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty (/usr/share/texmf-texlive/tex/latex/graphics/trig.sty) (/etc/texmf/tex/latex/config/graphics.cfg) (/usr/share/texmf-texlive/tex/latex/graphics/dvips.def))) (/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty) (/usr/share/texmf-texlive/tex/latex/graphics/color.sty (/etc/texmf/tex/latex/config/color.cfg) (/usr/share/texmf-texlive/tex/latex/graphics/dvipsnam.def)) (./4255a479ce229709468650a987deaac6.aux) (/usr/share/texmf-texlive/tex/latex/base/ts1cmr.fd) (/usr/share/texmf-texlive/tex/latex/psnfss/ot1pnc.fd) ! Text line contains an invalid character. l.38 ...r[rgb]{0.000,0.000,1.000} {\sffamily $^^H ar a M_{K} / <A_{part}> ... <4255a479ce229709468650a987deaac6.eps> (/usr/share/texmf-texlive/tex/latex/psnfss/ot1phv.fd) ! Extra }, or forgotten $. <argument> ...ffamily $ar a M_{K} / <A_{part}> \$} l.43 ...e=0]{4255a479ce229709468650a987deaac6.eps} ! Missing $ inserted. <inserted text> $ l.43 ...e=0]{4255a479ce229709468650a987deaac6.eps} ! Missing } inserted. <inserted text> } l.43 ...e=0]{4255a479ce229709468650a987deaac6.eps} [1] (./4255a479ce229709468650a987deaac6.aux) ) (see the transcript file for additional information) Output written on 4255a479ce229709468650a987deaac6.dvi (1 page, 5532 bytes). Transcript written on 4255a479ce229709468650a987deaac6.log. mK_massnumber$ python mK_massnumber1.py (3.196543428131772e-09, -4.8707876140789696e-08) mK_massnumber$ python mK_massnumber1.py (3.196543428131772e-09, -4.8707876140789696e-08) ############################################################################################ here are the informations about my system: $ uname -a Linux timo-laptop 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux matplotlib version: 0.98.5.2 |
From: Ryan M. <rm...@gm...> - 2009-08-12 15:16:50
|
On Wed, Aug 12, 2009 at 10:01 AM, Sandro Tosi <mo...@de...> wrote: > On Wed, Aug 12, 2009 at 16:56, per freem<per...@gm...> wrote: > > hi all, > > > > i have tab-separated text files that i would like to parse into arrays > > in numpy/scipy. i simply want to be able to read in the data into an > > numpy's loadtxt() With numpy 1.3 and newer, there's also numpy.genfromtxt (which actually should behave very similar to mlab.csv2rec): import numpy as np from StringIO import StringIO data = StringIO(""" #gender age weight M 21 72.100000 F 35 58.330000 M 33 21.99 """) arr = np.genfromtxt(data, names=True, dtype=None) print arr['gender'] print arr['age'] Writing this back out to a file in the same format will require a bit more of manual (though) straightforward work. There's no simple method that will do it for you. The best one liner here is: arr.tofile('test.txt', sep='\n') >cat arr.txt ('M', 21, 72.099999999999994) ('F', 35, 58.329999999999998) ('M', 33, 21.989999999999998) That should get you going. If it's not enough, feel free to post a sample of your data file (or a representative example) and I can try to point you further in the right direction. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |
From: Sandro T. <mo...@de...> - 2009-08-12 15:02:06
|
On Wed, Aug 12, 2009 at 16:56, per freem<per...@gm...> wrote: > hi all, > > i have tab-separated text files that i would like to parse into arrays > in numpy/scipy. i simply want to be able to read in the data into an numpy's loadtxt() Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi |
From: per f. <per...@gm...> - 2009-08-12 14:57:05
|
hi all, i have tab-separated text files that i would like to parse into arrays in numpy/scipy. i simply want to be able to read in the data into an array, and then use indexing to get some of the columns, or some of the rows, etc. the key thing is that these columns might be strings or might be numbers. typically, one column is a set of strings and the others are floats. it's necessary for me to be able to specify whether the file has a header or not, or what the delimiter is. also, i'd like to be able to manipulate the array that i read in and then easily serialize it to a file as csv, again controlling the delimiters/headers. from the documentation, it looks like 'csv2rec' (from matplotlib.mlab) might be the best option, but i am having problems with it. for example, i use: data = csv2rec(se_counts, skiprows=1, delimiter='\t') however, then i cannot access the resulting array 'data' by columns, it seems. the usual array notation data[:, 0] to access the first column does not work -- how can i access the columns? also, the first line of the file in this case was a header. ideally i'd like to be able to specify that to csv2rec, so that it uses the tab separated headers in the first line as the field names for the columns -- is there a way to do this? finally, how can i then easily serialize the results to a csv file? any help on this would be greatly appreciated. i am happy to use options aside from 'csv2rec' -- it's just that this seemed closest to what i wanted to do, but i might have missed something. thank you. |
From: Alexander B. <ale...@gm...> - 2009-08-12 13:14:53
|
Hi, I noticed a minor problem when matplolib embedded in Qt and used NavigationTollbar Save button. When I press Save button and select from File type combo some format (PDF or any other) but don't change defaul filename "image" the figure always saved in PNG format. So if i want to save figure in format different from PNG I must not only select desired file type, but also change default filename to another one. Is this bug or maybe this is a feature? Tested on Windows XP Pro SP3, Python 2.5.2, matplotlib-0.98.5.2 and matplotlib-0.99.0, PyQt 4.4.3 -- Alexander Bruy mailto: ale...@gm... |
From: Jeff W. <js...@fa...> - 2009-08-12 12:52:47
|
Alexander Barth wrote: > Hi all, > > I want to implement a web map server (WMS) using matplotlib/basemap. > The client of WMS does specify the bounding box in lon/lat and width > and height of the image. The spec requires that the server produces > such images without blank spaces around the image. The image might > thus have a wrong aspect ratio and it is up to the client of the WMS > to display the image correctly. > > I ran in exactly the same problem as described here: > > http://www.nabble.com/fill-entire-figure-area---DONT-maintain-aspect-ratio-td22365115.html > > But I found as work around to this problem. If the aspect ratio of the > axis is set to auto (ax.set_aspect("auto")) before the figure is > saved, then one obtains a stretched figure (as required). Is this a > proper solution, are just a trick that will probably no longer work in > future version of basemap? I'm asking because the previous emails on > this issue indicate that basemap is intended to produce always images > in the correct aspect ratio. > > > Thanks and regards > > Alexander. Basemap now has a 'fix_aspect' kwarg. If you set it to False, I think you can get what you want (the default is True). Let me know if it doesn't. -Jeff |
From: D2Hitman <j.m...@wa...> - 2009-08-12 11:55:08
|
Darren Dale-3 wrote: > > >> Is it a problem that it is using pdftex instead of pslatex? > > Yes. > > I am trying a few things in matplotlibrc, but cannot change from pdftex... Is there something obvious i am missing? If so what? Cheers. -- View this message in context: http://www.nabble.com/EPS-with-TeX-tp24934313p24934897.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Sebastian B. <web...@th...> - 2009-08-12 11:50:54
|
finally... Sebastian Busch wrote: > ... > it does not crash (the version with '\\' does) but does not produce a > line break, either... text(0.5, 0.5, 'a \n b') works. |
From: Sebastian B. <web...@th...> - 2009-08-12 11:47:21
|
Darren Dale wrote: >> the example >> >> from matplotlib.pyplot import * >> text(0.5, 0.5, r'a \\ b') >> savefig('test.eps') >> >> runs without error here -- and latex is calling pdftex: > > ... cup of coffee. ... the example was not fair though as it wasn't using latex... this one is now: from matplotlib import rcParams params = {'backend': 'ps', 'text.usetex': True, 'ps.usedistiller': 'xpdf', } rcParams.update(params) from matplotlib.pyplot import * text(0.5, 0.5, r'a \newline{} b') savefig('test.eps') it does not crash (the version with '\\' does) but does not produce a line break, either... best, sebastian. |
From: Darren D. <dsd...@gm...> - 2009-08-12 11:41:01
|
On Wed, Aug 12, 2009 at 7:32 AM, Sebastian Busch<web...@th...> wrote: > Darren Dale wrote: >> On Wed, Aug 12, 2009 at 7:13 AM, D2Hitman<j.m...@wa...> wrote: >>> Is it a problem that it is using pdftex instead of pslatex? >> Yes. > > i don't think so. > > > the example > > from matplotlib.pyplot import * > text(0.5, 0.5, r'a \\ b') > savefig('test.eps') > > runs without error here -- and latex is calling pdftex: Ok, I shouldn't have posted before my first cup of coffee. Thank you for correcting me. Darren |
From: Sebastian B. <web...@th...> - 2009-08-12 11:32:54
|
Darren Dale wrote: > On Wed, Aug 12, 2009 at 7:13 AM, D2Hitman<j.m...@wa...> wrote: >> Is it a problem that it is using pdftex instead of pslatex? > Yes. i don't think so. the example from matplotlib.pyplot import * text(0.5, 0.5, r'a \\ b') savefig('test.eps') runs without error here -- and latex is calling pdftex: $ latex -v pdfTeX using libpoppler 3.141592-1.40.3-2.2 (Web2C 7.5.6) kpathsea version 3.5.6 Copyright 2007 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Kpathsea is copyright 2007 Karl Berry and Olaf Weber. There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX using libpoppler copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX using libpoppler source. Primary author of pdfTeX using libpoppler: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Kpathsea written by Karl Berry, Olaf Weber, and others. Compiled with libpng 1.2.27; using libpng 1.2.27 Compiled with zlib 1.2.3.3; using zlib 1.2.3.3 Compiled with libpoppler version 0.10.5 could the OP perhaps post some more information? sebastian. |