Reputation: 1
I just edit the code from http://matplotlib.github.com/basemap/users/tmerc.html
Than I got a empty image, no error report. But the origin code works fine.
thank you for your time
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
m = Basemap(llcrnrlon=-180,llcrnrlat=-90,urcrnrlon=180,urcrnrlat=90,
resolution='c',projection='tmerc',lon_0=0,lat_0=0)
m.drawcoastlines()
m.fillcontinents(color='coral')
m.drawparallels(np.arange(-80,81,20))
m.drawmeridians(np.arange(-180,180,20))
m.drawmapboundary(fill_color='aqua')
plt.title("Transverse Mercator Projection")
plt.show()
the image is here:
Upvotes: 0
Views: 1136
Reputation: 6267
I have found that the Basemap package can be a little buggy. I've plotted using a Mollweide projection and also could not get it to print to screen. However, I found that if I saved the figure before viewing, using the following:
canvas = matplotlib.backends.backend_agg.FigureCanvasAgg(fig)
canvas.print_figure("ANiXS.png")
that it worked just fine. Not an elegant solution, admittedly, but a solution.
Upvotes: 0