Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary

2011-09-08 Thread Jakob Malm
Picking up on an old thread. Hopefully Jeff is still listening in...

On 2010-04-04 23:24, Jeff Whitaker wrote:
 On 4/4/10 11:06 AM, Will Hewson wrote:
 Hi again Jeff et al...

 I've had a play around with the extra few lines of code - on paper this
 seems like it should solve the problems I'm experiencing. However, an
 error's being thrown up by the transform scalar function, as my lons and
 lats won't necessarily be increasing. The data I'm plotting is satellite
 data and so at the beginning and end of the orbit file lats go over the pole
 from 90 to -90, with a similar problem for the lons - whereby the data is
 taken across the satellite track. I've thought about sorting the data before
 passing it to transform_scalar but I'm always going to be left with the
 problem in either lats or lons.

 I've uploaded the file I'm currently working with this time. It's three
 columns of lons, lats and z values.

 Once again, many thanks for your help.

 Will.

 http://old.nabble.com/file/p28133659/test.plt test.plt


 Will:  Is it a regular lat/lon grid or a satellite swath?  If it's the
 latter, you can't use my solution.

 -Jeff

What if it _is_ a satellite swath? Can I get around the problem of
off-projection plotting with Basemap.pcolormesh()?
Example code and plots can be found at
http://pythonbits.blogspot.com/2011/09/i-have-problem-with-basemap-plotting.html

Thanks,
Jakob Malm

--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] stacked bar chart

2011-09-08 Thread xyz
Hello,
I have found
http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/histogram_demo_extended_05.hires.png
http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/histogram_demo_extended.py

How is it possible to the following draw stacked bar charts with number 
in the chart:
http://www.jpowered.com/php-scripts/stacked-bar-chart.htm
http://gnuplot.sourceforge.net/demo_4.2/showcase_plot.png

Thank you in advance.


--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] color bar ticks

2011-09-08 Thread Yves Revaz
Dear List,

how is it possible to change the color of the ticks of a colorbar,
created using :

cb = mpl.colorbar.ColorbarBase(ax, 
cmap=cmap,norm=norm,orientation='horizontal',format=formatter)


Thanks in advance !

yves

-- 
 (o o)
oOO--(_)--OOo---
   Dr. Yves Revaz
   Laboratory of Astrophysics
   Ecole Polytechnique Fédérale de Lausanne (EPFL)
   Observatoire de Sauverny Tel : ++ 41 22 379 24 28
   51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
   1290 Sauverny e-mail : yves.re...@epfl.ch
   SWITZERLAND  Web : http://www.lunix.ch/revaz/



--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] one pixel white border : bug ?

2011-09-08 Thread Yves Revaz
Dear List,

when I'm saving a plot with the option facecolor='k',
around my image, there is still a one pixel white border.

How is it possible to remove this ?

try for example this very simple script:
(using )

import pylab as pt
from numpy import *

x = arange(0,10)
y = x**2
pt.plot(x,y)

pt.savefig('qq.png',facecolor='k')


Thanks in advance.

yves

-- 
 (o o)
oOO--(_)--OOo---
   Dr. Yves Revaz
   Laboratory of Astrophysics
   Ecole Polytechnique Fédérale de Lausanne (EPFL)
   Observatoire de Sauverny Tel : ++ 41 22 379 24 28
   51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
   1290 Sauverny e-mail : yves.re...@epfl.ch
   SWITZERLAND  Web : http://www.lunix.ch/revaz/



--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] one pixel white border : bug ?

2011-09-08 Thread Benjamin Root
On Thu, Sep 8, 2011 at 10:30 AM, Yves Revaz yves.re...@epfl.ch wrote:

 Dear List,

 when I'm saving a plot with the option facecolor='k',
 around my image, there is still a one pixel white border.

 How is it possible to remove this ?

 try for example this very simple script:
 (using )

 import pylab as pt
 from numpy import *

 x = arange(0,10)
 y = x**2
 pt.plot(x,y)

 pt.savefig('qq.png',facecolor='k')


 Thanks in advance.

 yves


