[Matplotlib-users] TypeError when plotting dates on Windows 32 bit

2012-03-14 Thread Aman Thakral
I recently upgrade to Python 2.7 (I used EPD Free for the install which
comes with matplotlib 1.1.0) and I'm getting the following error when I try
to plot dates.  I've tried a few different backends, but they all seem to
give the same error.  I had no issues using Python 2.6 up to now.  I think
this may have to do with the new requirement in Python 2.7 that if you
passed a float to a function that was defined as an int, it now raises a
TypeError (instead of a DeprecationWarning).

Traceback (most recent call last):
  File C:\Python27\lib\site-packages\matplotlib\backends\backend_wx.py,
line 1289, in _onLeftButtonDown
FigureCanvasBase.button_press_event(self, x, y, 1, guiEvent=evt)
  File C:\Python27\lib\site-packages\matplotlib\backend_bases.py, line
1632, in button_press_event
self.callbacks.process(s, mouseevent)
  File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 256, in
process
proxy(*args, **kwargs)
  File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 189, in
__call__
return mtd(*args, **kwargs)
  File C:\Python27\lib\site-packages\matplotlib\backend_bases.py, line
1522, in pick
self.figure.pick(mouseevent)
  File C:\Python27\lib\site-packages\matplotlib\artist.py, line 332, in
pick
a.pick(mouseevent)
  File C:\Python27\lib\site-packages\matplotlib\axes.py, line 3038, in
pick
martist.Artist.pick(self,args[0])
  File C:\Python27\lib\site-packages\matplotlib\artist.py, line 332, in
pick
a.pick(mouseevent)
  File C:\Python27\lib\site-packages\matplotlib\artist.py, line 321, in
pick
self.figure.canvas.pick_event(mouseevent, self, **prop)
  File C:\Python27\lib\site-packages\matplotlib\backend_bases.py, line
1598, in pick_event
self.callbacks.process(s, event)
  File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 256, in
process
proxy(*args, **kwargs)
  File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 189, in
__call__
return mtd(*args, **kwargs)
  File C:\src\QC_DUAL\src\QC_DUAL\databrowser.py, line 284, in onpick
self.fig.canvas.draw()
  File
C:\Python27\lib\site-packages\matplotlib\backends\backend_wxagg.py, line
59, in draw
FigureCanvasAgg.draw(self)
  File C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py,
line 401, in draw
self.figure.draw(self.renderer)
  File C:\Python27\lib\site-packages\matplotlib\artist.py, line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File C:\Python27\lib\site-packages\matplotlib\figure.py, line 884, in
draw
func(*args)
  File C:\Python27\lib\site-packages\matplotlib\artist.py, line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File C:\Python27\lib\site-packages\matplotlib\axes.py, line 1983, in
draw
a.draw(renderer)
  File C:\Python27\lib\site-packages\matplotlib\artist.py, line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
  File C:\Python27\lib\site-packages\matplotlib\axis.py, line 1036, in
draw
ticks_to_draw = self._update_ticks(renderer)
  File C:\Python27\lib\site-packages\matplotlib\axis.py, line 926, in
_update_ticks
tick_tups = [ t for t in self.iter_ticks()]
  File C:\Python27\lib\site-packages\matplotlib\axis.py, line 873, in
iter_ticks
majorLocs = self.major.locator()
  File C:\Python27\lib\site-packages\matplotlib\dates.py, line 594, in
__call__
dates = self.rule.between(dmin, dmax, True)
  File C:\Python27\lib\site-packages\dateutil\rrule.py, line 207, in
between
for i in gen:
  File C:\Python27\lib\site-packages\dateutil\rrule.py, line 451, in _iter
dayset, start, end = getdayset(year, month, day)
  File C:\Python27\lib\site-packages\dateutil\rrule.py, line 797, in
ddayset
i = datetime.date(year, month, day).toordinal()-self.yearordinal
TypeError: integer argument expected, got float
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TypeError when plotting dates on Windows 32 bit

2012-03-14 Thread Aman Thakral
On Wed, Mar 14, 2012 at 2:16 PM, Aman Thakral aman.thak...@gmail.comwrote:

 I recently upgrade to Python 2.7 (I used EPD Free for the install which
 comes with matplotlib 1.1.0) and I'm getting the following error when I try
 to plot dates.  I've tried a few different backends, but they all seem to
 give the same error.  I had no issues using Python 2.6 up to now.  I think
 this may have to do with the new requirement in Python 2.7 that if you
 passed a float to a function that was defined as an int, it now raises a
 TypeError (instead of a DeprecationWarning).

 Traceback (most recent call last):
   File C:\Python27\lib\site-packages\matplotlib\backends\backend_wx.py,
 line 1289, in _onLeftButtonDown
 FigureCanvasBase.button_press_event(self, x, y, 1, guiEvent=evt)
   File C:\Python27\lib\site-packages\matplotlib\backend_bases.py, line
 1632, in button_press_event
 self.callbacks.process(s, mouseevent)
   File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 256, in
 process
 proxy(*args, **kwargs)
   File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 189, in
 __call__
 return mtd(*args, **kwargs)
   File C:\Python27\lib\site-packages\matplotlib\backend_bases.py, line
 1522, in pick
 self.figure.pick(mouseevent)
   File C:\Python27\lib\site-packages\matplotlib\artist.py, line 332, in
 pick
 a.pick(mouseevent)
   File C:\Python27\lib\site-packages\matplotlib\axes.py, line 3038, in
 pick
 martist.Artist.pick(self,args[0])
   File C:\Python27\lib\site-packages\matplotlib\artist.py, line 332, in
 pick
 a.pick(mouseevent)
   File C:\Python27\lib\site-packages\matplotlib\artist.py, line 321, in
 pick
 self.figure.canvas.pick_event(mouseevent, self, **prop)
   File C:\Python27\lib\site-packages\matplotlib\backend_bases.py, line
 1598, in pick_event
 self.callbacks.process(s, event)
   File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 256, in
 process
 proxy(*args, **kwargs)
   File C:\Python27\lib\site-packages\matplotlib\cbook.py, line 189, in
 __call__
 return mtd(*args, **kwargs)
   File C:\src\QC_DUAL\src\QC_DUAL\databrowser.py, line 284, in onpick
 self.fig.canvas.draw()
   File
 C:\Python27\lib\site-packages\matplotlib\backends\backend_wxagg.py, line
 59, in draw
 FigureCanvasAgg.draw(self)
   File C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py,
 line 401, in draw
 self.figure.draw(self.renderer)
   File C:\Python27\lib\site-packages\matplotlib\artist.py, line 55, in
 draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File C:\Python27\lib\site-packages\matplotlib\figure.py, line 884, in
 draw
 func(*args)
   File C:\Python27\lib\site-packages\matplotlib\artist.py, line 55, in
 draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File C:\Python27\lib\site-packages\matplotlib\axes.py, line 1983, in
 draw
 a.draw(renderer)
   File C:\Python27\lib\site-packages\matplotlib\artist.py, line 55, in
 draw_wrapper
 draw(artist, renderer, *args, **kwargs)
   File C:\Python27\lib\site-packages\matplotlib\axis.py, line 1036, in
 draw
 ticks_to_draw = self._update_ticks(renderer)
   File C:\Python27\lib\site-packages\matplotlib\axis.py, line 926, in
 _update_ticks
 tick_tups = [ t for t in self.iter_ticks()]
   File C:\Python27\lib\site-packages\matplotlib\axis.py, line 873, in
 iter_ticks
 majorLocs = self.major.locator()
   File C:\Python27\lib\site-packages\matplotlib\dates.py, line 594, in
 __call__
 dates = self.rule.between(dmin, dmax, True)
   File C:\Python27\lib\site-packages\dateutil\rrule.py, line 207, in
 between
 for i in gen:
   File C:\Python27\lib\site-packages\dateutil\rrule.py, line 451, in
 _iter
 dayset, start, end = getdayset(year, month, day)
   File C:\Python27\lib\site-packages\dateutil\rrule.py, line 797, in
 ddayset
 i = datetime.date(year, month, day).toordinal()-self.yearordinal
 TypeError: integer argument expected, got float


