SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(5)
2
(6)
3
(4)
4
(9)
5
(7)
6
(16)
7
(5)
8
(10)
9
(2)
10
(3)
11
(9)
12
(1)
13
(13)
14
(1)
15
(13)
16
(5)
17
(3)
18
(14)
19
(17)
20
(14)
21
(15)
22
(6)
23
(6)
24
25
(4)
26
(4)
27
(4)
28
(11)
29
(7)
30
(1)

Showing 17 results of 17

From: Michael R. <raw...@ya...> - 2011年04月19日 23:58:40
I've set up the data file with comma delimiter and one space. Split command now:
(lat,lon)=line.strip().split(',')
Code runs without error but no points on the map. These two lines, however, do produce an asterisk at the proper location:
xpt,ypt = m(-75.0,43.0)
text(xpt,ypt,'*') 
I will strip the code down to bare minimum (take out reading of netCDF data file) and paste it here along with ten example lats,lons.
--- On Tue, 4/19/11, Ian Bell <ib...@pu...> wrote:
From: Ian Bell <ib...@pu...>
Subject: Re: [Matplotlib-users] plotting points/locations from data file
To: "Michael Rawlins" <raw...@ya...>
Cc: Mat...@li...
Date: Tuesday, April 19, 2011, 7:32 PM
The easiest solution would be to put a comma as the delimiter between the lat and lon, and then change split(' ') to split(','). Then everything should work fine. I exclusively work with comma separated files for this exact reason. You are right that I had a typo, it should be lons[i]. It looks like you have two spaces as the delimiter currently based on your copy-paste. That's why split doesn't give you two values. In general I recommend that you avoid two spaces as the delimiter, just going to cause problems.
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 7:26 PM, Michael Rawlins <raw...@ya...> wrote:
Sorry I should have mentioned that longitudes are negative; there is a '-' before each longitude, like so:
39.4670 -76.1670 
46.4000 -74.7670 
45.3830 -75.7170 
43.6170 -79.3830 
45.5170 -73.4170 
Also the plt.text line you sent had lon[i] rather than lons[i]. I corrected that and changed my longitudes to not have the '-' sign and the code ran without error. Could the '-' be causing a problem? I need to input the lat, lon as in the file as shown above.
Mike
--- On Tue, 4/19/11, Ian Bell <ib...@pu...> wrote:
From: Ian Bell <ib...@pu...>
Subject: Re: [Matplotlib-users] plotting points/locations from data file
To: "Michael Rawlins"
 <raw...@ya...>
Cc: Mat...@li...
Date: Tuesday, April 19, 2011, 7:22 PM
If you want to plot a given marker at the point, for instance a circle, replace the last line of my code plt.text...... with 
plt.plot(lats,lons,'o')
for a circle, or 
plt.plot(lats,lons,'s')
for a square. Refer to Plot for more information on the markers you can use. You are getting the error because you have a delimiter different than a single space, so it isn't splitting the line. Replace ' ' in the split command with your whitespace delimiter. Is it a tab? Then you want '\t' .
Good luck,
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 7:14 PM, Michael Rawlins <raw...@ya...> wrote:
Yes, there is whitespace between each lat and lon on each line. But, actually, I'd simply like to plot a dot at each location. The '1' was there in my example because I do not yet know how to plot a particular symbol. Here is what I got when I tried the code you just suggested. 
Traceback (most recent call last):
 File "test.py", line 319, in <module>
  (lat,lon)=line.strip().split(' ')
ValueError: too many values to unpack
There are 203 records in the data file. Line 319 of test.py is this:
(lat,lon)=line.strip().split(' ')
--- On Tue, 4/19/11, Ian Bell <ib...@pu...> wrote:
From: Ian Bell <ib...@pu...>
Subject: Re:
 [Matplotlib-users] plotting points/locations from data file
To: "Michael Rawlins" <raw...@ya...>
Cc: Mat...@li...
Date: Tuesday, April 19, 2011, 6:52 PM
To clarify, you are trying to read in a set of (lat,lon) points in a file that is space delimited, store the data, and then put a text marker at each point, with each point numbered in order? The critical part is that you want to use a list (or numpy array) instead of a dictionary. Something like this ought to do (don't have MPL on this computer though - pretty sure this should work):
lines=open('file.txt','r').readlines()
(lats,lons)=([],[])
for line in lines:
  (lat,lon)=line.strip().split(' ')
  lats.append(float(lat))
  lons.append(float(lon))
for i in range(len(lons)):
  plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
I'm sure there are a bunch of more compact ways to do this, but this should work.
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...> wrote:
I'm trying to plot a series of points/locations on a map. I'm reading the latitudes and longitudes from a file, with each lat, lon pair on each record (line). Here is the code:
def make_float(line):
  lati, longi = line.split()
  return float(lati), float(longi)
my_dict = {}
with open("file.txt") as f:
  for item in f:
    lati,longi = make_float(item)
    my_dict[lati] = longi
xpt,ypt = m(-76.1670,39.4670 )
plt.text(xpt,ypt,'1',color='white')
#print my_dict
The matplotlib code which I've previously used to plot a single point on the map is below, with longitude and latitude in ( ):
xpt,ypt = m(-70.758392,42.960445)
plt.text(xpt,ypt,'1',color='white')
When replacing (-70.758392,42.960445) with (longi,lati), the code plots only a single '1' at the location of just the last coordinate pair in the file. So now I only need to plot them all. Does the code I've implemented have an implicit loop to it?
Mike
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Ian B. <ib...@pu...> - 2011年04月19日 23:35:32
Have to say I whole-heartedly agree with Glenn. One problem I have run into
is a funky file headers where I want to skip lines 1,2,3, and 4, but line 3
is my real header line which doesn't work so well with either of the below
solutions. I had to write my own wrapper to deal with these weird types of
files.
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 7:32 PM, G Jones <gle...@gm...> wrote:
> You may find it easier to use mlab.csv2rec or numpy.loadtxt.
>
> e.g.
>
> data = csv2rec(filename,delimiter=' ')
> plot(data[:,0],data[:,1],'o')
>
>
>
> On Tue, Apr 19, 2011 at 4:26 PM, Michael Rawlins <raw...@ya...>wrote:
>
>>
>> Sorry I should have mentioned that longitudes are negative; there is a '-'
>> before each longitude, like so:
>>
>> 39.4670 -76.1670
>> 46.4000 -74.7670
>> 45.3830 -75.7170
>> 43.6170 -79.3830
>> 45.5170 -73.4170
>>
>>
>> Also the plt.text line you sent had lon[i] rather than lons[i]. I
>> corrected that and changed my longitudes to not have the '-' sign and the
>> code ran without error. Could the '-' be causing a problem? I need to input
>> the lat, lon as in the file as shown above.
>>
>> Mike
>>
>>
>> --- On *Tue, 4/19/11, Ian Bell <ib...@pu...>* wrote:
>>
>>
>> From: Ian Bell <ib...@pu...>
>> Subject: Re: [Matplotlib-users] plotting points/locations from data file
>> To: "Michael Rawlins" <raw...@ya...>
>> Cc: Mat...@li...
>> Date: Tuesday, April 19, 2011, 7:22 PM
>>
>>
>> If you want to plot a given marker at the point, for instance a circle,
>> replace the last line of my code plt.text...... with
>>
>> plt.plot(lats,lons,'o')
>>
>> for a circle, or
>>
>> plt.plot(lats,lons,'s')
>>
>> for a square. Refer to Plot<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot>for more information on the markers you can use. You are getting the error
>> because you have a delimiter different than a single space, so it isn't
>> splitting the line. Replace ' ' in the split command with your whitespace
>> delimiter. Is it a tab? Then you want '\t' .
>>
>> Good luck,
>> Ian
>>
>> ----
>> Ian Bell
>> Graduate Research Assistant
>> Herrick Labs
>> Purdue University
>> email: ib...@pu... <http://mc/compose?to=ib...@pu...>
>> cell: (607)227-7626
>>
>>
>> On Tue, Apr 19, 2011 at 7:14 PM, Michael Rawlins <raw...@ya...<http://mc/compose?to=raw...@ya...>
>> > wrote:
>>
>>
>> Yes, there is whitespace between each lat and lon on each line. But,
>> actually, I'd simply like to plot a dot at each location. The '1' was there
>> in my example because I do not yet know how to plot a particular symbol.
>> Here is what I got when I tried the code you just suggested.
>>
>> Traceback (most recent call last):
>> File "test.py", line 319, in <module>
>>
>> (lat,lon)=line.strip().split(' ')
>> ValueError: too many values to unpack
>>
>>
>> There are 203 records in the data file. Line 319 of test.py is this:
>>
>>
>> (lat,lon)=line.strip().split(' ')
>>
>>
>> --- On *Tue, 4/19/11, Ian Bell <ib...@pu...<http://mc/compose?to=ib...@pu...>
>> >* wrote:
>>
>>
>> From: Ian Bell <ib...@pu... <http://mc/compose?to=ib...@pu...>>
>> Subject: Re: [Matplotlib-users] plotting points/locations from data file
>> To: "Michael Rawlins" <raw...@ya...<http://mc/compose?to=raw...@ya...>
>> >
>> Cc: Mat...@li...<http://mc/compose?to=Mat...@li...>
>> Date: Tuesday, April 19, 2011, 6:52 PM
>>
>>
>> To clarify, you are trying to read in a set of (lat,lon) points in a file
>> that is space delimited, store the data, and then put a text marker at each
>> point, with each point numbered in order? The critical part is that you
>> want to use a list (or numpy array) instead of a dictionary. Something like
>> this ought to do (don't have MPL on this computer though - pretty sure this
>> should work):
>>
>> lines=open('file.txt','r').readlines()
>> (lats,lons)=([],[])
>> for line in lines:
>> (lat,lon)=line.strip().split(' ')
>> lats.append(float(lat))
>> lons.append(float(lon))
>>
>> for i in range(len(lons)):
>>
>> plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
>>
>> I'm sure there are a bunch of more compact ways to do this, but this
>> should work.
>>
>> Ian
>> ----
>> Ian Bell
>> Graduate Research Assistant
>> Herrick Labs
>> Purdue University
>> email: ib...@pu... <http://mc/compose?to=ib...@pu...>
>> cell: (607)227-7626
>>
>>
>> On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...<http://mc/compose?to=raw...@ya...>
>> > wrote:
>>
>>
>> I'm trying to plot a series of points/locations on a map. I'm reading the
>> latitudes and longitudes from a file, with each lat, lon pair on each record
>> (line). Here is the code:
>>
>> def make_float(line):
>> lati, longi = line.split()
>> return float(lati), float(longi)
>>
>> my_dict = {}
>> with open("file.txt") as f:
>> for item in f:
>> lati,longi = make_float(item)
>> my_dict[lati] = longi
>>
>> xpt,ypt = m(-76.1670,39.4670 )
>> plt.text(xpt,ypt,'1',color='white')
>>
>> #print my_dict
>>
>> The matplotlib code which I've previously used to plot a single point on
>> the map is below, with longitude and latitude in ( ):
>>
>> xpt,ypt = m(-70.758392,42.960445)
>> plt.text(xpt,ypt,'1',color='white')
>>
>> When replacing (-70.758392,42.960445) with (longi,lati), the code plots
>> only a single '1' at the location of just the last coordinate pair in the
>> file. So now I only need to plot them all. Does the code I've implemented
>> have an implicit loop to it?
>>
>> Mike
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Benefiting from Server Virtualization: Beyond Initial Workload
>> Consolidation -- Increasing the use of server virtualization is a top
>> priority.Virtualization can reduce costs, simplify management, and improve
>> application availability and disaster protection. Learn more about
>> boosting
>> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...<http://mc/compose?to=Mat...@li...>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Benefiting from Server Virtualization: Beyond Initial Workload
>> Consolidation -- Increasing the use of server virtualization is a top
>> priority.Virtualization can reduce costs, simplify management, and improve
>> application availability and disaster protection. Learn more about
>> boosting
>> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
From: Ian B. <ib...@pu...> - 2011年04月19日 23:32:54
The easiest solution would be to put a comma as the delimiter between the
lat and lon, and then change split(' ') to split(','). Then everything
should work fine. I exclusively work with comma separated files for this
exact reason. You are right that I had a typo, it should be lons[i]. It
looks like you have two spaces as the delimiter currently based on your
copy-paste. That's why split doesn't give you two values. In general I
recommend that you avoid two spaces as the delimiter, just going to cause
problems.
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 7:26 PM, Michael Rawlins <raw...@ya...>wrote:
>
> Sorry I should have mentioned that longitudes are negative; there is a '-'
> before each longitude, like so:
>
> 39.4670 -76.1670
> 46.4000 -74.7670
> 45.3830 -75.7170
> 43.6170 -79.3830
> 45.5170 -73.4170
>
>
> Also the plt.text line you sent had lon[i] rather than lons[i]. I
> corrected that and changed my longitudes to not have the '-' sign and the
> code ran without error. Could the '-' be causing a problem? I need to input
> the lat, lon as in the file as shown above.
>
> Mike
>
>
> --- On *Tue, 4/19/11, Ian Bell <ib...@pu...>* wrote:
>
>
> From: Ian Bell <ib...@pu...>
> Subject: Re: [Matplotlib-users] plotting points/locations from data file
> To: "Michael Rawlins" <raw...@ya...>
> Cc: Mat...@li...
> Date: Tuesday, April 19, 2011, 7:22 PM
>
>
> If you want to plot a given marker at the point, for instance a circle,
> replace the last line of my code plt.text...... with
>
> plt.plot(lats,lons,'o')
>
> for a circle, or
>
> plt.plot(lats,lons,'s')
>
> for a square. Refer to Plot<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot>for more information on the markers you can use. You are getting the error
> because you have a delimiter different than a single space, so it isn't
> splitting the line. Replace ' ' in the split command with your whitespace
> delimiter. Is it a tab? Then you want '\t' .
>
> Good luck,
> Ian
>
> ----
> Ian Bell
> Graduate Research Assistant
> Herrick Labs
> Purdue University
> email: ib...@pu... <http://mc/compose?to=ib...@pu...>
> cell: (607)227-7626
>
>
> On Tue, Apr 19, 2011 at 7:14 PM, Michael Rawlins <raw...@ya...<http://mc/compose?to=raw...@ya...>
> > wrote:
>
>
> Yes, there is whitespace between each lat and lon on each line. But,
> actually, I'd simply like to plot a dot at each location. The '1' was there
> in my example because I do not yet know how to plot a particular symbol.
> Here is what I got when I tried the code you just suggested.
>
> Traceback (most recent call last):
> File "test.py", line 319, in <module>
>
> (lat,lon)=line.strip().split(' ')
> ValueError: too many values to unpack
>
>
> There are 203 records in the data file. Line 319 of test.py is this:
>
>
> (lat,lon)=line.strip().split(' ')
>
>
> --- On *Tue, 4/19/11, Ian Bell <ib...@pu...<http://mc/compose?to=ib...@pu...>
> >* wrote:
>
>
> From: Ian Bell <ib...@pu... <http://mc/compose?to=ib...@pu...>>
> Subject: Re: [Matplotlib-users] plotting points/locations from data file
> To: "Michael Rawlins" <raw...@ya...<http://mc/compose?to=raw...@ya...>
> >
> Cc: Mat...@li...<http://mc/compose?to=Mat...@li...>
> Date: Tuesday, April 19, 2011, 6:52 PM
>
>
> To clarify, you are trying to read in a set of (lat,lon) points in a file
> that is space delimited, store the data, and then put a text marker at each
> point, with each point numbered in order? The critical part is that you
> want to use a list (or numpy array) instead of a dictionary. Something like
> this ought to do (don't have MPL on this computer though - pretty sure this
> should work):
>
> lines=open('file.txt','r').readlines()
> (lats,lons)=([],[])
> for line in lines:
> (lat,lon)=line.strip().split(' ')
> lats.append(float(lat))
> lons.append(float(lon))
>
> for i in range(len(lons)):
> plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
>
> I'm sure there are a bunch of more compact ways to do this, but this should
> work.
>
> Ian
> ----
> Ian Bell
> Graduate Research Assistant
> Herrick Labs
> Purdue University
> email: ib...@pu... <http://mc/compose?to=ib...@pu...>
> cell: (607)227-7626
>
>
> On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...<http://mc/compose?to=raw...@ya...>
> > wrote:
>
>
> I'm trying to plot a series of points/locations on a map. I'm reading the
> latitudes and longitudes from a file, with each lat, lon pair on each record
> (line). Here is the code:
>
> def make_float(line):
> lati, longi = line.split()
> return float(lati), float(longi)
>
> my_dict = {}
> with open("file.txt") as f:
> for item in f:
> lati,longi = make_float(item)
> my_dict[lati] = longi
>
> xpt,ypt = m(-76.1670,39.4670 )
> plt.text(xpt,ypt,'1',color='white')
>
> #print my_dict
>
> The matplotlib code which I've previously used to plot a single point on
> the map is below, with longitude and latitude in ( ):
>
> xpt,ypt = m(-70.758392,42.960445)
> plt.text(xpt,ypt,'1',color='white')
>
> When replacing (-70.758392,42.960445) with (longi,lati), the code plots
> only a single '1' at the location of just the last coordinate pair in the
> file. So now I only need to plot them all. Does the code I've implemented
> have an implicit loop to it?
>
> Mike
>
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...<http://mc/compose?to=Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
From: G J. <gle...@gm...> - 2011年04月19日 23:32:51
You may find it easier to use mlab.csv2rec or numpy.loadtxt.
e.g.
data = csv2rec(filename,delimiter=' ')
plot(data[:,0],data[:,1],'o')
On Tue, Apr 19, 2011 at 4:26 PM, Michael Rawlins <raw...@ya...>wrote:
>
> Sorry I should have mentioned that longitudes are negative; there is a '-'
> before each longitude, like so:
>
> 39.4670 -76.1670
> 46.4000 -74.7670
> 45.3830 -75.7170
> 43.6170 -79.3830
> 45.5170 -73.4170
>
>
> Also the plt.text line you sent had lon[i] rather than lons[i]. I
> corrected that and changed my longitudes to not have the '-' sign and the
> code ran without error. Could the '-' be causing a problem? I need to input
> the lat, lon as in the file as shown above.
>
> Mike
>
>
> --- On *Tue, 4/19/11, Ian Bell <ib...@pu...>* wrote:
>
>
> From: Ian Bell <ib...@pu...>
> Subject: Re: [Matplotlib-users] plotting points/locations from data file
> To: "Michael Rawlins" <raw...@ya...>
> Cc: Mat...@li...
> Date: Tuesday, April 19, 2011, 7:22 PM
>
>
> If you want to plot a given marker at the point, for instance a circle,
> replace the last line of my code plt.text...... with
>
> plt.plot(lats,lons,'o')
>
> for a circle, or
>
> plt.plot(lats,lons,'s')
>
> for a square. Refer to Plot<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot>for more information on the markers you can use. You are getting the error
> because you have a delimiter different than a single space, so it isn't
> splitting the line. Replace ' ' in the split command with your whitespace
> delimiter. Is it a tab? Then you want '\t' .
>
> Good luck,
> Ian
>
> ----
> Ian Bell
> Graduate Research Assistant
> Herrick Labs
> Purdue University
> email: ib...@pu... <http://mc/compose?to=ib...@pu...>
> cell: (607)227-7626
>
>
> On Tue, Apr 19, 2011 at 7:14 PM, Michael Rawlins <raw...@ya...<http://mc/compose?to=raw...@ya...>
> > wrote:
>
>
> Yes, there is whitespace between each lat and lon on each line. But,
> actually, I'd simply like to plot a dot at each location. The '1' was there
> in my example because I do not yet know how to plot a particular symbol.
> Here is what I got when I tried the code you just suggested.
>
> Traceback (most recent call last):
> File "test.py", line 319, in <module>
>
> (lat,lon)=line.strip().split(' ')
> ValueError: too many values to unpack
>
>
> There are 203 records in the data file. Line 319 of test.py is this:
>
>
> (lat,lon)=line.strip().split(' ')
>
>
> --- On *Tue, 4/19/11, Ian Bell <ib...@pu...<http://mc/compose?to=ib...@pu...>
> >* wrote:
>
>
> From: Ian Bell <ib...@pu... <http://mc/compose?to=ib...@pu...>>
> Subject: Re: [Matplotlib-users] plotting points/locations from data file
> To: "Michael Rawlins" <raw...@ya...<http://mc/compose?to=raw...@ya...>
> >
> Cc: Mat...@li...<http://mc/compose?to=Mat...@li...>
> Date: Tuesday, April 19, 2011, 6:52 PM
>
>
> To clarify, you are trying to read in a set of (lat,lon) points in a file
> that is space delimited, store the data, and then put a text marker at each
> point, with each point numbered in order? The critical part is that you
> want to use a list (or numpy array) instead of a dictionary. Something like
> this ought to do (don't have MPL on this computer though - pretty sure this
> should work):
>
> lines=open('file.txt','r').readlines()
> (lats,lons)=([],[])
> for line in lines:
> (lat,lon)=line.strip().split(' ')
> lats.append(float(lat))
> lons.append(float(lon))
>
> for i in range(len(lons)):
> plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
>
> I'm sure there are a bunch of more compact ways to do this, but this should
> work.
>
> Ian
> ----
> Ian Bell
> Graduate Research Assistant
> Herrick Labs
> Purdue University
> email: ib...@pu... <http://mc/compose?to=ib...@pu...>
> cell: (607)227-7626
>
>
> On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...<http://mc/compose?to=raw...@ya...>
> > wrote:
>
>
> I'm trying to plot a series of points/locations on a map. I'm reading the
> latitudes and longitudes from a file, with each lat, lon pair on each record
> (line). Here is the code:
>
> def make_float(line):
> lati, longi = line.split()
> return float(lati), float(longi)
>
> my_dict = {}
> with open("file.txt") as f:
> for item in f:
> lati,longi = make_float(item)
> my_dict[lati] = longi
>
> xpt,ypt = m(-76.1670,39.4670 )
> plt.text(xpt,ypt,'1',color='white')
>
> #print my_dict
>
> The matplotlib code which I've previously used to plot a single point on
> the map is below, with longitude and latitude in ( ):
>
> xpt,ypt = m(-70.758392,42.960445)
> plt.text(xpt,ypt,'1',color='white')
>
> When replacing (-70.758392,42.960445) with (longi,lati), the code plots
> only a single '1' at the location of just the last coordinate pair in the
> file. So now I only need to plot them all. Does the code I've implemented
> have an implicit loop to it?
>
> Mike
>
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...<http://mc/compose?to=Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Michael R. <raw...@ya...> - 2011年04月19日 23:27:07
Sorry I should have mentioned that longitudes are negative; there is a '-' before each longitude, like so:
39.4670 -76.1670 
46.4000 -74.7670 
45.3830 -75.7170 
43.6170 -79.3830 
45.5170 -73.4170 
Also the plt.text line you sent had lon[i] rather than lons[i]. I corrected that and changed my longitudes to not have the '-' sign and the code ran without error. Could the '-' be causing a problem? I need to input the lat, lon as in the file as shown above.
Mike
--- On Tue, 4/19/11, Ian Bell <ib...@pu...> wrote:
From: Ian Bell <ib...@pu...>
Subject: Re: [Matplotlib-users] plotting points/locations from data file
To: "Michael Rawlins" <raw...@ya...>
Cc: Mat...@li...
Date: Tuesday, April 19, 2011, 7:22 PM
If you want to plot a given marker at the point, for instance a circle, replace the last line of my code plt.text...... with 
plt.plot(lats,lons,'o')
for a circle, or 
plt.plot(lats,lons,'s')
for a square. Refer to Plot for more information on the markers you can use. You are getting the error because you have a delimiter different than a single space, so it isn't splitting the line. Replace ' ' in the split command with your whitespace delimiter. Is it a tab? Then you want '\t' .
Good luck,
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 7:14 PM, Michael Rawlins <raw...@ya...> wrote:
Yes, there is whitespace between each lat and lon on each line. But, actually, I'd simply like to plot a dot at each location. The '1' was there in my example because I do not yet know how to plot a particular symbol. Here is what I got when I tried the code you just suggested. 
Traceback (most recent call last):
 File "test.py", line 319, in <module>
  (lat,lon)=line.strip().split(' ')
ValueError: too many values to unpack
There are 203 records in the data file. Line 319 of test.py is this:
(lat,lon)=line.strip().split(' ')
--- On Tue, 4/19/11, Ian Bell <ib...@pu...> wrote:
From: Ian Bell <ib...@pu...>
Subject: Re:
 [Matplotlib-users] plotting points/locations from data file
To: "Michael Rawlins" <raw...@ya...>
Cc: Mat...@li...
Date: Tuesday, April 19, 2011, 6:52 PM
To clarify, you are trying to read in a set of (lat,lon) points in a file that is space delimited, store the data, and then put a text marker at each point, with each point numbered in order? The critical part is that you want to use a list (or numpy array) instead of a dictionary. Something like this ought to do (don't have MPL on this computer though - pretty sure this should work):
lines=open('file.txt','r').readlines()
(lats,lons)=([],[])
for line in lines:
  (lat,lon)=line.strip().split(' ')
  lats.append(float(lat))
  lons.append(float(lon))
for i in range(len(lons)):
  plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
I'm sure there are a bunch of more compact ways to do this, but this should work.
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...> wrote:
I'm trying to plot a series of points/locations on a map. I'm reading the latitudes and longitudes from a file, with each lat, lon pair on each record (line). Here is the code:
def make_float(line):
  lati, longi = line.split()
  return float(lati), float(longi)
my_dict = {}
with open("file.txt") as f:
  for item in f:
    lati,longi = make_float(item)
    my_dict[lati] = longi
xpt,ypt = m(-76.1670,39.4670 )
plt.text(xpt,ypt,'1',color='white')
#print my_dict
The matplotlib code which I've previously used to plot a single point on the map is below, with longitude and latitude in ( ):
xpt,ypt = m(-70.758392,42.960445)
plt.text(xpt,ypt,'1',color='white')
When replacing (-70.758392,42.960445) with (longi,lati), the code plots only a single '1' at the location of just the last coordinate pair in the file. So now I only need to plot them all. Does the code I've implemented have an implicit loop to it?
Mike
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Ian B. <ib...@pu...> - 2011年04月19日 23:22:32
If you want to plot a given marker at the point, for instance a circle,
replace the last line of my code plt.text...... with
plt.plot(lats,lons,'o')
for a circle, or
plt.plot(lats,lons,'s')
for a square. Refer to
Plot<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot>for
more information on the markers you can use. You are getting the
error
because you have a delimiter different than a single space, so it isn't
splitting the line. Replace ' ' in the split command with your whitespace
delimiter. Is it a tab? Then you want '\t' .
Good luck,
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 7:14 PM, Michael Rawlins <raw...@ya...>wrote:
>
> Yes, there is whitespace between each lat and lon on each line. But,
> actually, I'd simply like to plot a dot at each location. The '1' was there
> in my example because I do not yet know how to plot a particular symbol.
> Here is what I got when I tried the code you just suggested.
>
> Traceback (most recent call last):
> File "test.py", line 319, in <module>
>
> (lat,lon)=line.strip().split(' ')
> ValueError: too many values to unpack
>
>
> There are 203 records in the data file. Line 319 of test.py is this:
>
>
> (lat,lon)=line.strip().split(' ')
>
>
> --- On *Tue, 4/19/11, Ian Bell <ib...@pu...>* wrote:
>
>
> From: Ian Bell <ib...@pu...>
> Subject: Re: [Matplotlib-users] plotting points/locations from data file
> To: "Michael Rawlins" <raw...@ya...>
> Cc: Mat...@li...
> Date: Tuesday, April 19, 2011, 6:52 PM
>
>
> To clarify, you are trying to read in a set of (lat,lon) points in a file
> that is space delimited, store the data, and then put a text marker at each
> point, with each point numbered in order? The critical part is that you
> want to use a list (or numpy array) instead of a dictionary. Something like
> this ought to do (don't have MPL on this computer though - pretty sure this
> should work):
>
> lines=open('file.txt','r').readlines()
> (lats,lons)=([],[])
> for line in lines:
> (lat,lon)=line.strip().split(' ')
> lats.append(float(lat))
> lons.append(float(lon))
>
> for i in range(len(lons)):
> plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
>
> I'm sure there are a bunch of more compact ways to do this, but this should
> work.
>
> Ian
> ----
> Ian Bell
> Graduate Research Assistant
> Herrick Labs
> Purdue University
> email: ib...@pu... <http://mc/compose?to=ib...@pu...>
> cell: (607)227-7626
>
>
> On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...<http://mc/compose?to=raw...@ya...>
> > wrote:
>
>
> I'm trying to plot a series of points/locations on a map. I'm reading the
> latitudes and longitudes from a file, with each lat, lon pair on each record
> (line). Here is the code:
>
> def make_float(line):
> lati, longi = line.split()
> return float(lati), float(longi)
>
> my_dict = {}
> with open("file.txt") as f:
> for item in f:
> lati,longi = make_float(item)
> my_dict[lati] = longi
>
> xpt,ypt = m(-76.1670,39.4670 )
> plt.text(xpt,ypt,'1',color='white')
>
> #print my_dict
>
> The matplotlib code which I've previously used to plot a single point on
> the map is below, with longitude and latitude in ( ):
>
> xpt,ypt = m(-70.758392,42.960445)
> plt.text(xpt,ypt,'1',color='white')
>
> When replacing (-70.758392,42.960445) with (longi,lati), the code plots
> only a single '1' at the location of just the last coordinate pair in the
> file. So now I only need to plot them all. Does the code I've implemented
> have an implicit loop to it?
>
> Mike
>
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...<http://mc/compose?to=Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
From: Michael R. <raw...@ya...> - 2011年04月19日 23:14:59
Yes, there is whitespace between each lat and lon on each line. But, actually, I'd simply like to plot a dot at each location. The '1' was there in my example because I do not yet know how to plot a particular symbol. Here is what I got when I tried the code you just suggested. 
Traceback (most recent call last):
 File "test.py", line 319, in <module>
  (lat,lon)=line.strip().split(' ')
ValueError: too many values to unpack
There are 203 records in the data file. Line 319 of test.py is this:
(lat,lon)=line.strip().split(' ')
--- On Tue, 4/19/11, Ian Bell <ib...@pu...> wrote:
From: Ian Bell <ib...@pu...>
Subject: Re: [Matplotlib-users] plotting points/locations from data file
To: "Michael Rawlins" <raw...@ya...>
Cc: Mat...@li...
Date: Tuesday, April 19, 2011, 6:52 PM
To clarify, you are trying to read in a set of (lat,lon) points in a file that is space delimited, store the data, and then put a text marker at each point, with each point numbered in order? The critical part is that you want to use a list (or numpy array) instead of a dictionary. Something like this ought to do (don't have MPL on this computer though - pretty sure this should work):
lines=open('file.txt','r').readlines()
(lats,lons)=([],[])
for line in lines:
  (lat,lon)=line.strip().split(' ')
  lats.append(float(lat))
  lons.append(float(lon))
for i in range(len(lons)):
  plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
I'm sure there are a bunch of more compact ways to do this, but this should work.
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...> wrote:
I'm trying to plot a series of points/locations on a map. I'm reading the latitudes and longitudes from a file, with each lat, lon pair on each record (line). Here is the code:
def make_float(line):
  lati, longi = line.split()
  return float(lati), float(longi)
my_dict = {}
with open("file.txt") as f:
  for item in f:
    lati,longi = make_float(item)
    my_dict[lati] = longi
xpt,ypt = m(-76.1670,39.4670 )
plt.text(xpt,ypt,'1',color='white')
#print my_dict
The matplotlib code which I've previously used to plot a single point on the map is below, with longitude and latitude in ( ):
xpt,ypt = m(-70.758392,42.960445)
plt.text(xpt,ypt,'1',color='white')
When replacing (-70.758392,42.960445) with (longi,lati), the code plots only a single '1' at the location of just the last coordinate pair in the file. So now I only need to plot them all. Does the code I've implemented have an implicit loop to it?
Mike
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Paolo Z. <p.z...@ya...> - 2011年04月19日 23:08:33
I have resolved using the aspect setting.
I calculated the ratio between the two pixel dimensions and I use this 
value for aspect (if you want to shift the pixel size you can use the 
inverse of this value).
Thank you for the support!
Paolo
Il 18/04/2011 15:55, Joe Kington ha scritto:
> Actually, I think he's wanting a set aspect, right? Either way, it's 
> just "aspect=1.5" or "aspect=0.6667" depending on the orientation he 
> wants.
>
> On Mon, Apr 18, 2011 at 6:37 AM, Sebastian Berg 
> <seb...@si... <mailto:seb...@si...>> wrote:
>
> The solution is already the aspect='auto', ie:
>
> import numpy as np
> from matplotlib import pyplot as plt
> a = np.arange(100).reshape(10,10)
> plt.imshow(a, aspect='auto')
>
> aspect='auto' is what you were looking for, the documentation (as you
> probably already found is for example at:
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow
> or in interactive help.
>
>
> On Sun, 2011年04月17日 at 23:16 +0200, Paolo Zaffino wrote:
> > Thanks for the reply.
> > I checked in the help...I didn't understand what I must to use.
> > Should you post me the link of the guide of this setting?
> > Thanks!
> >
> >
> > Il 16/04/2011 10:47, Sebastian Berg ha scritto:
> > > Hello,
> > >
> > > check the help ;). you can set aspect='auto' or something fixed.
> > >
> > > Regards,
> > >
> > > Sebastian
> > >
> > > On Sat, 2011年04月16日 at 10:43 +0200, Paolo Zaffino wrote:
> > >> Hi at all,
> > >> I have a numpy matrix (an image) and I'd like to show it.
> > >> I thought to use show function, but I have a question.
> > >> I don't want that the pixel have dimension 1x1 unit but I
> want for
> > >> example 1X1.5 unit (I don't want a square but a rectangle).
> > >> How can I do this?
> > >> Thanks in advance.
> > >> Paolo
> > >>
> > >>
> ------------------------------------------------------------------------------
> > >> Benefiting from Server Virtualization: Beyond Initial Workload
> > >> Consolidation -- Increasing the use of server virtualization
> is a top
> > >> priority.Virtualization can reduce costs, simplify
> management, and improve
> > >> application availability and disaster protection. Learn more
> about boosting
> > >> the value of server virtualization.
> http://p.sf.net/sfu/vmware-sfdev2dev
> > >> _______________________________________________
> > >> Matplotlib-users mailing list
> > >> Mat...@li...
> <mailto:Mat...@li...>
> > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >>
> > >
> > >
> > >
> ------------------------------------------------------------------------------
> > > Benefiting from Server Virtualization: Beyond Initial Workload
> > > Consolidation -- Increasing the use of server virtualization
> is a top
> > > priority.Virtualization can reduce costs, simplify management,
> and improve
> > > application availability and disaster protection. Learn more
> about boosting
> > > the value of server virtualization.
> http://p.sf.net/sfu/vmware-sfdev2dev
> > > _______________________________________________
> > > Matplotlib-users mailing list
> > > Mat...@li...
> <mailto:Mat...@li...>
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Benefiting from Server Virtualization: Beyond Initial Workload
> > Consolidation -- Increasing the use of server virtualization is
> a top
> > priority.Virtualization can reduce costs, simplify management,
> and improve
> > application availability and disaster protection. Learn more
> about boosting
> > the value of server virtualization.
> http://p.sf.net/sfu/vmware-sfdev2dev
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> <mailto:Mat...@li...>
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and
> improve
> application availability and disaster protection. Learn more about
> boosting
> the value of server virtualization.
> http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Ian B. <ib...@pu...> - 2011年04月19日 22:53:01
To clarify, you are trying to read in a set of (lat,lon) points in a file
that is space delimited, store the data, and then put a text marker at each
point, with each point numbered in order? The critical part is that you
want to use a list (or numpy array) instead of a dictionary. Something like
this ought to do (don't have MPL on this computer though - pretty sure this
should work):
lines=open('file.txt','r').readlines()
(lats,lons)=([],[])
for line in lines:
 (lat,lon)=line.strip().split(' ')
 lats.append(float(lat))
 lons.append(float(lon))
for i in range(len(lons)):
 plt.text(lats[i],lon[i],str(i+1),ha='center',va='center',color='white')
I'm sure there are a bunch of more compact ways to do this, but this should
work.
Ian
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
On Tue, Apr 19, 2011 at 4:09 PM, Michael Rawlins <raw...@ya...>wrote:
>
> I'm trying to plot a series of points/locations on a map. I'm reading the
> latitudes and longitudes from a file, with each lat, lon pair on each record
> (line). Here is the code:
>
> def make_float(line):
> lati, longi = line.split()
> return float(lati), float(longi)
>
> my_dict = {}
> with open("file.txt") as f:
> for item in f:
> lati,longi = make_float(item)
> my_dict[lati] = longi
>
> xpt,ypt = m(-76.1670,39.4670 )
> plt.text(xpt,ypt,'1',color='white')
>
> #print my_dict
>
> The matplotlib code which I've previously used to plot a single point on
> the map is below, with longitude and latitude in ( ):
>
> xpt,ypt = m(-70.758392,42.960445)
> plt.text(xpt,ypt,'1',color='white')
>
> When replacing (-70.758392,42.960445) with (longi,lati), the code plots
> only a single '1' at the location of just the last coordinate pair in the
> file. So now I only need to plot them all. Does the code I've implemented
> have an implicit loop to it?
>
> Mike
>
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Michael R. <raw...@ya...> - 2011年04月19日 20:09:31
I'm trying to plot a series of points/locations on a map. I'm reading the latitudes and longitudes from a file, with each lat, lon pair on each record (line). Here is the code:
def make_float(line):
 lati, longi = line.split()
 return float(lati), float(longi)
my_dict = {}
with open("file.txt") as f:
 for item in f:
 lati,longi = make_float(item)
 my_dict[lati] = longi
xpt,ypt = m(-76.1670,39.4670 )
plt.text(xpt,ypt,'1',color='white')
#print my_dict
The matplotlib code which I've previously used to plot a single point on the map is below, with longitude and latitude in ( ):
xpt,ypt = m(-70.758392,42.960445)
plt.text(xpt,ypt,'1',color='white')
When replacing (-70.758392,42.960445) with (longi,lati), the code plots only a single '1' at the location of just the last coordinate pair in the file. So now I only need to plot them all. Does the code I've implemented have an implicit loop to it? 
Mike
From: Michael D. <md...@st...> - 2011年04月19日 16:57:45
Ok. I have a RHEL5 Linux box with Python 2.7.1.
With Numpy 1.4.1 and 1.5.1 I don't see any leaks. With Numpy git HEAD, 
I did see a leak -- I submitted a pull request to Numpy here:
 https://github.com/numpy/numpy/pull/76
I get the same results (no leaks) running your wx, tk and agg scripts 
(with the Windows-specific stuff removed).
FWIW, I have wxPython 2.8.11.0 and Tkinter rev 81008.
So the variables are the platform and the version of Python. Perhaps 
it's one of those two things?
Mike
On 04/19/2011 12:34 PM, Caleb Constantine wrote:
> On Tue, Apr 19, 2011 at 1:01 PM, Michael Droettboom<md...@st...> wrote:
> 
>> There's a lot of moving parts here. Running your script again is
>> showing some leaks in valgrind that weren't there before, but a number
>> of the underlying libraries have changed on my system since then (memory
>> leaks tend to be Whac-a-mole sometimes...)
>>
>> Which versions of the following are you running, and on what platform --
>> some variant of MS-Windows if I recall correctly?
>>
>> Python
>> Numpy
>> wxPython
>> Tkinter
>> 
> Windows XP SP 3
> Python - 2.6.6
> Numpy - 1.4.1
> wxPython - 2.8.11.0
> Tkinter - $Revision: 73770 $
>
> I'll install new versions of Numpy and wxPython (and maybe Python) and
> try again.
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Caleb C. <cad...@gm...> - 2011年04月19日 16:34:28
On Tue, Apr 19, 2011 at 1:01 PM, Michael Droettboom <md...@st...> wrote:
> There's a lot of moving parts here. Running your script again is
> showing some leaks in valgrind that weren't there before, but a number
> of the underlying libraries have changed on my system since then (memory
> leaks tend to be Whac-a-mole sometimes...)
>
> Which versions of the following are you running, and on what platform --
> some variant of MS-Windows if I recall correctly?
>
> Python
> Numpy
> wxPython
> Tkinter
Windows XP SP 3
Python - 2.6.6
Numpy - 1.4.1
wxPython - 2.8.11.0
Tkinter - $Revision: 73770 $
I'll install new versions of Numpy and wxPython (and maybe Python) and
try again.
From: Michael D. <md...@st...> - 2011年04月19日 15:32:57
There's a lot of moving parts here. Running your script again is 
showing some leaks in valgrind that weren't there before, but a number 
of the underlying libraries have changed on my system since then (memory 
leaks tend to be Whac-a-mole sometimes...)
Which versions of the following are you running, and on what platform -- 
some variant of MS-Windows if I recall correctly?
Python
Numpy
wxPython
Tkinter
Mike
On 04/19/2011 10:25 AM, Caleb Constantine wrote:
> This picks up from a thread of the same name between 18 Nov 2010 and
> 22 Nov 2010.
>
> Release 1.0.1 of matplotlib has made significant gains in reducing the
> memory leak (thanks!!), but it did not
> eliminate the problem entirely. Recall, the TkAgg back-end does not
> have any leak, so we know this particular
> leak is in matplotlib or wxPython.
>
> Here are the results of some tests.
>
> Matplotlib 1.0.0
>
> - 1 hour
> - Plotted 3595 times, about 1Hz
> - Memory usage increased by about 18.7MB (59.96 - 41.25), or about
> 5.3K per redraw.
>
> Matplotlib 1.0.1
>
> - 1 hour
> - Plotted 3601 times, about 1Hz
> - Memory usage increased by about 1.4MB (42.98 - 41.59), or about
> 0.40K per redraw.
>
> - 12 hour
> - Plotted 43201 times, about 1Hz
> - Memory usage increased by about 13.3MB (54.32 - 41.01), or about
> 0.32K per redraw.
>
> As stated before, for a process plotting data for long periods of
> time, this becomes an issue.
>
> Caleb
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Caleb C. <cad...@gm...> - 2011年04月19日 14:25:18
This picks up from a thread of the same name between 18 Nov 2010 and
22 Nov 2010.
Release 1.0.1 of matplotlib has made significant gains in reducing the
memory leak (thanks!!), but it did not
eliminate the problem entirely. Recall, the TkAgg back-end does not
have any leak, so we know this particular
leak is in matplotlib or wxPython.
Here are the results of some tests.
Matplotlib 1.0.0
- 1 hour
- Plotted 3595 times, about 1Hz
- Memory usage increased by about 18.7MB (59.96 - 41.25), or about
5.3K per redraw.
Matplotlib 1.0.1
- 1 hour
- Plotted 3601 times, about 1Hz
- Memory usage increased by about 1.4MB (42.98 - 41.59), or about
0.40K per redraw.
- 12 hour
- Plotted 43201 times, about 1Hz
- Memory usage increased by about 13.3MB (54.32 - 41.01), or about
0.32K per redraw.
As stated before, for a process plotting data for long periods of
time, this becomes an issue.
Caleb
From: Muffles <dan...@gm...> - 2011年04月19日 13:15:37
efiring wrote:
> 
> 
> Have you tried using vmin=1e4 above?
> 
> 
Well that did the trick...how did i miss that...thankyou!
-- 
View this message in context: http://old.nabble.com/Resize-the-colorbar-tp31425316p31432430.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Emanuele P. <ema...@tr...> - 2011年04月19日 08:53:26
Thank you all,
using mpl from git worked fine.
Problem solved.
Is there a deadline for the new version release ?
Emanuele Passera
Software Engineer
Tele-Rilevamento Europa - T.R.E. srl
Via Vittoria Colonna, 7
20149 Milano – Italia
Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230
ema...@tr... - www.treuropa.com
--
This communication, that may contain confidential and/or legally privileged
information, is intended solely for the use of the intended addressees.
Opinions, conclusions and other information contained in this message, that
do not relate to the official business of this firm, shall be considered as
not given or endorsed by it. Every opinion or advice contained in this
communication is subject to the terms and conditions provided by the
agreement governing the engagement with such a client. If you have received
this communication in error, please notify us immediately by responding to
this email and then delete it from your system. Any use, disclosure, copying
or distribution of the contents of this communication by a not-intended
recipient or in violation of the purposes of this communication is strictly
prohibited and may be unlawful.
--
On Tue, Apr 19, 2011 at 9:02 AM, Eric Firing <ef...@ha...> wrote:
> On 04/18/2011 12:46 AM, Emanuele Passera wrote:
> > Hello everybody,
> >
> > I am experiencing a strange behavior with the imshow() function when
> > using the nearest interpolation method.
> >
> > Executing the code listed below, I obtain a good image when using the
> > bilinear interpolation method
> > and a totally white image when using the nearest interpolation method.
> > I have attached the input data buffer and the resulting images too.
> >
> [...]
> >
> > I use matplotlib to generate a lot of images in batch mode and this
> > behavior appear not to be deterministic. It seems to depend on the input
> > data buffer.
> > Can anyone help me ?
> >
> > I use
> > Linux openSUSE 11.3 (x86_64)
> > Linux sat1 2.6.34.7-0.7-default #1 SMP 2010年12月13日 11:13:53 +0100 x86_64
> > x86_64 x86_64 GNU/Linux
> > Python 2.6.5
> > numpy 1.5.1
> > matplotlib 1.0.1 with backend Agg v2.2
> >
> >
> > If it can be of some help this strange behavior does not appear with a
> > system
> > Linux Ubuntu 9.10
> > Linux joshua 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC
> > 2009 i686 GNU/Linux
> > Python 2.6.4
> > numpy 1.3.0
> > matplotlib 0.99.0 with backend Agg v2.2
>
> Nor does it appear on my system with mpl from git, but it does with mpl
> 1.0.1, so it looks like this is something that was broken temporarily in
> the 1.0 series but is now fixed.
>
> Eric
>
> >
> > Executing the script with verbosity I get the subsequent output
> > python /users/lelepass/python/test_imagesc/test.py --verbose-helpful
> >
> > $HOME=/users/lelepass
> > CONFIGDIR=/users/lelepass/.matplotlib
> >
> > Bad key "numerix" on line 30 in
> > /users/lelepass/.matplotlib/matplotlibrc.
> > You probably need to get an updated matplotlibrc file from
> > http://matplotlib.sf.net/_static/matplotlibrc or from the matplotlib
> source
> > distribution
> > matplotlib data path
> /usr/lib64/python2.6/site-packages/matplotlib/mpl-data
> > loaded rc file /users/lelepass/.matplotlib/matplotlibrc
> > matplotlib version 1.0.1
> > verbose.level helpful
> > interactive is False
> > units is True
> > platform is linux2
> > Using fontManager instance from
> /users/lelepass/.matplotlib/fontList.cache
> > backend agg version v2.2
> > findfont: Matching
> >
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> > to Bitstream Vera Sans
> >
> (/usr/lib64/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> > with score of 0.000000
> >
> >
> > Thank you all.
> > Bye.
> >
> >
> >
> >
> >
> > Emanuele Passera
> >
> > Software Engineer
> >
> > Tele-Rilevamento Europa - T.R.E. srl
> > Via Vittoria Colonna, 7
> > 20149 Milano – Italia
> > Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230
> > ema...@tr... <mailto:ema...@tr...> -
> > www.treuropa.com <http://www.treuropa.com>
> >
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2011年04月19日 07:02:13
On 04/18/2011 12:46 AM, Emanuele Passera wrote:
> Hello everybody,
>
> I am experiencing a strange behavior with the imshow() function when
> using the nearest interpolation method.
>
> Executing the code listed below, I obtain a good image when using the
> bilinear interpolation method
> and a totally white image when using the nearest interpolation method.
> I have attached the input data buffer and the resulting images too.
>
[...]
>
> I use matplotlib to generate a lot of images in batch mode and this
> behavior appear not to be deterministic. It seems to depend on the input
> data buffer.
> Can anyone help me ?
>
> I use
> Linux openSUSE 11.3 (x86_64)
> Linux sat1 2.6.34.7-0.7-default #1 SMP 2010年12月13日 11:13:53 +0100 x86_64
> x86_64 x86_64 GNU/Linux
> Python 2.6.5
> numpy 1.5.1
> matplotlib 1.0.1 with backend Agg v2.2
>
>
> If it can be of some help this strange behavior does not appear with a
> system
> Linux Ubuntu 9.10
> Linux joshua 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC
> 2009 i686 GNU/Linux
> Python 2.6.4
> numpy 1.3.0
> matplotlib 0.99.0 with backend Agg v2.2
Nor does it appear on my system with mpl from git, but it does with mpl 
1.0.1, so it looks like this is something that was broken temporarily in 
the 1.0 series but is now fixed.
Eric
>
> Executing the script with verbosity I get the subsequent output
> python /users/lelepass/python/test_imagesc/test.py --verbose-helpful
>
> $HOME=/users/lelepass
> CONFIGDIR=/users/lelepass/.matplotlib
>
> Bad key "numerix" on line 30 in
> /users/lelepass/.matplotlib/matplotlibrc.
> You probably need to get an updated matplotlibrc file from
> http://matplotlib.sf.net/_static/matplotlibrc or from the matplotlib source
> distribution
> matplotlib data path /usr/lib64/python2.6/site-packages/matplotlib/mpl-data
> loaded rc file /users/lelepass/.matplotlib/matplotlibrc
> matplotlib version 1.0.1
> verbose.level helpful
> interactive is False
> units is True
> platform is linux2
> Using fontManager instance from /users/lelepass/.matplotlib/fontList.cache
> backend agg version v2.2
> findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> to Bitstream Vera Sans
> (/usr/lib64/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> with score of 0.000000
>
>
> Thank you all.
> Bye.
>
>
>
>
>
> Emanuele Passera
>
> Software Engineer
>
> Tele-Rilevamento Europa - T.R.E. srl
> Via Vittoria Colonna, 7
> 20149 Milano – Italia
> Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230
> ema...@tr... <mailto:ema...@tr...> -
> www.treuropa.com <http://www.treuropa.com>
>

Showing 17 results of 17

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /