[Matplotlib-users] strtod dilemma
Hi list, When the 'pylab' module is loaded the function 'strtod' does not work well. I suppose that this is not new: http://www.python.org/search/hypermail/python-1994q2/0750.html and the question is: any solution? In this linkit exists a better description of the problem: http://mbdynsimsuite.sourceforge.net/build_mbdyn_bindings.html regards, Luis. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Customizing MPL backends
Dear ALL, Is there any way to ***exclude*** (make invlsible) one of more of the standard buttons which are displayed in the toolbar (either the "Classic" or the "Toolbar2") of the MPL backends? Thanks in advance for any assistance you can provide! Best regards, -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mauro...@gmail.com Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] strtod dilemma
Luis Saavedra wrote: > Hi list, > > When the 'pylab' module is loaded the function 'strtod' does not work well. > Can you elaborate on how it doesn't work? > I suppose that this is not new: > http://www.python.org/search/hypermail/python-1994q2/0750.html > > and the question is: any solution? > There's a solution in that link: use one of the many alternatives that are known to be more consistent across various versions of UNIX. > In this linkit exists a better description of the problem: > > http://mbdynsimsuite.sourceforge.net/build_mbdyn_bindings.html > I think this is not a matplotlib-specific problem, but a Python one, since Python provides its own strtod definition -- in an apparent attempt to get around its differences on different platforms. If you grep over the matplotlib source code, "strtod" isn't even there. Cheers, Mike -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] csv2rec column names
Hi all, I have a lot of csv files to process, all of them with the same number of columns. The only issue is that each file has a unique column name for the fourth column. All the csv2rec examples I found are using the r.column_name format to access the data in that column which is of no use for me because of the unique names. Is there a way to access that data using the column number? I bet this should be something simple but I cannot figure it out... Thanks in advance, Anton -- View this message in context: http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
I'm not sure what you are needing it for, but I would suggest looking into numpy's loadtxt function. You can use this to load the csv data into numpy arrays and pass the resulting arrays arround. -Patrick On Sat, Jan 3, 2009 at 11:21 AM, antonv wrote: > > Hi all, > > I have a lot of csv files to process, all of them with the same number of > columns. The only issue is that each file has a unique column name for the > fourth column. > > All the csv2rec examples I found are using the r.column_name format to > access the data in that column which is of no use for me because of the > unique names. Is there a way to access that data using the column number? I > bet this should be something simple but I cannot figure it out... > > Thanks in advance, > Anton > -- > View this message in context: > http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
I am plotting the data in those csv files and the forst 4 columns in the files have the same title but the 5th has the name based on the date and time so it would be unique in each of the files. As I have about 600 files to batch process, adjusting my script manually is not an option. The way I have it for one test file is: r = mlab.csv2rec('test.csv') #i know that the column name for the 5th column is 'htsgw_12191800' #so to read the data in the 5th column i just use: z = r.htsgw_12191800 What i need is to be able to get that data by specifying the column number as that stays the same in all files. I'll look at numpy but I hope there is a simpler way. Thanks, Anton Patrick Marsh-2 wrote: > > I'm not sure what you are needing it for, but I would suggest looking > into numpy's loadtxt function. You can use this to load the csv data > into numpy arrays and pass the resulting arrays arround. > > -Patrick > > > > > > > On Sat, Jan 3, 2009 at 11:21 AM, antonv wrote: >> >> Hi all, >> >> I have a lot of csv files to process, all of them with the same number of >> columns. The only issue is that each file has a unique column name for >> the >> fourth column. >> >> All the csv2rec examples I found are using the r.column_name format to >> access the data in that column which is of no use for me because of the >> unique names. Is there a way to access that data using the column number? >> I >> bet this should be something simple but I cannot figure it out... >> >> Thanks in advance, >> Anton >> -- >> View this message in context: >> http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> -- >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/csv2rec-column-names-tp21267055p21267232.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
In my limited opinion, numpy's loadtxt is the way to go. Loadtxt doesn't care about the headerYou can read in the arrays like this: # read in all 5 columns as text col1, col2, col3, col4, col5 = np.loadtxt(filename, dtype=dtype, unpack=True) or if you want to skip the column headings and read in just a specific data type of just the last column # read in only column 5, as a specific dtype, and exclude the column 5 heading col5_no_header = np.loadtxt(filename, skiprows=1, usecols=(5), dtype=dtype, unpack=True) -Patrick On Sat, Jan 3, 2009 at 11:39 AM, antonv wrote: > > I am plotting the data in those csv files and the forst 4 columns in the > files have the same title but the 5th has the name based on the date and > time so it would be unique in each of the files. As I have about 600 files > to batch process, adjusting my script manually is not an option. > > The way I have it for one test file is: > > r = mlab.csv2rec('test.csv') > #i know that the column name for the 5th column is 'htsgw_12191800' > #so to read the data in the 5th column i just use: > z = r.htsgw_12191800 > > What i need is to be able to get that data by specifying the column number > as that stays the same in all files. > > I'll look at numpy but I hope there is a simpler way. > > Thanks, > Anton > > > > Patrick Marsh-2 wrote: >> >> I'm not sure what you are needing it for, but I would suggest looking >> into numpy's loadtxt function. You can use this to load the csv data >> into numpy arrays and pass the resulting arrays arround. >> >> -Patrick >> >> >> >> >> >> >> On Sat, Jan 3, 2009 at 11:21 AM, antonv wrote: >>> >>> Hi all, >>> >>> I have a lot of csv files to process, all of them with the same number of >>> columns. The only issue is that each file has a unique column name for >>> the >>> fourth column. >>> >>> All the csv2rec examples I found are using the r.column_name format to >>> access the data in that column which is of no use for me because of the >>> unique names. Is there a way to access that data using the column number? >>> I >>> bet this should be something simple but I cannot figure it out... >>> >>> Thanks in advance, >>> Anton >>> -- >>> View this message in context: >>> http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.html >>> Sent from the matplotlib - users mailing list archive at Nabble.com. >>> >>> >>> -- >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> -- >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > -- > View this message in context: > http://www.nabble.com/csv2rec-column-names-tp21267055p21267232.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
You're right! I read more about recarrays and they were built specially for being called by the column name, so I shouldn't have used csv2rec from the start! Thanks for the quick responses! Anton Patrick Marsh-2 wrote: > > In my limited opinion, numpy's loadtxt is the way to go. Loadtxt > doesn't care about the headerYou can read in the arrays like this: > > # read in all 5 columns as text > col1, col2, col3, col4, col5 = np.loadtxt(filename, dtype=dtype, > unpack=True) > > or if you want to skip the column headings and read in just a specific > data type of just the last column > > # read in only column 5, as a specific dtype, and exclude the column 5 > heading > col5_no_header = np.loadtxt(filename, skiprows=1, usecols=(5), > dtype=dtype, unpack=True) > > > -Patrick > > > > > > > On Sat, Jan 3, 2009 at 11:39 AM, antonv wrote: >> >> I am plotting the data in those csv files and the forst 4 columns in the >> files have the same title but the 5th has the name based on the date and >> time so it would be unique in each of the files. As I have about 600 >> files >> to batch process, adjusting my script manually is not an option. >> >> The way I have it for one test file is: >> >> r = mlab.csv2rec('test.csv') >> #i know that the column name for the 5th column is 'htsgw_12191800' >> #so to read the data in the 5th column i just use: >> z = r.htsgw_12191800 >> >> What i need is to be able to get that data by specifying the column >> number >> as that stays the same in all files. >> >> I'll look at numpy but I hope there is a simpler way. >> >> Thanks, >> Anton >> >> >> >> Patrick Marsh-2 wrote: >>> >>> I'm not sure what you are needing it for, but I would suggest looking >>> into numpy's loadtxt function. You can use this to load the csv data >>> into numpy arrays and pass the resulting arrays arround. >>> >>> -Patrick >>> >>> >>> >>> >>> >>> >>> On Sat, Jan 3, 2009 at 11:21 AM, antonv >>> wrote: Hi all, I have a lot of csv files to process, all of them with the same number of columns. The only issue is that each file has a unique column name for the fourth column. All the csv2rec examples I found are using the r.column_name format to access the data in that column which is of no use for me because of the unique names. Is there a way to access that data using the column number? I bet this should be something simple but I cannot figure it out... Thanks in advance, Anton -- View this message in context: http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> -- >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/csv2rec-column-names-tp21267055p21267232.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> -- >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/csv2rec-column-names-tp21267055p21267490.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] strtod dilemma
Michael Droettboom escribió: > Luis Saavedra wrote: >> Hi list, >> >> When the 'pylab' module is loaded the function 'strtod' does not work >> well. >> > Can you elaborate on how it doesn't work? >> I suppose that this is not new: >> http://www.python.org/search/hypermail/python-1994q2/0750.html >> >> and the question is: any solution? >> > There's a solution in that link: use one of the many alternatives that > are known to be more consistent across various versions of UNIX. >> In this linkit exists a better description of the problem: >> >> http://mbdynsimsuite.sourceforge.net/build_mbdyn_bindings.html >> > I think this is not a matplotlib-specific problem, but a Python one, > since Python provides its own strtod definition -- in an apparent > attempt to get around its differences on different platforms. If you > grep over the matplotlib source code, "strtod" isn't even there. > > Cheers, > Mike Sorry for the noise, please ignore. This problem is produced due to the fact that 'pylab' load the 'gtk' module and when 'gtk' is loaded it load my 'locale'(es_CL with LC_NUMERIC=','), and it is fine! My module is the one that must not be dependent on the locale (LC_NUMERIC). Regards, Luis. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
FYI, I recoded np.loadtxt to handle missing data, automatic name definition and conversion functions, as a merge of np.loadtxt and mlab.csv2rec. You can access the code here: https://code.launchpad.net/~pierregm/numpy/numpy_addons Hopefully these functions will make it to numpy at one point or another. Note also that you are not limited to recarrays: you can use what's called a flexible-type arrays, which still gives the possibility to access individual fields by keys, without the overload of recarrays (where fields can also be accessed as attributes). For example: >>> x=np.array([(1,10.), (2,20.)], dtype=[('A',int),('B',float)]) >>>x['A'] array([1, 2]) On Jan 3, 2009, at 12:59 PM, Patrick Marsh wrote: > In my limited opinion, numpy's loadtxt is the way to go. Loadtxt > doesn't care about the headerYou can read in the arrays like this: > > # read in all 5 columns as text > col1, col2, col3, col4, col5 = np.loadtxt(filename, dtype=dtype, > unpack=True) > > or if you want to skip the column headings and read in just a specific > data type of just the last column > > # read in only column 5, as a specific dtype, and exclude the column > 5 heading > col5_no_header = np.loadtxt(filename, skiprows=1, usecols=(5), > dtype=dtype, unpack=True) > > > -Patrick > > > > > > > On Sat, Jan 3, 2009 at 11:39 AM, antonv > wrote: >> >> I am plotting the data in those csv files and the forst 4 columns >> in the >> files have the same title but the 5th has the name based on the >> date and >> time so it would be unique in each of the files. As I have about >> 600 files >> to batch process, adjusting my script manually is not an option. >> >> The way I have it for one test file is: >> >> r = mlab.csv2rec('test.csv') >> #i know that the column name for the 5th column is 'htsgw_12191800' >> #so to read the data in the 5th column i just use: >> z = r.htsgw_12191800 >> >> What i need is to be able to get that data by specifying the column >> number >> as that stays the same in all files. >> >> I'll look at numpy but I hope there is a simpler way. >> >> Thanks, >> Anton >> >> >> >> Patrick Marsh-2 wrote: >>> >>> I'm not sure what you are needing it for, but I would suggest >>> looking >>> into numpy's loadtxt function. You can use this to load the csv >>> data >>> into numpy arrays and pass the resulting arrays arround. >>> >>> -Patrick >>> >>> >>> >>> >>> >>> >>> On Sat, Jan 3, 2009 at 11:21 AM, antonv >>> wrote: Hi all, I have a lot of csv files to process, all of them with the same number of columns. The only issue is that each file has a unique column name for the fourth column. All the csv2rec examples I found are using the r.column_name format to access the data in that column which is of no use for me because of the unique names. Is there a way to access that data using the column number? I bet this should be something simple but I cannot figure it out... Thanks in advance, Anton -- View this message in context: http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> -- >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/csv2rec-column-names-tp21267055p21267232.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> -- >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] polar clockface
Hi all, Does anyone know if it's possible to make the polar plot look like a 12- or 24-hr clockface? I.e. 0 (or 12) at the top rather than the right, and labelled in 12ths (or 24ths) instead of degrees? Thanks, G -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Text zoom font size
Hi, I am extensively using the great interactive features of pylab. I'd like to use text in my figures and make it become larger when I zoom into it. (now it always remains the same absolute size in the figure). Is there a way to do this? (maybe its even possible to only show the text when a certain zoom level is reached?) Thanks a lot for any hints, Ulrich -- View this message in context: http://www.nabble.com/Text-zoom-font-size-tp21267362p21267362.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
Pierre GM wrote: > Note also that you are not limited to recarrays: you can use what's > called a flexible-type arrays, which still gives the possibility to > access individual fields by keys, without the overload of recarrays > (where fields can also be accessed as attributes). For example: > >>> x=np.array([(1,10.), (2,20.)], dtype=[('A',int),('B',float)]) > >>>x['A'] > array([1, 2]) True, but the problem in this case is that he wants to access by column number, which you can't really do with recarray or flexible dtype arrays. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] csv2rec column names
The recarrays were what csv2rec is returning and that's why I was using it. And this afternoon was the first time I was hearing about red arrays so I was trying to get my stuff done with the wrong tool. I've changed my code to use regular txt file loading and all works great. Thanks everybody for their help! Anton Sent from my iPhone On Jan 3, 2009, at 5:00 PM, Ryan May wrote: Pierre GM wrote: Note also that you are not limited to recarrays: you can use what's called a flexible-type arrays, which still gives the possibility to access individual fields by keys, without the overload of recarrays (where fields can also be accessed as attributes). For example: x=np.array([(1,10.), (2,20.)], dtype=[('A',int),('B',float)]) x['A'] array([1, 2]) True, but the problem in this case is that he wants to access by column number, which you can't really do with recarray or flexible dtype arrays. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users