Ok, so I managed to track this down.  Apparently I was using a float
instead of an int in the interval argument of the HourLocator. I think
casting to the interval argument to int in the dates.HourLocator class
would be a good idea so users not familiar with the nuance won't have to
deal with this headache.
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] it is possible to use basemap to create regular spaced lat/lon grids?

2011-09-06 Thread Aman Thakral
Hi Matt,

Something like this?:

def create_map(ax, llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat):
m =
Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=(urcrnrlon+llcrnrlon)/2,lat_0=(urcrnrlat+llcrnrlat)/2)
m.drawcoastlines()
m.drawmapboundary()
m.drawstates(linewidth=3)
m.fillcontinents(color='lightgrey',lake_color='white')
m.drawcountries(linewidth=3)
return m


def plotMapData(ax,data):

lats = []
lons = []
val = []

for k,v in data.iteritems():
lats.append(float(k[0]))
lons.append(float(k[1]))
val.append(float(v))

value = np.array(val)
lat = np.array(lats)
lon = np.array(lons)

llcrnlon = lon.min()-0.5
llcrnlat = lat.min()-0.5
urcrnlon = lon.max()+0.5
urcrnlat = lat.max()+0.5

xi = np.linspace(llcrnlon,urcrnlon,1000)
yi = np.linspace(llcrnlat,urcrnlat,1000)
zi = griddata(lon,lat,value,xi,yi)

cmap = cm.jet
m = create_map(ax,llcrnlon,llcrnlat,urcrnlon,urcrnlat)
cs = ax.contour(xi,yi,zi,15,linewidth=0.5,cmap=cmap,alpha=0.5)
ax.contourf(xi,yi,zi,15,cmap=cmap,zorder=1000,alpha=0.5)

colorscale = cm.ScalarMappable()
colorscale.set_array(value)
colorscale.set_cmap(cmap)

colors = colorscale.to_rgba(value)
ax.scatter(lon,lat,c=colors,zorder=1000,cmap=cmap,s=10)
colorbar(colorscale, shrink=0.50, ax=ax,extend='both')


On Tue, Sep 6, 2011 at 1:28 PM, Matt Funk matze...@gmail.com wrote:

 Hi,
 i want to interpolate irregular spaced satellite data onto a regular
 spaced grid. The regular spaced grid should have cell sizes of 1km^2. Is
 it possible to use basemap to create such a grid. It looked like it
 includes some facilities like that, but i am not sure if they are meant
 to be used by end user or more like internal fcns (the makegrid fcn for
 example).

 Any advice would be appreciated.

 thanks
 matt


 --
 Special Offer -- Download ArcSight Logger for FREE!
 Finally, a world-class log management solution at an even better
 price-free! And you'll get a free Love Thy Logs t-shirt when you
 download Logger. Secure your free ArcSight Logger TODAY!
 http://p.sf.net/sfu/arcsisghtdev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Malware Security Report: Protecting Your Business, Customers, and the 
Bottom Line. Protect your business and customers by understanding the 
threat from malware and how it can impact your online business. 
http://www.accelacomm.com/jaw/sfnl/114/51427462/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting using Basemap and FigCanvasAgg with Matplotlib on a web server

2011-08-25 Thread Aman Thakral
Sorry about that.  I've attached a sample script.
-Aman

On Wed, Aug 24, 2011 at 9:05 PM, John Hunter jdh2...@gmail.com wrote:





 On Aug 24, 2011, at 4:09 PM, Aman Thakral aman.thak...@gmail.com wrote:

  Hi,
 
  I've recently created a web application, using Django, to dynamically
 create maps from weather data.  When I tried using FigCanvasAgg and
 figure.Figure, the image that was responded by the web server (using
 canvas.print_png and django.http.HttpResponse) did not show the map, just
 the scatter points.  When I just saved the figure (that was created using a
 matplotlib.pyplot.figure() instance) in folder that is statically available
 on the web server, the image is perfect.  There is an advantage to using the
 latter method as the saved images can be cached, but I'm curious as to why
 the FigCanvasAgg method doesn't work.
 
  Is this a known issue?  If so, are there any workarounds?
 
  Any help on this issue would be greatly appreciated.
 

 You will need to post an example script.


views.py
Description: Binary data
--
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting using Basemap and FigCanvasAgg with Matplotlib on a web server

2011-08-25 Thread Aman Thakral
OK, so it seems to be working if I use fig=plt.figure() instead of fig =
Figure() but I'm not sure why this is the case.

-Aman

On Thu, Aug 25, 2011 at 10:50 AM, Aman Thakral aman.thak...@gmail.comwrote:

 Sorry about that.  I've attached a sample script.
 -Aman


 On Wed, Aug 24, 2011 at 9:05 PM, John Hunter jdh2...@gmail.com wrote:





 On Aug 24, 2011, at 4:09 PM, Aman Thakral aman.thak...@gmail.com wrote:

  Hi,
 
  I've recently created a web application, using Django, to dynamically
 create maps from weather data.  When I tried using FigCanvasAgg and
 figure.Figure, the image that was responded by the web server (using
 canvas.print_png and django.http.HttpResponse) did not show the map, just
 the scatter points.  When I just saved the figure (that was created using a
 matplotlib.pyplot.figure() instance) in folder that is statically available
 on the web server, the image is perfect.  There is an advantage to using the
 latter method as the saved images can be cached, but I'm curious as to why
 the FigCanvasAgg method doesn't work.
 
  Is this a known issue?  If so, are there any workarounds?
 
  Any help on this issue would be greatly appreciated.
 

 You will need to post an example script.



--
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting using Basemap and FigCanvasAgg with Matplotlib on a web server

2011-08-24 Thread Aman Thakral
Hi,

I've recently created a web application, using Django, to dynamically create
maps from weather data.  When I tried using FigCanvasAgg and figure.Figure,
the image that was responded by the web server (using canvas.print_png and
django.http.HttpResponse) did not show the map, just the scatter points.
When I just saved the figure (that was created using a
matplotlib.pyplot.figure() instance) in folder that is statically available
on the web server, the image is perfect.  There is an advantage to using the
latter method as the saved images can be cached, but I'm curious as to why
the FigCanvasAgg method doesn't work.

Is this a known issue?  If so, are there any workarounds?

Any help on this issue would be greatly appreciated.

Thanks,
Aman
--
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Changing the radius of an existing CircleCollection

2011-07-06 Thread Aman Thakral
Hi All,

I have a wx application that uses a scatter plot on a map.  I am trying to
figure out how to change the radius of the circles of the existing scatter
plot.  My first thought would be to get a list of all the patches within the
CircleCollection instance so that I can just call the set_radius method for
the patches.Circle instance.  I haven't found a get the patches within a
collection though.  Is this possible?

Thanks,
Aman
--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] making a bar chart with time on xaxis

2011-05-27 Thread Aman Thakral
Hi Amy,

Use the vlines() function.  Its what I have used in the past.

Cheers,
Aman

On Fri, May 27, 2011 at 12:28 PM, Amy Zhang amy.xian.zh...@gmail.comwrote:

 Hello,

 I've created the following chart using matplotlib.pyplot.plot(). However, I
 would like to see the data points as bars from the bottom of the graph up to
 the points in order to more easily show the lack of data at certain dates.
 Is there a way to do this using plot()? If not, how do I go about making a
 bar chart using time as my xaxis? And how would I format the xticks so that
 only months are shown, as I have it now?

 Thank you,
 Amy


 --
 vRanger cuts backup time in half-while increasing security.
 With the market-leading solution for virtual backup and recovery,
 you get blazing-fast, flexible, and affordable data protection.
 Download your free trial now.
 http://p.sf.net/sfu/quest-d2dcopy1
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Aspect ratio of a circle

2011-03-09 Thread Aman Thakral
Hi Mads,

Did you add axis='equal' to you axes command?

e.g. ax = fig.add_subplot(111, aspect='equal')

-Aman

On Wed, Mar 9, 2011 at 6:07 AM, Mads Ipsen madsip...@gmail.com wrote:

 Hi,

 I am using the Qt4 based back engine for displaying a 2D plot in a
 widget. The plot typically contains lots of line plots. Suppose I add a
 CirclePolygon to the plot like this:

 circle = CirclePolygon((x,y), radius=0.04, edgecolor='black',
 facecolor='red', zorder=1)
 axes.add_patch(circle)

 Then when I start to zoom in the window the aspect ratio of the circle
 is not preserved (it appears like an ellipse). If you plot a line with
 points, displaying its points using circles, these circles do have their
 aspect ratio (and size) preserved. There must be some approach for
 achieving the same effect for a manually added circle.

 Any help is appreciated,

 Best regards,

 Mads

 --
 +--+
 | Mads Ipsen, Scientific developer |
 +---+--+
 | QuantumWise A/S   | phone:  +45-29716388 |
 | Lersø Parkallé 107| www: www.quantumwise.com |
 | DK-2100 Copenhagen Ø, Denmark | email:  mads.ip...@gmail.com |
 +---+--+




 --
 Colocation vs. Managed Hosting
 A question and answer guide to determining the best fit
 for your organization - today and in the future.
 http://p.sf.net/sfu/internap-sfd2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Aspect ratio of a circle

2011-03-09 Thread Aman Thakral
Could you provide some sample code that recreates the problem (and shows
what you're trying to accomplish)?

On Wed, Mar 9, 2011 at 8:58 AM, Mads Ipsen madsip...@gmail.com wrote:

  I tried that, but that will make the entire plot look very strange if xlim
 = [0;100] and ylim=[-1:1].

 What I really want to do is add a scale free aspect ratio correct circle to
 the plot. Just like the circles that appear on a scatter plot.

 Best regards,

 Mads


 On 2011-03-09 14:44, Aman Thakral wrote:

 Hi Mads,

 Did you add axis='equal' to you axes command?

 e.g. ax = fig.add_subplot(111, aspect='equal')

  -Aman

 On Wed, Mar 9, 2011 at 6:07 AM, Mads Ipsen madsip...@gmail.com wrote:

 Hi,

 I am using the Qt4 based back engine for displaying a 2D plot in a
 widget. The plot typically contains lots of line plots. Suppose I add a
 CirclePolygon to the plot like this:

 circle = CirclePolygon((x,y), radius=0.04, edgecolor='black',
 facecolor='red', zorder=1)
 axes.add_patch(circle)

 Then when I start to zoom in the window the aspect ratio of the circle
 is not preserved (it appears like an ellipse). If you plot a line with
 points, displaying its points using circles, these circles do have their
 aspect ratio (and size) preserved. There must be some approach for
 achieving the same effect for a manually added circle.

 Any help is appreciated,

 Best regards,

 Mads

 --
 +--+
 | Mads Ipsen, Scientific developer |
 +---+--+
 | QuantumWise A/S   | phone:  +45-29716388 |
 | Lersø Parkallé 107| www: www.quantumwise.com |
 | DK-2100 Copenhagen Ø, Denmark | email:  mads.ip...@gmail.com |
 +---+--+




 --
 Colocation vs. Managed Hosting
 A question and answer guide to determining the best fit
 for your organization - today and in the future.
 http://p.sf.net/sfu/internap-sfd2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



 --
 +--+
 | Mads Ipsen, Scientific developer |
 +---+--+
 | QuantumWise A/S   | phone:  +45-29716388 |
 | Lersø Parkallé 107| www: www.quantumwise.com |
 | DK-2100 Copenhagen Ø, Denmark | email:  mads.ip...@gmail.com |
 +---+--+



--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap interp nearest neighbor

2011-03-07 Thread Aman Thakral
On a similar note, are there any alternatives available to nearest
neighbor?  For example, kriging?  I remember seeing a geostats library in
python (hpgl i think), but I found the API rather impractical and difficult
to use.

Thanks,
Aman

On Mon, Mar 7, 2011 at 8:23 AM, Jeff Whitaker jsw...@fastmail.fm wrote:

 On 3/7/11 5:50 AM, Jeff Whitaker wrote:
  On 3/6/11 8:58 PM, Juan A. Saenz wrote:
  Hi,
 
  I use Basemap and netCDF4-python on a regular basis, and find them
  very useful tools. Thank you for developing them!
 
  I noticed that when using basemap.interp for nearest neighbor
  (order=0) the interpolation is not masked, and nearest neighbor masked
  values will be used in the interpolation. I was wondering if you could
  suggest a way to do nearest neighbor interpolation where masked are
  supported, i.e. nearest neighbor values that are not masked.
 
  Thanks for your help,
  Juan
 
  Juan:  I agree that this would be desirable behavior.  Unfortunately,
  it's not obvious to me how to do it.  I'll think about it and get back
  to you.  (cc'ing matplotlib-users list).
 
  -Jeff
 

 Juan: On second thought, I'm not sure this is desirable behavior.  I
 would guess that most of the time, if a nearest neighbor is masked, the
 user would expect the interpolation routine to return a masked value.  I
 would be interested to hear what others think.

 -Jeff



 --
 What You Don't Know About Data Connectivity CAN Hurt You
 This paper provides an overview of data connectivity, details
 its effect on application quality, and explores various alternative
 solutions. http://p.sf.net/sfu/progress-d2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to create space between two subplots?

2011-02-15 Thread Aman Thakral
Hi Omer,

use the subplots_adjust keyword argument (or click on the adjust
subplots icon in the navigation toolbar at the bottom of the figure).

http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.subplots_adjust

-Aman

On Tue, Feb 15, 2011 at 6:05 AM, Omer Khalid okhalid.c...@gmail.com wrote:
 Hi,
 I am trying to create two subplots in the same figure. Currently, the x-axis
 of first plot overlaps with the title of second plot.
 I was wondering if there is a function for figure object that allows to
 create vertical space between two plots so that the axis and title text
 doesn't overlap?
 Regards
 omer
 --
 The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
 Pinpoint memory and threading errors before they happen.
 Find and fix more than 250 security defects in the development cycle.
 Locate bottlenecks in serial and parallel code that limit performance.
 http://p.sf.net/sfu/intel-dev2devfeb
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matploblib multithreading

2011-02-14 Thread Aman Thakral
Have you looked into Celery? It is a queuing system with Django ORM
support.  I don't have any experience with it myself, but I have heard
good things about it.

-Aman

2011/2/14 wukan wekay102...@gmail.com:
 Hi ,When I use matplotlib to draw 2D graphics in django web site,I encounter
 a problem.
 when server users  use matplotlib to draw graphics simultaneously  will
 cause website collapse.
 when one user use matplotlib to draw graphics will have no problem.

 i suppose matplotlib doesnot support multithreading drawing.
 so i put the draw function in a thread . it can't work as before.

 so why matplotlib doesnot support multithreading drawing?
 How to solve this problem.
 Hope I can receive help from you.

 Regards

 wekay
 --
 The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
 Pinpoint memory and threading errors before they happen.
 Find and fix more than 250 security defects in the development cycle.
 Locate bottlenecks in serial and parallel code that limit performance.
 http://p.sf.net/sfu/intel-dev2devfeb
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Update individual elements (i.e an artist) for drawing

2011-02-09 Thread Aman Thakral
Hi,

I was just wondering, how would I go about redrawing only a single element
(i.e. an artist)? I know that matplotlib.artist.Artist has a draw() method
that accepts a renderer as the argument.

I tried something along the lines of:

renderer = fig.canvas.get_renderer()
title = ax.set_title(This is my title)
title.draw(renderer)

But have not had any luck.  I'm not sure what I'm missing.  Any help would
be greatly appreciated.

Thanks,
Aman
--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figure and Canvas

2010-11-12 Thread Aman Thakral
Hi Oliver,

Have you looked at any examples on the matplotlib site?  For instance,
there are several examples about how to use wxPython (wx) with matplotlib.
Also, there is a save feature currently available in current gui when you
run figure() (it is a floppy disk in navigation panel below the figure).

Aman


On Fri, Nov 12, 2010 at 5:20 AM, Olivier Verdier zelb...@gmail.com wrote:

 Hi,

 I would like to use matplotlib in a programmatic way.

 I thought about creating a Figure object (with no canvas), and plot in
 that Figure.

 Depending on what the user wants, I could then either plot on screen
 or save on file.

 The problem is that I don't know how to connect a Figure object to the
 FigureCanvas that the user chose in its preference file. In other
 words, I would like to do what the function figure() does, but for an
 existing Figure object.

 How could I do that?

 Thanks!

 == Olivier


 --
 Centralized Desktop Delivery: Dell and VMware Reference Architecture
 Simplifying enterprise desktop deployment and management using
 Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
 client virtualization framework. Read more!
 http://p.sf.net/sfu/dell-eql-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] automatically choose different line markers

2010-11-08 Thread Aman Thakral
Honestly, I can't even remember why it is wrapped.  I think this is just a
relic of some old example that I had lying around. Serves me right for just
copying and pasting without thinking :P .  A straight call to
itertools.cycle is definitely much cleaner.  Also, is there an example of
this in the docs?  If not, it would be a useful addition.  Seems like a
common feature to address.

Cheers,
Aman



On Mon, Nov 8, 2010 at 10:41 PM, Ryan May rma...@gmail.com wrote:

 On Fri, Nov 5, 2010 at 8:07 AM, Aman Thakral aman.thak...@gmail.com
 wrote:
  Hi,
 
  The best way to do this is to use a generator:
 
  import itertools
  import matplotlib.pyplot as plt
  import numpy as np
 
  def _ncycle(iterable,n):
  
  Method to create a generator from an iterable.  It keeps the
  current position of the iterable in memory.  Each time the
  next() method for the iterable is called, it will return the
  next item.  If there are no more items, it will cycle to the
  first item.
  
 
  for item in itertools.cycle(iterable):
  yield item
 
  colors = _ncycle(('r','g','b','c','y','m','k'),1)
  markers = _ncycle(('o','s','v'),1)

 I like the thought, but I'm not sure why you're making it so
 complicated by wrapping it. itertools.cycle by itself is perfect, and
 there's no reason to prime it by calling next() before the plot. The
 following is a bit more succint IMO:

 import itertools
 import matplotlib.pyplot as plt
 import numpy as np

 colors = itertools.cycle(['r','g','b','c','y','m','k'])
 markers = itertools.cycle(['o','s','v'])

 fig = plt.figure()
 ax = fig.add_subplot(111)
 for i in range(10):
x = np.linspace(0, 2*np.pi)
y = np.sin(x) + np.random.randn(*x.shape)
ax.plot(x, y, c=colors.next(), marker=markers.next())

 plt.show()

 Also, you can avoid calling colors.next() and markers.next() if you
 put them in a zip command along with range().

 Ryan

 --
 Ryan May
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] automatically choose different line markers

2010-11-05 Thread Aman Thakral
Hi,

The best way to do this is to use a generator:

import itertools
import matplotlib.pyplot as plt
import numpy as np

def _ncycle(iterable,n):

Method to create a generator from an iterable.  It keeps the
current position of the iterable in memory.  Each time the
next() method for the iterable is called, it will return the
next item.  If there are no more items, it will cycle to the
first item.


for item in itertools.cycle(iterable):
yield item

colors = _ncycle(('r','g','b','c','y','m','k'),1)
markers = _ncycle(('o','s','v'),1)
n = 20
fig = plt.figure()
ax = fig.add_subplot(111)

for i in range(n):
x = np.arange(0,10)
y = np.sin(x)+i-n/2
c = colors.next()
if c == 'r':
marker = markers.next()
ax.plot(x,y,c=c,marker=marker)

plt.show()




On Fri, Nov 5, 2010 at 8:29 AM, Neal Becker ndbeck...@gmail.com wrote:

 How can I automatically cycle through distinctive line markers?

 I want a semilog plot, composed of a number of lines.  Each line should
 have
 a different color and marker.

 Cycling through the colors is automatic, but not the markers.

 BTW, shouldn't this behavior be the default?  I would just like to say
 markers=True and get this behavior.



 --
 The Next 800 Companies to Lead America's Growth: New Video Whitepaper
 David G. Thomson, author of the best-selling book Blueprint to a
 Billion shares his insights and actions to help propel your
 business during the next growth cycle. Listen Now!
 http://p.sf.net/sfu/SAP-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bring the legend to the front of a plot

2010-09-27 Thread Aman Thakral
Hi,

I've managed to fix it.  It was a very simple solution.  The axes are added
in sequential, so I just used the latest axes to be added as the basis for
the legend.  I've attached a modification of a matplotlib example
(multiple_y_axis_with_splines.py) to show the behavior.

Perhaps the example should be updated.

Regards,
Aman

On Sun, Sep 26, 2010 at 10:48 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:

 Please post a sample script (short but complete) that demonstrates your
 problem.

 Regards,

 -JJ


 On Sat, Sep 25, 2010 at 12:41 AM, Aman Thakral aman.thak...@gmail.com
 wrote:
  Hi all,
  I'm using a draggable legend (class, not function) with axes splines.
  Whenever I plot the legend using the host axes, the legend appears to
 behind
  all of the lines.  I want the user to be able to drag the legend but I
  cannot select it when its inside the axes.  If I move it outside the axes
  (by setting the location), I can drag it around.  Is there anyway to
 bring
  the legend to the front?
 
  Thanks,
  Aman
 
 
 --
  Start uncovering the many advantages of virtual appliances
  and start using them to simplify application deployment and
  accelerate your shift to cloud computing.
  http://p.sf.net/sfu/novell-sfdev2dev
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design


multiple_y_axis_with_splines_mod.py
Description: Binary data
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Changing behavior of a Pick Event

2010-09-27 Thread Aman Thakral
Hi,

Is there a way to change the way a Pick event occurs?  Instead of a mouse
click, is it possible to use a mouse hover? I'm just curious because I'm
developing a wx application and would like to have a Tooltip over various
artists.

Thanks,
Aman
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Bring the legend to the front of a plot

2010-09-24 Thread Aman Thakral
Hi all,
I'm using a draggable legend (class, not function) with axes splines.
Whenever I plot the legend using the host axes, the legend appears to behind
all of the lines.  I want the user to be able to drag the legend but I
cannot select it when its inside the axes.  If I move it outside the axes
(by setting the location), I can drag it around.  Is there anyway to bring
the legend to the front?

Thanks,
Aman
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Mouse event blocked in 1.0 but works with 0.93 ?

2010-09-23 Thread Aman Thakral
Hi David,

I'm using the pick event in wx (matplotlib 1.0) without any issues.  Could
you please post some sample code?  Have you tried to see if
legend.draggable() works? If so, the pick event is likely not an issue.

-Aman

On Thu, Sep 23, 2010 at 4:20 AM, David Trémouilles david.t...@gmail.comwrote:

 Hello,

  I've just updated matplotlib to 1.0 svn version from 0.93.
 My pyqt4 app use the pick event. Cliking on a point in the graph
 triggers an event but with matplotlib 1.0 it does not anymore while
 it was working fine with 0.93.
 Any idea/help on where I should look for ?

 Thanks in advance,

 David


 --
 Start uncovering the many advantages of virtual appliances
 and start using them to simplify application deployment and
 accelerate your shift to cloud computing.
 http://p.sf.net/sfu/novell-sfdev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib/basemap plot geo data on background map

2010-09-10 Thread Aman Thakral
If you're just looking for points, you can use ax.scatter().  It will plot
the points.  Also, make sure you set the zorder keyword argument in the
scatter.

Example:
x=range(10)
y=range(10)
z=range(10,20)
ax.scatter(x,y,c=z,zorder=10)

Hope this helps,
Aman

On Fri, Sep 10, 2010 at 1:06 PM, izzybitsie isid...@juno.com wrote:


 Hi,
 I'm new to matplotlib and I'm looking for an easy way to plot geographical
 data on a background map: bkgmap.png
 http://old.nabble.com/file/p29679002/bkgmap.png
 So far I only found out about warpimage() to do this but only part of
 bkgmap.png comes up in the output image.  I think this is because this
 image
 has no pixels covering all the world.
 http://old.nabble.com/file/p29679002/partialbkg_polygon.png

 Any idea on how to insert this image as background?
 THANKS

 Code: the polygon displays in right position even though background doesn't
 show OK (tested with map,lat/lon lines drawn too)

 import sys
 import Image, ImageDraw  # PIL
 from matplotlib.patches import Polygon
 from mpl_toolkits.basemap import Basemap
 import matplotlib.image as mpimg
 import matplotlib.pyplot as plt
 import numpy as np

 lat0=48
 lon0=13
 lllon=-15
 lllat=20
 urlon=73
 urlat=57
 map =

 Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat,
  resolution='c',area_thresh=1000.)
 map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca())
 # points
 lat = [50.,55.,45.,40.,50.]
 lon = [-20.,-10.,10.,-10.,-20.]
 x0,y0 = map(lon[0],lat[0])
 x1,y1 = map(lon[1],lat[1])
 x2,y2 = map(lon[2],lat[2])
 x3,y3 = map(lon[3],lat[3])
 x4,y4 = map(lon[4],lat[4])

 plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black'))
 plt.show()
 --
 View this message in context:
 http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.



 --
 Start uncovering the many advantages of virtual appliances
 and start using them to simplify application deployment and
 accelerate your shift to cloud computing
 http://p.sf.net/sfu/novell-sfdev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Span Selector and Rectangular Selector in wxpython on Windows

2010-09-08 Thread Aman Thakral
Sorry,
This was just a silly mistake.  I forgot declare the selectors as class
variables (by adding self in front of them).
-Aman

On Tue, Sep 7, 2010 at 1:37 PM, Aman Thakral aman.thak...@gmail.com wrote:

 Hi,

 I seem to be encountering a strange problem.  I'm using a SpanSelector and
 a RectangularSelector in my application and they seem to be working in Linux
 but not in Windows. I'm using wxpython as the gui layer. Has anyone else
 encountered similar issues?

 Thanks,
 Aman




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib import warning

2010-09-08 Thread Aman Thakral
try this in the terminal:
python -c import matplotlib

-Aman

On Wed, Sep 8, 2010 at 12:17 PM, Gökhan Sever gokhanse...@gmail.com wrote:

 Hello,

 My usual ipython -pylab is giving me these warnings after I installed
 matplotlib from the source (matplotlib rev.8624 using python setupegg.py
 develop).

 /usr/lib/python2.6/site-packages/EPDLab-3.0.1.dev_r24658-py2.6.egg/enthought/__init__.py:7:
 UserWarning: Module dateutil was already imported from
 /home/user/Desktop/python-repo/matplotlib/lib/dateutil/__init__.pyc, but
 /usr/lib/python2.6/site-packages is being added to sys.path
   __import__('pkg_resources').declare_namespace(__name__)


 Under /site-packages in easy-install.pth I moved
 the /home/user/Desktop/python-repo/matplotlib/lib line to the very bottom of
 the file but this doesn't make any change.

 Any ideas how to remove this warning?

 --
 Gökhan


 --
 This SF.net Dev2Dev email is sponsored by:

 Show off your parallel programming skills.
 Enter the Intel(R) Threading Challenge 2010.
 http://p.sf.net/sfu/intel-thread-sfd
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Span Selector and Rectangular Selector in wxpython on Windows

2010-09-07 Thread Aman Thakral
Hi,

I seem to be encountering a strange problem.  I'm using a SpanSelector and a
RectangularSelector in my application and they seem to be working in Linux
but not in Windows. I'm using wxpython as the gui layer. Has anyone else
encountered similar issues?

Thanks,
Aman
--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Map displayed on a plot

2010-08-27 Thread Aman Thakral
Here is an example of the general usage for an orthographic projection.

def genMap(fig, ax, llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat):
fig.sca(ax)
m =
Basemap(resolution='i',projection='ortho',lon_0=(urcrnrlon+llcrnrlon)/2,lat_0=(urcrnrlat+llcrnrlat)/2)
m.drawcoastlines()
m.drawmapboundary(fill_color='aqua')
m.drawstates(linewidth=3)
m.fillcontinents(color='coral',lake_color='aqua')
m.drawcountries(linewidth=3)

