Skip to content

Instantly share code, notes, and snippets.

@ajdawson
Last active June 7, 2022 13:47
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ajdawson/dd536f786741e987ae4e to your computer and use it in GitHub Desktop.
Save ajdawson/dd536f786741e987ae4e to your computer and use it in GitHub Desktop.
Adding gridline labels to a cartopy Lambert Conformal projection plot
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@polair
Copy link

polair commented Oct 18, 2019

For the record, this works on stereographic projections as well. Thank you so much for this code... made the transition to NCL for a few things much cleaner.

@rabernat
Copy link

FYI, labeling grid lines is now supported on any cartopy projection as of cartopy v0.18. See https://twitter.com/QuLogic/status/1257148289838911488

@hepengz
Copy link

hepengz commented Apr 13, 2021

amazing!

Modifying gridlines:

ax.gridlines(xlocs=xticks, ylocs=yticks, draw_labels=False, linewidth=0.5, color='k', alpha=0.5, linestyle='--')

Modifying tic_params:

ax.tick_params(axis='both',labelsize=6,direction='out',right=False,top=False)

@marinadmo
Copy link

That worked great! Thanks!
I just received the warning indicated below, let me know if this has been updated!
:50: DeprecationWarning: The outline_patch property is deprecated. Use GeoAxes.spines['geo'] or the default Axes properties instead.
outline_patch = sgeom.LineString(ax.outline_patch.get_path().vertices.tolist())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment