[Matplotlib-users] Adjusting Image size

2010-09-10 Thread Nils Wagner
Hi all,

what is needed to save a figure when the size is given in 
pixels, i.e. 1024x772 ?
The default is 800x600 pixels.

from pylab import plot, savefig
from numpy import sin,linspace,pi
x = linspace(0,2*pi,200)
plot(x,sin(x))
savefig('test')

Nils

--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] problem in showing the plot!!!

2010-09-10 Thread sa6113

when I want to show the plot canvas, it doesn't stay at all, note that I need
to use backendQtagg, I mean when I use pylab there is no problem in
showing the plot canvas, what is the problem? please help me.
I use this simple code:

from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as
FigureCanvas
from matplotlib.figure import Figure

x = numarray.arange(10)
y = numarray.arange(10)
fig = Figure(figsize=(5, 5))

axes = fig.add_subplot(111)
axes.plot(x,y)
canvas   = FigureCanvas(   fig)
xlabel('sahar')
canvas.show()

The plot just winks.
-- 
View this message in context: 
http://old.nabble.com/problem-in-showing-the-plot%21%21%21-tp29675128p29675128.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem in showing the plot!!!

2010-09-10 Thread Benjamin Root
On Fri, Sep 10, 2010 at 4:44 AM, sa6113 s.payan...@gmail.com wrote:


 when I want to show the plot canvas, it doesn't stay at all, note that I
 need
 to use backendQtagg, I mean when I use pylab there is no problem in
 showing the plot canvas, what is the problem? please help me.
 I use this simple code:
 
 from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as
 FigureCanvas
 from matplotlib.figure import Figure

 x = numarray.arange(10)
 y = numarray.arange(10)
 fig = Figure(figsize=(5, 5))

 axes = fig.add_subplot(111)
 axes.plot(x,y)
 canvas   = FigureCanvas(   fig)
 xlabel('sahar')
 canvas.show()
 
 The plot just winks.


This is just a complete guess, but I wonder if you might be having
conflicting backends.  Try adding this to the beginning of your code.

import matplotlib
matplotlib.use('QtAgg')

Also, I wonder if you should be using Qt4Agg?

Ben Root
--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adjusting Image size

2010-09-10 Thread Tony S Yu

On Sep 10, 2010, at 5:27 AM, Nils Wagner wrote:

 Hi all,
 
 what is needed to save a figure when the size is given in 
 pixels, i.e. 1024x772 ?
 The default is 800x600 pixels.
 
 from pylab import plot, savefig
 from numpy import sin,linspace,pi
 x = linspace(0,2*pi,200)
 plot(x,sin(x))
 savefig('test')
 
 Nils

You can try creating a figure with the correct aspect ratio and then setting a 
corresponding dpi when you save:

#---
import matplotlib.pyplot as plt
import numpy as np

plt.figure(figsize=(10.24, 7.72))
x = np.linspace(0,2*np.pi,200)
plt.plot(x, np.sin(x))
plt.savefig('test', dpi=100)
#---

I had mixed results with this: I would occasionally get figures that were one 
pixel smaller than desired.

Best,
-Tony
--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adjusting Image size

2010-09-10 Thread Benjamin Root
On Fri, Sep 10, 2010 at 4:27 AM, Nils Wagner
nwag...@iam.uni-stuttgart.dewrote:

 Hi all,

 what is needed to save a figure when the size is given in
 pixels, i.e. 1024x772 ?
 The default is 800x600 pixels.

 from pylab import plot, savefig
 from numpy import sin,linspace,pi
 x = linspace(0,2*pi,200)
 plot(x,sin(x))
 savefig('test')

 Nils


Nils,

In matplotlib, you can specify a figure size in inches like so:

import matplotlib.pyplot as plt
from numpy import sin,linspace,pi

width_in = 10.0
width_px = 1024
height_px = 772
aspect = width_px / float(height_px)
height_in = width_in / aspect
dpi = width_px / width_in

x = linspace(0, 2*pi, 200)
fig = plt.figure(figsize=(width_in, height_in))
ax = fig.gca()
ax.plot(x, sin(x))

Then, when you save your figure, you can specify the dots per inch (dpi):

fig.savefig('test.png', dpi=dpi)

I hope this helps!
Ben Root
--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Thicker Frame and Remove Part of Frame

2010-09-10 Thread Ted Kord
Hi

How can I:

1. make the frame of the plot thicker and
2. remove the top and right of the frame.

Thanks

Ted
--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Thicker Frame and Remove Part of Frame

2010-09-10 Thread Tony S Yu

On Sep 10, 2010, at 10:42 AM, Ted Kord wrote:

 Hi
 
 How can I:
 
 1. make the frame of the plot thicker and
 2. remove the top and right of the frame.
 
 Thanks
 
 Ted

There are probably a number of ways to do this (partly because spines are 
relatively new). Here's one possibility:

import matplotlib.pyplot as plt

f, ax = plt.subplots()
ax.plot([0, 1])
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.spines['bottom'].set_linewidth(3)
ax.spines['left'].set_linewidth(3)
plt.show()

Best,
-Tony


--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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

2010-09-10 Thread izzybitsie

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


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] matplotlib/basemap plot geo data on background map

2010-09-10 Thread Jan Skowron
Hi,
documentation of mpl_toolkits.basemap.warpimage
(http://matplotlib.sourceforge.net/basemap/doc/html/api/basemap_api.html#mpl_toolkits.basemap.Basemap.warpimage)
states that it could only be used with a very specific set of images:
Specified image must have pixels covering the whole globe in a
regular lat/lon grid, starting and -180W and the South Pole., so your
image won't work - it is curved, there is no obvious (linear)
transformation from (x,y) to (lat, long). Examples of good images are
given here: 
http://earthobservatory.nasa.gov/Features/BlueMarble/BlueMarble_monthlies.php

There are easy ways to mimic your picture with native Basemap tools,
like in this examples:
http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html

But if you would specifically use your own image, the only way I see
is to come up with a transformation function transforming lat and long
coordinates to x,y coordinates of your specific picture. If you would
write such a function yourself than you could easily use ax.plot,
ax.scatter or any other plotting routine to place stuff in correct
place in respect to your picture. Giving (lat, long) of stuff you
would like to draw, than transforming to (x,y) with the function, and
than using those with plotting routines at the same axis you have
place your picture, with for example imshow routine with proper
zorder.

Hope this clears a problem a little bit,
JS


On Fri, Sep 10, 2010 at 13:06, 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


--
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 izzybitsie

Thanks for your answer. I'm actually looking to plot filled curves whose
points are lat/lon points on top of a given background map. The problem
experienced is misrepresentation of background map when I insert it using
warpimage(), the only function to do this I found so far.


Aman Thakral wrote:
 
 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
 
 

-- 
View this message in context: 
http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679748.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


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

2010-09-10 Thread izzybitsie

I tested the same plot with a background image in Mercator with same results
and I also tested with Mercator covering almost the entire world with the
same results. Only a little portion of the background image shows as
background although the polygon looks OK in all cases (with maps drawn and
with either background image).
Unfortunately, I must use the provided background images for my project.  
I may need to look for some other tool to accomplish drawing curves on a
provided background image instead of relying on matplotlib.  
I did not understand the need for me to write my own transformation
functions. I only used lat/lon-x/y for the points in the curve and the
polygon shows up OK. What should I write my own transformations for?
THANKS

izzybitsie wrote:
 
 Thanks for your answer. I'm actually looking to plot filled curves whose
 points are lat/lon points on top of a given background map. The problem
 experienced is misrepresentation of background map when I insert it using
 warpimage(), the only function to do this I found so far.
 
 
 Aman Thakral wrote:
 
 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
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679934.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


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

2010-09-10 Thread Jan Skowron
On Fri, Sep 10, 2010 at 14:46, izzybitsie isid...@juno.com wrote:
 I did not understand the need for me to write my own transformation
 functions. I only used lat/lon-x/y for the points in the curve and the
 polygon shows up OK. What should I write my own transformations for?

Because matplotlib (and possibly any other tool out there) have
absolutely no idea what transformation have you used to generate your
background picture in the first place. If you want to match grid of
coordinates of you picture with the grid of coordinates of what you
are trying to plot on top of it, you have to input this information
somehow.

And one possible way of doing this is taking a transformation function
which will be exactly the same as one used to generate your
background. I do not think there is some other, magical way of doing
this. This is not a matplotlib specific problem, it is a general
problem. But maybe someone else will correct me if I am wrong.

JS

--
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] colorbar questions ...

2010-09-10 Thread Oz Nahum
Hi Everyone,

First I must cryout a little bit :-) Why colorbar is always so tricky ???

I'm trying to fine tune the colorbar of my contour plots.
I would like to do the following things:

1) remove the box around it
2) hide the xticks
3) make the lines with the indicating colors with custom widths

so far I succeeded only with task 2 !

here is what I did:
cs=axs[4].contour(x,y,phcr1t,linestyles='solid',cmap=cm.jet_r)

a=fig.colorbar(cs,ax=axs[4],orientation='horizontal')
ticks = a.ax.get_xticklines()
#print getp(a.ax)
for tick in ticks:
setp(tick,alpha=0)


Would be great if someone could tell me how to do the 2 other things ...

Many thanks



-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--
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] Math fonts not working after upgrading to MPL 1.0

2010-09-10 Thread Andre' Walker-Loud
It may not be an MPL issue, but rather Snow Leopard.

I have a friend who had font troubles, but it was because Mac OSX 10.6  
(Snow Leopard) changed the way fonts are handled.  He had a file in  
his home directory (which he created on 10.5) which had some font  
specifications, which he had to alter/remove to fix his trouble.

I can't remember any more details, but thought I would share in case  
this helps.


Andre



On Sep 8, 2010, at 8:56 AM, Jeremy Conlin wrote:

 I have trouble getting any symbols or any super/sub scripts to work
 since I upgraded to 1.0 a few months ago.  I always get a message
 saying that some font isn't found.  This occurs whenever I try to put
 symbols, superscripts, or subscripts in a label, or when I use a log
 scale (because then it MPL has to use superscripts).  I have tried
 changing my matplotlibrc file but haven't found any combination of
 settings that help.

 To illustrate the problem, I have included three files, one python
 file and the other the error as captured from the output as well as my
 matplotlibrc file.  The python file is trivial:

 # -
 import matplotlib.pyplot as pyplot

 pyplot.plot([1,2,3], label='$\alpha  \beta$')

 pyplot.legend()
 pyplot.show()
 # -

 Can someone please help me figure out what is wrong?  I'm on a Mac
 running 10.6, python 2.6, matplotlib 1.0, and I have TeX installed.

 Thanks,
 Jeremy
  
 mathfonterror 
 .txt 
  
  
 mathfont 
 .py 
  
  
 matplotlibrc 
  
 --
 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


--
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] Installing matplotlib on MacOS X 10.6.4

2010-09-10 Thread Yannis Haralambous
dear Matplotlib users,

I can't manage to install matplotlib correctly on MacOS X 10.6.4.

when I launch the DMG installer 
matplotlib-1.0.0-python.org-py2.6-macosx10.4.mpkg
I get an error message, that my volume does not contain System Python 2.6.
I'm running a standard MacOS X 10.6.4 with python 2.6.1 running from /usr/bin
And I do have Python 2.6 installed in
/System/Library/Frameworks/Python.framework/Versions/2.6
Why does the installer doesn't sees it?

The reason I wanted to install matplotlib directly from DMG is that when I 
built it from source and then tried to use it, I got the error:

Traceback (most recent call last):
File ./herbscmd.py, line 163, in module
sys.exit(main(sys.argv))
File ./herbscmd.py, line 156, in main
from matplotlib.pylab import show,draw
File /Library/Python/2.6/site-packages/matplotlib/pylab.py, line 216, in 
module
from matplotlib import mpl # pulls in most modules
File /Library/Python/2.6/site-packages/matplotlib/mpl.py, line 2, in module
from matplotlib import axis
File /Library/Python/2.6/site-packages/matplotlib/axis.py, line 10, in 
module
import matplotlib.font_manager as font_manager
File /Library/Python/2.6/site-packages/matplotlib/font_manager.py, line 52, 
in module
from matplotlib import ft2font
ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib/ft2font.so, 
2): Symbol not found: _FT_Attach_File
Referenced from: /Library/Python/2.6/site-packages/matplotlib/ft2font.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/matplotlib/ft2font.so

