我正在用Python matplotlib绘制叶绿素图。ax.text
或ax.annotate
函数有一些错误,我在这里发布帮助。你知道吗
A.当我使用下面的代码在地图上添加一些字符串时:
ax.annotate("LOL",xy=(114.5,38.5), xycoords = 'data',fontsize = 15,
fontstyle = 'italic',zorder =3) `
无论我如何更改xypairs,字符串“LOL”总是位于左下角的位置。如图所示:
http://i4.tietuku.com/620a3bb6052d7859.png
B.更改xycoords类型:
ax.annotate("LOL",xy=(0.4,0.6),xycoords='axes fraction',
fontsize = 15, fontstyle = 'italic',zorder =3,color = 'w')
如图所示:
http://i11.tietuku.com/f1e175b427377160.png
我想可能是投影设置的问题。为了添加地图比例,我选择tmerc
投影:
map = Basemap(projection='tmerc', lon_0 =xxx, lat_0 = xxx,
ellps = 'WGS84', llcrnrlon=xxx,llcrnrlat=xxx,urcrnrlon=xxx,
urcrnrlat=xxx,lat_ts=0,resolution='i',suppress_ticks=True)
当我使用map = basemap(llcrnrlon=xxx ,llcrnrlat=xxx, urcrnrlon=xxx, urcrnrlat=xxx)
时,xycoords = 'data'
类型工作得很好。你知道吗
但是我的字符是基于数据点(表示每个多边形的区域名称)的,data
类型是我需要选择的。因此,我想学习一些函数,可以将data
类型中的xypairs更改为axes fraction
类型。然后,问题就可以解决了!你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