-
Notifications
You must be signed in to change notification settings - Fork 391
Description
Description
Enhancement to orient lat lon gridline labels parallel to the gridlines as they intersect the plot boundary. Something like the labels seen here:
[source]
Code
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
rotated_crs = ccrs.RotatedPole(pole_longitude=120.0, pole_latitude=70.0)
ax = plt.axes(projection=rotated_crs)
ax.set_extent((-6, 3, 48, 58), crs=ccrs.PlateCarree())
ax.coastlines(resolution='50m')
gl = ax.gridlines(draw_labels=True,x_inline=False, y_inline=False)
plt.show()
Cartopy version
0.18.0
Result
Notice the inconsistent orientation of gridline labels, which can get somewhat messy. It is possible to disable the automated orientation feature with gl.rotate_labels = False, however, I can't seem to find a method to align the label angle so that the text is parallel to the gridline as it intersects the plot boundary, as seen in the plot under the description.
Additional Information
I think the logic for this might be here
cartopy/lib/cartopy/mpl/gridliner.py
Line 674 in 47ec03f
| def _segment_angle_to_text_specs(self, angle, lonlat): |
This issue was briefly discussed here ##1089 (comment), but unsure if it has been addressed further.