where:
llcrnlon = lower left corner longitude
llcrnlat = lower left corner latitude
urcrnlon =upper right corner longitude
urcrnlat = upper right corner latitude


On Fri, Aug 27, 2010 at 1:39 PM, Brian Larsen balar...@lanl.gov wrote:

 Ben,

 I have but no where in there do I see (or at least understand) how to draw
 a map on top of a current figure with set bounds in data space...

 Cheers,

 Brian


 On Aug 27, 2010, at 11:24 AM, Benjamin Root wrote:

 On Fri, Aug 27, 2010 at 12:11 PM, Brian Larsen balar...@lanl.gov wrote:

 Hello all,

 I am plotting satellite orbit files and it looks really nice to plot an
 Earth in the center with the continents on it to orient people to where the
 spacecraft is.  Does anyway know how to do this?  All I seem to be able to
 do is create a whole globe as the figure.

 In this simple example:

 from pylab import *
 r = ndarray(40)
 r[:] = 3.3
 rad = linspace(0, 2*pi, 40)
 figure()
 subplot(111, polar=True)
 plot(rad, r, lw=3)
 draw()


 wouldn't it look great to have the earth plotted in the space up to 1.0
 (as measured in earth radii)?

 Thanks much,

 Brian



 Have you checked out the basemap tool?

 http://matplotlib.sourceforge.net/basemap/doc/html/

 Ben Root






 --

 Brian A. Larsen
 Space Science and Applications
 Group ISR-1
 Los Alamos National Laboratory
 PO Box 1663, MS-D466
 Los Alamos, NM 87545
 USA

 (For overnight add:
 SM-30, Bikini Atoll Road)

 Phone: 505-665-7691
 Fax:   505-665-7395
 email: balar...@lanl.gov

 Correspondence /
 Technical data or Software Publicly Available






 --
 Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
 Be part of this innovative community and reach millions of netbook users
 worldwide. Take advantage of special opportunities to increase revenue and
 speed time-to-market. Join now, and jumpstart your future.
 http://p.sf.net/sfu/intel-atom-d2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Labeling/distinguishing lots of curves on a single plot

2010-08-23 Thread Aman Thakral

Hi John,

Here is a simple way to do it.

import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)

colors = ('red','green','blue','yellow','orange')
linestyles = ('-','--',':')
linewidths = (0.5,2)

y = np.random.randn(100,30)
x = range(y.shape[0])
i = 0

for c in colors:
for ls in linestyles:
for lw in linewidths:
ax.plot(x,y[:,i],c=c,ls=ls,lw=lw)
i+=1
plt.show()


On 10-08-23 03:06 PM, John Salvatier wrote:

Hello,

I have a plot with lots of curves on it (say 30), and I would like to 
have some way of distinguishing the curves from each other. Just 
plotting them works well for a few curves because they come out as 
different colors unless you specify otherwise, but if you do too many 
you start getting repeats is there a way to have matplotlib also vary 
the line style that it automatically assigns? Or perhaps someone has 
another way of distinguishing lots of curves?


Best Regards,
John


--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   


--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Screenshot on homepage

2010-08-12 Thread Aman Thakral
Hi Simon,

I'm fairly sure its just a contour plot with different color mappings for
the lines and the fill.

There are several examples of this on the site.

Start here:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contour

Best of Luck,
Aman

On Thu, Aug 12, 2010 at 4:44 PM, Simon Friedberger 
simon+matplot...@a-oben.org simon%2bmatplot...@a-oben.org wrote:

 Hi list members.

 Does anybody know how to create the graph in the middle of this
 http://matplotlib.sourceforge.net/_static/logo_sidebar_horiz.png
 image on the homepage. I can't find it in the examples and suspect it
 may have been taken out in a previous revision. Does anybody remember?

 Best
 Simon


 --
 This SF.net email is sponsored by

 Make an app they can't live without
 Enter the BlackBerry Developer Challenge
 http://p.sf.net/sfu/RIM-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Text drawing outside plotting area when zoomed in

2010-07-22 Thread Aman Thakral
Hi all,

The text draws outside the plotting area when you zoom in.  Sample code is
attached.  To re-create the issue, just use the zoom rect function on the
plot.

Is there a way to fix this?

Thanks,
Aman


text_issue.py
Description: Binary data
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text drawing outside plotting area when zoomed in

2010-07-22 Thread Aman Thakral
Sorry, that was a silly question.  I just set the clip_on to True to fix
this.

On Thu, Jul 22, 2010 at 1:45 PM, Aman Thakral aman.thak...@gmail.comwrote:

 Hi all,

 The text draws outside the plotting area when you zoom in.  Sample code is
 attached.  To re-create the issue, just use the zoom rect function on the
 plot.

 Is there a way to fix this?

 Thanks,
 Aman




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Potential Bug with SpanSelector

2010-07-21 Thread Aman Thakral
Hi all,

I'm getting the following exception when I use the Span Selector.  It
happens when I try and select the entire region.

Exception in Tkinter callback

Traceback (most recent call last):
  File C:\Python26\lib\lib-tk\Tkinter.py, line 1410, in __call__
return self.func(*args)
  File C:\Python26\Lib\site-packages\matplotlib\backends\backend_tkagg.py,
line 246, in motion_notify_event
FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
  File C:\Python26\Lib\site-packages\matplotlib\backend_bases.py, line
1245, in motion_notify_event
self.callbacks.process(s, event)
  File C:\Python26\Lib\site-packages\matplotlib\cbook.py, line 165, in
process
func(*args, **kwargs)
  File C:\Python26\Lib\site-packages\matplotlib\widgets.py, line 952, in
onmove
self.rect.set_width(maxv-minv)
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'


My sample code is shown here (its also attached):

import matplotlib.pyplot as plt
from matplotlib.widgets import SpanSelector
import numpy as np
import datetime

class TimeSelector(SpanSelector):

SpanSelector that is only activated by the left mouse button

def ignore(self,event):
if event.button == 2 or event.button == 3: return True

def onselect(xmin,xmax):
print xmin,xmax

fig = plt.figure()
ax = fig.add_subplot(111)
span = TimeSelector(ax, onselect, 'horizontal', useblit=True,
rectprops=dict(alpha=0.5, facecolor='yellow') )

y = np.random.rand(100,1)
start = datetime.datetime(2010,7,15,0,0)
x = []
for i in range(len(y)):
x.append(start + datetime.timedelta(hours=i))

ax.plot_date(x,y,'b-')
plt.show()

Any help on this issue would be greatly appreciated.

Thanks,
Aman


spanselector_issue.py
Description: Binary data
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Potential Bug with SpanSelector

2010-07-21 Thread Aman Thakral
Update on the error.

It occurs in the following cases:
- User clicks and drags from left to right and approaches the edge of the
right side of the axes
- User clicks and drags from right to left and approaches the edge of the
left side of the axes

I'm working on this bug now, I'll see if I can fix it.  I'll welcome any
input you guys can provide though.

Thanks,
Aman

On Wed, Jul 21, 2010 at 1:58 PM, Aman Thakral aman.thak...@gmail.comwrote:

 Hi all,

 I'm getting the following exception when I use the Span Selector.  It
 happens when I try and select the entire region.

 Exception in Tkinter callback

 Traceback (most recent call last):
   File C:\Python26\lib\lib-tk\Tkinter.py, line 1410, in __call__
 return self.func(*args)
   File
 C:\Python26\Lib\site-packages\matplotlib\backends\backend_tkagg.py, line
 246, in motion_notify_event
 FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
   File C:\Python26\Lib\site-packages\matplotlib\backend_bases.py, line
 1245, in motion_notify_event
 self.callbacks.process(s, event)
   File C:\Python26\Lib\site-packages\matplotlib\cbook.py, line 165, in
 process
 func(*args, **kwargs)
   File C:\Python26\Lib\site-packages\matplotlib\widgets.py, line 952, in
 onmove
 self.rect.set_width(maxv-minv)
 TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'


 My sample code is shown here (its also attached):

 import matplotlib.pyplot as plt
 from matplotlib.widgets import SpanSelector
 import numpy as np
 import datetime

 class TimeSelector(SpanSelector):
 
 SpanSelector that is only activated by the left mouse button
 
 def ignore(self,event):
 if event.button == 2 or event.button == 3: return True

 def onselect(xmin,xmax):
 print xmin,xmax

 fig = plt.figure()
 ax = fig.add_subplot(111)
 span = TimeSelector(ax, onselect, 'horizontal', useblit=True,
 rectprops=dict(alpha=0.5, facecolor='yellow') )

 y = np.random.rand(100,1)
 start = datetime.datetime(2010,7,15,0,0)
 x = []
 for i in range(len(y)):
 x.append(start + datetime.timedelta(hours=i))

 ax.plot_date(x,y,'b-')
 plt.show()

 Any help on this issue would be greatly appreciated.

 Thanks,
 Aman




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Potential Bug with SpanSelector

2010-07-21 Thread Aman Thakral
Ok, so I've fixed it. Its just because the mouse goes outside the axes.  How
do I make the change in the code?

Error: line 924 in widgets.py

old code:

x,y = event.xdata, event.ydata

fixed code:

if not event.xdata is None:
x = event.xdata
else:
x = self.prev[0]

if not event.ydata is None:
y = event.ydata
else:
y = self.prev[1]

I know it's a bit verbose, but it works.

Thanks,
Aman

On Wed, Jul 21, 2010 at 2:44 PM, Aman Thakral aman.thak...@gmail.comwrote:

 Update on the error.

 It occurs in the following cases:
 - User clicks and drags from left to right and approaches the edge of the
 right side of the axes
 - User clicks and drags from right to left and approaches the edge of the
 left side of the axes

 I'm working on this bug now, I'll see if I can fix it.  I'll welcome any
 input you guys can provide though.

 Thanks,
 Aman


 On Wed, Jul 21, 2010 at 1:58 PM, Aman Thakral aman.thak...@gmail.comwrote:

 Hi all,

 I'm getting the following exception when I use the Span Selector.  It
 happens when I try and select the entire region.

 Exception in Tkinter callback

 Traceback (most recent call last):
   File C:\Python26\lib\lib-tk\Tkinter.py, line 1410, in __call__
 return self.func(*args)
   File
 C:\Python26\Lib\site-packages\matplotlib\backends\backend_tkagg.py, line
 246, in motion_notify_event
 FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
   File C:\Python26\Lib\site-packages\matplotlib\backend_bases.py, line
 1245, in motion_notify_event
 self.callbacks.process(s, event)
   File C:\Python26\Lib\site-packages\matplotlib\cbook.py, line 165, in
 process
 func(*args, **kwargs)
   File C:\Python26\Lib\site-packages\matplotlib\widgets.py, line 952, in
 onmove
 self.rect.set_width(maxv-minv)
 TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'


 My sample code is shown here (its also attached):

 import matplotlib.pyplot as plt
 from matplotlib.widgets import SpanSelector
 import numpy as np
 import datetime

 class TimeSelector(SpanSelector):
 
 SpanSelector that is only activated by the left mouse button
 
 def ignore(self,event):
 if event.button == 2 or event.button == 3: return True

 def onselect(xmin,xmax):
 print xmin,xmax

 fig = plt.figure()
 ax = fig.add_subplot(111)
 span = TimeSelector(ax, onselect, 'horizontal', useblit=True,
 rectprops=dict(alpha=0.5, facecolor='yellow') )

 y = np.random.rand(100,1)
 start = datetime.datetime(2010,7,15,0,0)
 x = []
 for i in range(len(y)):
 x.append(start + datetime.timedelta(hours=i))

 ax.plot_date(x,y,'b-')
 plt.show()

 Any help on this issue would be greatly appreciated.

 Thanks,
 Aman




 --
 Aman Thakral
 B.Eng  Biosci, M.Eng Design




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Update Colorbar

2010-07-12 Thread Aman Thakral
Hi,

Is there a way to get the current colorbar (or a list of colorbars) for the
current axes and update the mappable property? If an update is not possible,
i would like to replace the current colorbar with a new one.


I've tried something similar to the following:

import pylab as plt
fig = plt.figure()
ax = fig.add_subplot(111)
x = range(10)
y = range(10)
z = range(10)
scatter1 = ax.scatter(x,y,c=z,visible=False)
cbar = fig.colorbar(scatter1)
z = range(10,20)
scatter2 = ax.scatter(x,y,c=range(10,20),visible=True)
cbar.mappable = scatter2
plt.show()

but the colorbar is still on the range 0...9.

Also, is there a way to control the visibility of the colorbar?

Thanks,
Aman
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Updating Scatter Plot data

2010-07-07 Thread Aman Thakral
Hi,

I was just curious if there is a way to update the data for a scatter plot
similar to the set_data function for a axes.plot object?  The reason is
because I need to update a scatter plot at various zoom levels and
colors/distribution of the circles will change with the zoom level.  I
looked at the output from the get_paths and it does not correspond to the
vertices of circles that are in the plot.

Any help would be greatly appreciated.

Thanks,
Aman
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Updating Scatter Plot data

2010-07-07 Thread Aman Thakral
I found one method to work around this.  I iterate through the list of
collections by accessing the axes.collections list and checking to see if
the type of the collection is a CircleCollection.  If so, I remove the item
then redraw the collection for the appropriate zoom level.  This doesn't
really seem like an optimal way of doing this though.

-Aman

On Wed, Jul 7, 2010 at 4:36 PM, Aman Thakral aman.thak...@gmail.com wrote:

 Hi,

 I was just curious if there is a way to update the data for a scatter plot
 similar to the set_data function for a axes.plot object?  The reason is
 because I need to update a scatter plot at various zoom levels and
 colors/distribution of the circles will change with the zoom level.  I
 looked at the output from the get_paths and it does not correspond to the
 vertices of circles that are in the plot.

 Any help would be greatly appreciated.

 Thanks,
 Aman




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Adding Streets to a Basemap

2010-07-06 Thread Aman Thakral
Hi,

I have a cylindrical projection that I would like to add some streets on.  I
only need major highways in southern Ontario, Canada.  Is this functionality
included in the Basemap package, or would I have to find a customized
package/shape file (Openstreet?) ?

Thanks,
Aman
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adding Streets to a Basemap

2010-07-06 Thread Aman Thakral
Hi Jeff,

Thanks for your help.

The shapefile works great, but I cannot see the labels.  The DESCRIP
attribute in the shapefile has the labels, but I'm not sure how to apply
them to the map.

Thanks,
Aman

