You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method of retrieving gridline ticks may be useful for adding the function:
# create grid
gridliner = ax.gridlines(draw_labels=True)
# we need to draw the figure, such that the gridlines are populated
fig.canvas.draw()
ysegs = gridliner.yline_artists[0].get_segments()
yticks = [yseg[0,1] for yseg in ysegs]
xsegs = gridliner.xline_artists[0].get_segments()
xticks = [xseg[0,0] for xseg in xsegs]
print(xticks)
print(yticks)
Please also note the padding you see in that example is a cartopy bug confusing "pixels" with "points". It was fixed in SciTools/cartopy#1556. You can upgrade to cartopy v0.19 to get nicely-padded labels or play with ax.format(labelpad=N).
Hi, maybe try ax.format(labels = False)first, then use ax.set_xticks([0, 60, 120, 180, 240, 300, 360], crs=ccrs.PlateCarree()) to specify tick lines explicitly. It worked for me with Version 0.6.4.
Activity
zxdawn commentedon Sep 26, 2020
This method of retrieving gridline ticks may be useful for adding the function:
lukelbd commentedon Jul 12, 2021
You can monitor #253 for updates
Please also note the padding you see in that example is a cartopy bug confusing "pixels" with "points". It was fixed in SciTools/cartopy#1556. You can upgrade to cartopy v0.19 to get nicely-padded labels or play with
ax.format(labelpad=N).kM-Stone commentedon Nov 29, 2021
Hi, maybe try
ax.format(labels = False)first, then useax.set_xticks([0, 60, 120, 180, 240, 300, 360], crs=ccrs.PlateCarree())to specify tick lines explicitly. It worked for me with Version 0.6.4.syrte commentedon Jan 14, 2022
kM-Stone's solution does not work properly for some other projections such as 'gnom'.
I found a temporary workaround for general projections. I put it here in case it is helpful for anyone.