Dear all,
I am trying to add a rectangle in a basemap map that reside in a inlined
axis.
I am basing this exercise on the following code:
(from
http://old.nabble.com/display-a-filled-lat-lon-basemap-rectangle.-td28169736.html
)
from matplotlib.patches import Polygon
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
map = Basemap(projection='moll',lon_0=0)
x1,y1 = map(-10,-10)
x2,y2 = map(-10,10)
x3,y3 = map(10,10)
x4,y4 = map(10,-10)
p =
Polygon([(x1,y1),(x2,y2),(x3,y3),(x4,y4)],facecolor='red',edgecolor='blue',linewidth=2)
plt.gca().add_patch(p)
map.drawcoastlines()
map.drawmapboundary()
I can change the last part to:
ax1 = plt.subplot(111)
ax1.add_patch(p)
map.ax = ax1
map.drawcoastlines()
map.drawmapboundary()
Which works fine. What I want is to create an extra axis for the map:
ax1 = plt.subplot(111)
ax2 = plt.axes([0.13,0.07,0.25,0.25])
ax2.add_patch(p)
map.ax = ax2
map.drawcoastlines()
map.drawmapboundary()
The map is drawn correctly, but the patch doesn't show up. What am I doing
wrong?
Thanks for any help!!!
:-)Bror Jonsson
=============================================================
Post Doctoral Research Associate
Princeton University
Department of Geosciences
113 Guyot Hall
Princeton, NJ 08544-1003
USA
AIM, Skype, gTalk: brorfred
Phone: +1-617-818-1096
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users