On Tue, Jul 6, 2010 at 9:27 AM, Jeff Whitaker jsw...@fastmail.fm wrote:

 On 7/6/10 7:07 AM, Aman Thakral wrote:

 Hi,

 I have a cylindrical projection that I would like to add some streets on.
  I only need major highways in southern Ontario, Canada.  Is this
 functionality included in the Basemap package, or would I have to find a
 customized package/shape file (Openstreet?) ?

 Thanks,
 Aman


 Aman:  Basemap does not include a streets database (only coastlines,
 rivers, lakes and political boundaries).   Shouldn't be too hard to find a
 shapefile that fits your needs though.

 -Jeff




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] zorder for individual points in a scatter plot on a Basemap

2010-06-29 Thread Aman Thakral

Hi,

I'm currently using a scatter plot on a Basemap and I'd like to set the 
zorder of the individual points based on their temperature.   The higher 
the temperature, the higher the zorder.  Also, i'm  using a colorbar to 
set the colors for the plot.  Here is a snippet of my code:


   x = np.array(val)
   fig.sca(ax1)
   lon_0 =(urcrnrlon+llcrnrlon)/2
   lat_0 =(urcrnrlat+llcrnrlat)/2
   m = 
Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,
   
urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=lon_0,lat_0=lat_0)

   m.drawcoastlines()
   m.drawmapboundary()
   m.drawparallels(np.arange(llcrnrlat-1,urcrnrlat+1,5.))
   m.drawmeridians(np.arange(llcrnrlon-1,urcrnrlon+1,5.))
   m.fillcontinents(color='white',lake_color='aqua')
   m.drawcountries(linewidth=1)
   lons,lats = m(lon,lat)
  
   #I can do it this way, but this screws up the colorbar

   #for i in range(len(x)):
   #
m.scatter(lons[i],lats[i],c=x[i],marker='o',picker=5,zorder=x[i])   

   m.scatter(lons,lats,c=x,marker='o',picker=5)   
   plt.title('Time Range: %s to %s'%(startDay.strftime(%b-%d 
%H:%M),endDay.strftime(%b-%d %H:%M)))

   plt.colorbar(shrink=0.5)

Is there anyway to set the zorder of the points without using the loop 
in commented code? Any help would be greatly appreciated.


Thanks,

Aman
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zorder for individual points in a scatter plot on a Basemap

2010-06-29 Thread Aman Thakral
Hi,

Thanks for the suggestions.  I also came the same conclusion about ordering
the arrays before hand.  This did the trick for the zorder, but I also have
to make the marker unique for each data point. I need to keep everything
into one artist since I'm using a pick event to display the data represented
by that point.  I'm not sure how I can use just 1 Artist, but get a variety
of distinct shapes (circles, squares, and triangles should be sufficient).

Thanks so much!
Aman

PS. Sorry about the duplicate emails Jeff.  I forgot to hit Reply to All
the first time.

On Tue, Jun 29, 2010 at 3:39 PM, Jeff Whitaker jsw...@fastmail.fm wrote:

  On 6/29/10 1:19 PM, Thomas Lecocq wrote:

 Hi,

 What about ordering the arrays before plotting ? Are the first elements
 drawn back to front ?

 Thomas

 **
 Thomas Lecocq
 Geologist
 Ph.D.Student (Seismology)
 Royal Observatory of Belgium
 **



 --
 Date: Mon, 28 Jun 2010 12:55:22 -0400
 From: athak...@weatherinnovations.com
 To: matplotlib-users@lists.sourceforge.net
 Subject: [Matplotlib-users] zorder for individual points in a scatter plot
 on a Basemap

 Hi,

 I'm currently using a scatter plot on a Basemap and I'd like to set the
 zorder of the individual points based on their temperature.   The higher the
 temperature, the higher the zorder.  Also, i'm  using a colorbar to set the
 colors for the plot.  Here is a snippet of my code:

 x = np.array(val)
 fig.sca(ax1)
 lon_0 =(urcrnrlon+llcrnrlon)/2
 lat_0 =(urcrnrlat+llcrnrlat)/2
 m =
 Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,

 urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=lon_0,lat_0=lat_0)
 m.drawcoastlines()
 m.drawmapboundary()
 m.drawparallels(np.arange(llcrnrlat-1,urcrnrlat+1,5.))
 m.drawmeridians(np.arange(llcrnrlon-1,urcrnrlon+1,5.))
 m.fillcontinents(color='white',lake_color='aqua')
 m.drawcountries(linewidth=1)
 lons,lats = m(lon,lat)

 #I can do it this way, but this screws up the colorbar
 #for i in range(len(x)):
 #
 m.scatter(lons[i],lats[i],c=x[i],marker='o',picker=5,zorder=x[i])

 m.scatter(lons,lats,c=x,marker='o',picker=5)
 plt.title('Time Range: %s to %s'%(startDay.strftime(%b-%d
 %H:%M),endDay.strftime(%b-%d %H:%M)))
 plt.colorbar(shrink=0.5)

 Is there anyway to set the zorder of the points without using the loop in
 commented code? Any help would be greatly appreciated.

 Thanks,


 Aman:  You can save the mappable from the scatter you want the colorbar to
 represent, then pass that to colorbar.  i.e.

 im = m.scatter(lons,lats,c=x,marker='o',picker=5) # plot all the pts, save
 mappable
 # now do one at a time

 for i in range(len(x)):
 m.scatter(lons[i],lats[i],c=x[i],marker='o',picker=5,zorder=x[i])
 plt.colorbar(im,shrink=0.5) # use mappable from 1st call to scatter for
 colorbar

 -Jeff

 --
 Jeffrey S. Whitaker Phone  : (303)497-6313
 Meteorologist   FAX: (303)497-6449
 NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
 325 BroadwayOffice : Skaggs Research Cntr 1D-113
 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg



 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] zorder for individual points in a scatter plot on a Basemap

2010-06-28 Thread Aman Thakral
 Hi,

I'm currently using a scatter plot on a Basemap and I'd like to set the
zorder of the individual points based on their temperature.   The higher the
temperature, the higher the zorder.  Also, i'm  using a colorbar to set the
colors for the plot.  Here is a snippet of my code:

x = np.array(val)
fig.sca(ax1)
lon_0 =(urcrnrlon+llcrnrlon)/2
lat_0 =(urcrnrlat+llcrnrlat)/2
m =
Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,

urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=lon_0,lat_0=lat_0)
m.drawcoastlines()
m.drawmapboundary()
m.drawparallels(np.arange(llcrnrlat-1,urcrnrlat+1,5.))
m.drawmeridians(np.arange(llcrnrlon-1,urcrnrlon+1,5.))
m.fillcontinents(color='white',lake_color='aqua')
m.drawcountries(linewidth=1)
lons,lats = m(lon,lat)

#I can do it this way, but this screws up the colorbar
#for i in range(len(x)):
#
m.scatter(lons[i],lats[i],c=x[i],marker='o',picker=5,zorder=x[i])

m.scatter(lons,lats,c=x,marker='o',picker=5)
plt.title('Time Range: %s to %s'%(startDay.strftime(%b-%d
%H:%M),endDay.strftime(%b-%d %H:%M)))
plt.colorbar(shrink=0.5)

Is there anyway to set the zorder of the points without using the loop in
commented code? Any help would be greatly appreciated.

Thanks,

Aman

-- 
Aman Thakral
B.Eng  Biosci, M.Eng Design
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users