简体   繁体   中英

Polar plot axes labels for Cartopy

Is there any support yet to allow axes labels for polar plots Cartopy? I note that using ax.gridlines(draw_labels=True) is only supported for PlateCarree and Mercator.

Additionally, ax.set_xticks only allows transformations from one rectangular coordinate system to another rectangular coordinate system.

Here is some code comparing Basemap with Cartopy. I'm wondering if anyone has developed a workaround to allow labelling.

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from mpl_toolkits.basemap import Basemap
import numpy as np

ax1 = plt.subplot(211)
m_north = Basemap(projection='nplaea',boundinglat=60,lon_0=0,ax=ax1)
m_north.drawcoastlines()
m_north.drawparallels(np.arange(-80.,81.,10.),labels=[1,0,0,0])
m_north.drawmeridians(np.arange(-180.,181.,30.),labels=[0,0,0,1])

ax2 = plt.subplot(212,projection=ccrs.NorthPolarStereo())
ax2.set_extent([0, 360, 60, 90], crs=ccrs.PlateCarree())
xticks = range(-180, 181, 60)
yticks = range(60, 90, 10)
ax2.set_xticks(xticks, crs=ccrs.NorthPolarStereo())
ax2.set_yticks(yticks, crs=ccrs.NorthPolarStereo())
ax2.coastlines()
ax2.gridlines()
plt.show()

No, unfortunately there is no support for this at present. Only the simplest and commonest forms have so far been coded, because the general case is just hard. For example, specifically regarding polar plots .. (1) in some places gridlines converge so it may be necessary to label only certain ones, and (2) some gridlines (eg meridians) can be entirely inside the plot area.

As of now, this is really just waiting for someone to take it on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM