SciTools / cartopy

Cartopy - a cartographic python library with matplotlib support
https://scitools.org.uk/cartopy/docs/latest
BSD 3-Clause "New" or "Revised" License
1.41k stars 359 forks source link

Adding axis labels: ax.set_xlabel("Longitude (degrees)") #1332

Open benjimin opened 5 years ago

benjimin commented 5 years ago

One often expects to label the axes (not just the tick marks) on a map or plot, e.g. with strings "Lat."/"Lon." or "Northing (metres)"/"Easting (metres)". However, Axes.set_xlabel and set_ylabel (nor matplotlib.pyplot.xlabel etc) seem broken in cartopy, and GeoAxes.gridlines seems to provide no alternative either. (Currently seems to require manual positioning of new Text artists as a work-around.)

I think this is a worthwhile feature (labeling of figure axes tends to be heavily drilled in highschool and undergraduate science courses) and that cartopy should support whatever same syntax for setting axis labels as matplotlib encourages.

Also discussed here: https://stackoverflow.com/questions/35479508/cartopy-set-xlabel-set-ylabel-not-ticklabels

jypeter commented 5 years ago

Same problem here, no axes labels after using the following

my_plot = my_figure.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
my_plot.set_xlabel('Longitude')
my_plot.set_ylabel('Latitude')

I thought I was doing something wrong. I will follow the stackoverflow answers, but it would be nice to have the code above behave as expected by default

JediMed commented 4 years ago

Same issue