Picon

basemap stereographic projection problem

I've been trying to help a friend who wants to plot directional data on a "Wulff net"
<http://en.wikipedia.org/wiki/Pole_figure#Geometry_in_the_pole_figure>, which is a
stereographic projection plot. She wants to plot points specified by latitude and longitude in degrees.
We hoped to be able to use the basemap toolkit's "stere" plot, centred at lat_0=0, lon_0=0, with limits set
at +/-90deg lat and +/-180deg lon, but we keep getting tracebacks and I wondered whether this is possible,
based on a comment from Jeff Whitaker
<http://www.nabble.com/-basemap--stereographic-projection-bounding-boxes-tf2170166.html#a6000978>
which implies that basemap's stereographic projection code can't handle these default limits. Is this
the case? Would it be asking too much to request a small sample of generating some Wulff-net axes? Plotting
points on these seems simple enough. We started with the polarmaps
 .py example and the code below is as close as we could get. Any suggestions would be welco
 me.

Gary Ruben

--

from matplotlib.toolkits.basemap import Basemap
from pylab import *

# loop over projections, one for each panel of the figure.
fig = figure(figsize=(4,4))
# setup map projection
m = Basemap(projection='stere',lat_0=0.,lon_0=0.,llcrnrlat=-50.,llcrnrlon=-120.,
urcrnrlat=90., urcrnrlon=90.)

ax = fig.add_subplot(1,1,1)
# draw parallels and meridians.
m.drawparallels(arange(-180.,180.,10.))
m.drawmeridians(arange(-90.,90.,10.))
(Continue reading)

Jochen Küpper | 1 Jun 09:54
Picon

Re: os x backends

On 31.05.2007, at 20:34, Jeff Whitaker wrote:

> The fink matplotlib package uses GTKAgg as the default backend, and
> works fine over an ssh tunnel.  The admin will have to:
>
> 0) make sure X11.app (and the X11 SDK) is installed.
> 1) install fink
> 2) run 'fink selfupdate'
> 3) run 'fink install matplotlib-py25' (and wait a few hours for
> everything to compile).

Same holds for MacPorts -- it has matplotlib in variants tk, gtk2,  
and wxPython.

I guess in your case you would need to convince yur Admin to install  
MacPorts, or install as a normal user, which might work -- that would  
then include gtk2 or wxWidgets as necessary.

Greetings,
Jochen
--

-- 
Einigkeit und Recht und Freiheit                http://www.Jochen- 
Kuepper.de
     Liberté, Égalité, Fraternité                GnuPG key: CC1B0B4D
         Sex, drugs and rock-n-roll

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
(Continue reading)

Jesper Larsen | 1 Jun 11:54
Picon
Favicon

Basemap reuse

Hi matplotlib users,

I have a small web application for calculating tsunami travel times 
(http://ocean.dmi.dk/apps/tsunami). The application uses matplotlib/basemap 
for producing contour maps of the tsunami travel times.

To speed up the response time of the application I made a version in which the 
calculations are performed for every second integer longitude and latitude 
for calculation windows of 60x60 degrees lon x lat, 90x90, 180x180 and 
global. This is a lot of plots for which I am making a new Basemap instances 
for each plot since:

llcrnrlon
llcrnrlat
urcrnrlon
urcrnrlat

differs for each plot. The initialization of the Basemap instances are 
responsible for the vast majority of the CPU usage in the application.

In converting the application to numpy (from numarray) I was wondering whether 
I could reduce the plotting time as well. Is it possible to reuse a Basemap 
instance somehow in my case or is that out of the question?

Regards,
Jesper

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
(Continue reading)

Jeff Whitaker | 1 Jun 13:48
Favicon

Re: basemap stereographic projection problem

gruben@... wrote:
> I've been trying to help a friend who wants to plot directional data on a "Wulff net"
<http://en.wikipedia.org/wiki/Pole_figure#Geometry_in_the_pole_figure>, which is a
stereographic projection plot. She wants to plot points specified by latitude and longitude in degrees.
We hoped to be able to use the basemap toolkit's "stere" plot, centred at lat_0=0, lon_0=0, with limits set
at +/-90deg lat and +/-180deg lon, but we keep getting tracebacks and I wondered whether this is possible,
based on a comment from Jeff Whitaker
<http://www.nabble.com/-basemap--stereographic-projection-bounding-boxes-tf2170166.html#a6000978>
which implies that basemap's stereographic projection code can't handle these default limits. Is this
the case? Would it be asking too much to request a small sample of generating some Wulff-net axes? Plotting
points on these seems simple enough. We started with the polarma
 ps.py example and the code below is as close as we could get. Any suggestions would be wel
 co
>  me.
>
> Gary Ruben
>
> --
>
> from matplotlib.toolkits.basemap import Basemap
> from pylab import *
>
> # loop over projections, one for each panel of the figure.
> fig = figure(figsize=(4,4))
> # setup map projection
> m = Basemap(projection='stere',lat_0=0.,lon_0=0.,llcrnrlat=-50.,llcrnrlon=-120.,
urcrnrlat=90., urcrnrlon=90.)
>            
> ax = fig.add_subplot(1,1,1)
> # draw parallels and meridians.
(Continue reading)

Jeff Whitaker | 1 Jun 14:06
Favicon

Re: Basemap reuse

Jesper Larsen wrote:
> Hi matplotlib users,
>
> I have a small web application for calculating tsunami travel times 
> (http://ocean.dmi.dk/apps/tsunami). The application uses matplotlib/basemap 
> for producing contour maps of the tsunami travel times.
>
> To speed up the response time of the application I made a version in which the 
> calculations are performed for every second integer longitude and latitude 
> for calculation windows of 60x60 degrees lon x lat, 90x90, 180x180 and 
> global. This is a lot of plots for which I am making a new Basemap instances 
> for each plot since:
>
> llcrnrlon
> llcrnrlat
> urcrnrlon
> urcrnrlat
>
> differs for each plot. The initialization of the Basemap instances are 
> responsible for the vast majority of the CPU usage in the application.
>
> In converting the application to numpy (from numarray) I was wondering whether 
> I could reduce the plotting time as well. Is it possible to reuse a Basemap 
> instance somehow in my case or is that out of the question?
>
> Regards,
> Jesper
>
>   
Jesper:  As long as you are using the cylindrical equidistant 
(Continue reading)

Gary Ruben | 1 Jun 16:03
Picon

Re: basemap stereographic projection problem

Many thanks for the special case code Jeff,
This appears to work well.
I see you picked up on our confusion about the -180 to 180 longitude 
range. I'll pass this on and look at clipping the lines outside the 
circle later,
regards,
Gary

Jeff Whitaker wrote:
> gruben@... wrote:
>> I've been trying to help a friend who wants to plot directional data 
>> on a "Wulff net" 
>> <http://en.wikipedia.org/wiki/Pole_figure#Geometry_in_the_pole_figure>, 
>> which is a stereographic projection plot. She wants to plot points 
>> specified by latitude and longitude in degrees. We hoped to be able to 
>> use the basemap toolkit's "stere" plot, centred at lat_0=0, lon_0=0, 
>> with limits set at +/-90deg lat and +/-180deg lon, but we keep getting 
>> tracebacks and I wondered whether this is possible, based on a comment 
>> from Jeff Whitaker 
>>
<http://www.nabble.com/-basemap--stereographic-projection-bounding-boxes-tf2170166.html#a6000978> 
>> which implies that basemap's stereographic projection code can't 
>> handle these default limits. Is this the case? Would it be asking too 
>> much to request a small sample of generating some Wulff-net axes? 
>> Plotting points on these seems simple enough. We started with the 
>> polarmaps.py example and the code below is as close as we could get. 
>> Any suggestions would be welco
>>  me.
>>
>> Gary Ruben
(Continue reading)

Jeff Whitaker | 1 Jun 18:52
Favicon

Re: Basemap reuse

Jesper Larsen wrote:
> Hi matplotlib users,
>
> I have a small web application for calculating tsunami travel times 
> (http://ocean.dmi.dk/apps/tsunami). The application uses matplotlib/basemap 
> for producing contour maps of the tsunami travel times.
>
> To speed up the response time of the application I made a version in which the 
> calculations are performed for every second integer longitude and latitude 
> for calculation windows of 60x60 degrees lon x lat, 90x90, 180x180 and 
> global. This is a lot of plots for which I am making a new Basemap instances 
> for each plot since:
>
> llcrnrlon
> llcrnrlat
> urcrnrlon
> urcrnrlat
>
> differs for each plot. The initialization of the Basemap instances are 
> responsible for the vast majority of the CPU usage in the application.
>
> In converting the application to numpy (from numarray) I was wondering whether 
> I could reduce the plotting time as well. Is it possible to reuse a Basemap 
> instance somehow in my case or is that out of the question?
>
> Regards,
> Jesper
>
>   

(Continue reading)

Matthew Auger | 1 Jun 19:16
Picon

Re: os x backends

I think we want to keep matplotlib associated with the OS X Framework 
install of python; if we installed the macports version, am I correct in 
assuming that we could just dump the resulting python modules (eg. gtk, 
tkinter, and matplotlib) into the Framework install's site-packages dir 
(or more likely my own PYTHONPATH dir) and disregard the macports distro 
of python?

On Fri, 1 Jun 2007, Jochen Küpper wrote:

> On 31.05.2007, at 20:34, Jeff Whitaker wrote:
>
>> The fink matplotlib package uses GTKAgg as the default backend, and
>> works fine over an ssh tunnel.  The admin will have to:
>> 
>> 0) make sure X11.app (and the X11 SDK) is installed.
>> 1) install fink
>> 2) run 'fink selfupdate'
>> 3) run 'fink install matplotlib-py25' (and wait a few hours for
>> everything to compile).
>
> Same holds for MacPorts -- it has matplotlib in variants tk, gtk2, and 
> wxPython.
>
> I guess in your case you would need to convince yur Admin to install 
> MacPorts, or install as a normal user, which might work -- that would then 
> include gtk2 or wxWidgets as necessary.
>
> Greetings,
> Jochen
>
(Continue reading)

