1- Cartopy map gridlines and tick labels
1+ Cartopy map gridlines and tick labels
22=====================================
33
4- The :class: `~cartopy.mpl.gridliner.Gridliner ` instance, often created by calling the
5- :meth: `cartopy.mpl.geoaxes.GeoAxes.gridlines ` method on a
4+ The :class: `~cartopy.mpl.gridliner.Gridliner ` instance, often created by calling the
5+ :meth: `cartopy.mpl.geoaxes.GeoAxes.gridlines ` method on a
66:class: `cartopy.mpl.geoaxes.GeoAxes ` instance, has a variety of attributes which can be
77used to determine draw time behaviour of the gridlines and labels.
88
@@ -11,14 +11,14 @@ used to determine draw time behaviour of the gridlines and labels.
1111 The current :class: `~cartopy.mpl.gridliner.Gridliner ` interface is likely to undergo
1212 a significant change in the versions following v0.6 in order to fix some of the underying
1313 limitations of the current implementation.
14-
14+
1515
1616.. autoclass :: cartopy.mpl.gridliner.Gridliner
1717 :members:
1818 :undoc-members:
1919
20-
21-
20+
21+
2222The following contrived example makes use of many of the features of the Gridliner
2323class to produce customized gridlines and tick labels:
2424
@@ -28,22 +28,22 @@ class to produce customized gridlines and tick labels:
2828 import matplotlib.pyplot as plt
2929 import matplotlib.ticker as mticker
3030 import cartopy.crs as ccrs
31-
31+
3232 from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
33-
34-
33+
34+
3535 ax = plt.axes(projection=ccrs.Mercator())
3636 ax.coastlines()
37-
38- gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
37+
38+ gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
3939 linewidth=2, color='gray', alpha=0.5, linestyle='--')
40- gl.xlabels_top = False
41- gl.ylabels_left = False
40+ gl.top_labels = False
41+ gl.left_labels = False
4242 gl.xlines = False
4343 gl.xlocator = mticker.FixedLocator([-180, -45, 0, 45, 180])
4444 gl.xformatter = LONGITUDE_FORMATTER
4545 gl.yformatter = LATITUDE_FORMATTER
4646 gl.xlabel_style = {'size': 15, 'color': 'gray'}
4747 gl.xlabel_style = {'color': 'red', 'weight': 'bold'}
48-
48+
4949 plt.show()
0 commit comments