I noticed that many people had that same error (just google on _FT_Attach_File, 
you will see) but I couldn't find a solution anywhere. This is why I turned to 
DMG installation, but it doesn't seem to work either. Could anyone help?

Thanks in advance!

-- 
---
Yannis Haralambous
Directeur d'études
Institut Télécom, Télécom Bretagne
Département Informatique
UMR CNRS 3192 Lab-STICC
Technopôle Brest Iroise
CS 83818, 29238 Brest Cedex 3, France
Tel: +33 2 29 00 14 27
Fax: +33 2 29 00 12 82
Email: yannis.haralamb...@telecom-bretagne.eu
Internet: http://omega.enstb.org/yannis
ICBM address: 48°21'31.57N 4°34'16.76W
---
...pour distinguer l'extérieur d'un aquarium,
mieux vaut n'être pas poisson

...the ball I threw while playing in the park
has not yet reached the ground

Es gab eine Zeit, wo ich nur ungern über Schubert sprechen,
nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen.

BEGIN:VCARD
VERSION:3.0
N:Haralambous;Yannis;;;
FN:Yannis Haralambous
ORG:Enseignant-chercheur\, TELECOM Bretagne;
EMAIL;type=INTERNET;type=WORK;type=pref:yannis.haralamb...@telecom-bretagne.eu
TEL;type=WORK;type=pref:+33 229001427
TEL;type=CELL:+33 607981626
TEL;type=WORK;type=FAX:+33 229001282
item1.ADR;type=WORK;type=pref:;;Département Informatique\, TELECOM Bretagne\, CS 83818;Brest Cedex 3;;29238;France
item1.X-ABADR:fr
X-ABUID:CD3E6B27-C13F-40A4-B2F7-8393D5CE6493\:ABPerson
END:VCARD

--
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] Multiple tick labels

2010-09-10 Thread Brian Larsen
Hello all, 

I feel like this is possible but I am having trouble figuring it out.  

I want to put extra labels on the ticks on the xaxis like in the upper panel of 
the figure
http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif

Following 
http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html 
doesn't seem to be the right thing.  

It seems that I can get the tick values from 
ax= gca()
ax.get_xticks()

and from here do the calculations on what the other labels should be 
(interpolate the spacecraft position).

but then how do a create another row of labels with the values that compute?  
For some reason 
ax.get_xmajorticklabels()[0].get_text() returns ''

Thanks much, 

Brian







-- 

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




--
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] Multiple tick labels

2010-09-10 Thread Eric Firing
On 09/10/2010 10:54 AM, Brian Larsen wrote:
 Hello all,

 I feel like this is possible but I am having trouble figuring it out.

 I want to put extra labels on the ticks on the xaxis like in the upper
 panel of the figure
 http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif

 Following
 http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html
 doesn't seem to be the right thing.

 It seems that I can get the tick values from
 ax= gca()
 ax.get_xticks()

 and from here do the calculations on what the other labels should be
 (interpolate the spacecraft position).

 but then how do a create another row of labels with the values that
 compute? For some reason
 ax.get_xmajorticklabels()[0].get_text() returns ''

 Thanks much,

 Brian

Brian,

Tick labels can have multiple lines, so you don't need extra axes.  If 
you don't mind setting the tick locations yourself, then you can do this:

plot([1,2,3])
ax = gca()
ax.set_xticks([0,1,2])
ax.set_xticklabels(['abc\nABC', 'def\nDEF\n123', 'qrz'])
draw() # or show() if you are not in interactive mode

If you need to have the ticks auto-generated using a Locator, then you 
can write a custom Formatter that does the calculations and generates 
the multi-line labels.

Eric

--
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