Andrea Gavana | 1 Jun 21:29
Picon

Re: Plot vs Line Collections

Hi John,

On 5/31/07, John Hunter wrote:
> On 5/31/07, Andrea Gavana <andrea.gavana@...> wrote:
> > Hi All,
> >
> >     I am writing an application (wxPython based) which embeds a big
> > matplotlib figure as a main panel. Basically, this app shows oil well
> > producers and gas injectors on a 2D map as dots (every dot represents
> > its surface location), and a bunch of "streamlines" (i.e., straight
> > lines or simple curves) which connect injectors and producers.
> > As the numerical simulation continues, more and more streamlines are
> > added to the plot (because of new wells or because interference
> > between wells), and actually I end up having 200 dots plus 800-1200
> > lines. As the simulation progresses, the plots become slower and
> > slower...
> > As the lines are usually 2-points straight lines, I was thinking about
> > using Line Collections; however, every matplotlib line has a linewidth
> > value that is dependent on the calculated "interference" effect
> > between wells, which means I have to build a matplotlib line for every
> > line connecting an injector with a producer. Moreover, every injector
> > well has its own colour for the streamlines (there are 33 injector
> > wells).
> > Will Line Collections save some time in this case? If not, does anyone
> > have a suggestion on how I could try to speed-up the plotting? I am
> > not really familiar with some obscure line/axes properties, so I may
> > have overlooked something.
>
> Yes, a line collection will save you a lot of time with upwards of
> 1000 line segments.  This is the use case they were designed to solve:
(Continue reading)

Iyer | 1 Jun 21:44
Picon
Favicon

question on annotating subplot / size of markers

Hello,

I was wondering if it would be possible to draw a
vertical line in a subplot, in such a way that the
line exactly covers top to bottom of the subplot, say
- if the subplot has a height of 80 points, the
vertical line's length will be 80 points. Also, this
vertical line may have an horizontal line that starts
from it for a given length. like this |-------------;
| being the vertical line and ------------ being the
horizontal line. 

Is there any way to implement this in Matplotlib. It'd
also be nice to have a text annotating the horizontal
and vertical line, something like this:

 
-------------------------------------------------------
  |	        |					|
  |annotation1  |----------------------------     	|
subplot 	     
  |     	|					|
  |	        |					|
  |	        |					|

-------------------------------------------------------

There likely will be 3-4 subplots like the above in a
figure. The 3-4 subplots contain a plot of some data.
In effect, it is like placing an annotation on the
(Continue reading)


Gmane