yves,

This might depend on the version of matplotlib and which backend you are
using.  I currently do not see this white line on my development build of
mpl using the GTKAgg backend.  What are you using?

Ben Root
--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] stacked bar chart

2011-09-08 Thread Benjamin Root
On Thu, Sep 8, 2011 at 7:11 AM, xyz mit...@op.pl wrote:

 Hello,
 I have found

 http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/histogram_demo_extended_05.hires.png

 http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/histogram_demo_extended.py

 How is it possible to the following draw stacked bar charts with number
 in the chart:
 http://www.jpowered.com/php-scripts/stacked-bar-chart.htm
 http://gnuplot.sourceforge.net/demo_4.2/showcase_plot.png

 Thank you in advance.


The histogram() function is merely a convenience function that performs both
the histogramming calculation and calls bar() under the hood.  Bar charts
are capable of being stacked using the bottom kwarg:

http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html

As for numbers with the bars:

http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo2.html

I hope this helps!
Ben Root
--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/___
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-08 Thread Matt Funk
Hi,
sorry that it has taken me so long to reply. Anyway, i could be wrong,
but i don't think that the code:
xi = np.linspace(llcrnlon,urcrnlon,1000)
yi = np.linspace(llcrnlat,urcrnlat,1000)

will produce a grid which gives the lat/lon coordinates with 1km
spacing. The reason being is that the distance between 2 lons (say
-117.731659 and -91.303642) is different depending on where you are in
terms of the latitude (i.e. the extreme examples are of course the north
pole vs the equator). So the above gives a regular grid in terms of
degrees but not in terms of distance.
Anyway, but the example was still helpful in terms of getting me started
with the griddata issue. In my experience the mlab.griddate fcn did not
work as well as the scipy.griddata (but that could be a user error as
well ... ). Not sure why though. It might be the size of my source data
and the destination grid. I had to upgrade to the 64-bit python to be
able to access enough memory.

thanks
matt



On 9/6/2011 12:36 PM, Aman Thakral wrote:
 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
 mailto: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
 mailto:Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Matt Funk
Research Associate
Plant and Environmental Scienc. Dept.
New Mexico State University

--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary

2011-09-08 Thread Jeff Whitaker
On 9/8/11 1:51 AM, Jakob Malm wrote:
 Picking up on an old thread. Hopefully Jeff is still listening in...

 On 2010-04-04 23:24, Jeff Whitaker wrote:
 On 4/4/10 11:06 AM, Will Hewson wrote:
 Hi again Jeff et al...

 I've had a play around with the extra few lines of code - on paper this
 seems like it should solve the problems I'm experiencing. However, an
 error's being thrown up by the transform scalar function, as my lons and
 lats won't necessarily be increasing. The data I'm plotting is satellite
 data and so at the beginning and end of the orbit file lats go over the pole
 from 90 to -90, with a similar problem for the lons - whereby the data is
 taken across the satellite track. I've thought about sorting the data before
 passing it to transform_scalar but I'm always going to be left with the
 problem in either lats or lons.

 I've uploaded the file I'm currently working with this time. It's three
 columns of lons, lats and z values.

 Once again, many thanks for your help.

 Will.

 http://old.nabble.com/file/p28133659/test.plt test.plt

 Will:  Is it a regular lat/lon grid or a satellite swath?  If it's the
 latter, you can't use my solution.

 -Jeff
 What if it _is_ a satellite swath? Can I get around the problem of
 off-projection plotting with Basemap.pcolormesh()?
 Example code and plots can be found at
 http://pythonbits.blogspot.com/2011/09/i-have-problem-with-basemap-plotting.html

 Thanks,
 Jakob Malm



Jakob: I think that's the price you pay for the speed of pcolormesh (vs 
pcolor).  It appears to make more assumptions about the structure of 
your data. I don't see any way around it.

-Jeff

--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users