geomappy.plot_utils.add_gridlines

geomappy.plot_utils.add_gridlines(ax: ~cartopy.mpl.geoaxes.GeoAxes, lines: float | tuple[float, float] | tuple[tuple[float], tuple[float]], *, color: str = 'grey', linestyle: str = '--', alpha: float = 0.5, n_steps: int = 300, linewidth: float = 1, crs: ~cartopy.crs.Projection = <Projected CRS: +proj=eqc +ellps=WGS84 +a=6378137.0 +lon_0=0.0 +to ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (unknown) - N[north]: Northing (unknown) - h[up]: Ellipsoidal height (metre) Area of Use: - undefined Coordinate Operation: - name: unknown - method: Equidistant Cylindrical Datum: Unknown based on WGS 84 ellipsoid - Ellipsoid: WGS 84 - Prime Meridian: Greenwich , **kwargs) Gridliner

Add gridlines to a map axes.

Returns a Gridliner object that can be further styled.

Parameters:
  • ax (cartopy.mpl.geoaxes.GeoAxes) – Map axes to add gridlines to.

  • lines (int, tuple of ints, tuple of tuple of ints) – Interval(s) or positions for the gridlines in degrees. Single int is applied to both axes, tuple of two ints sets separate x and y intervals, or tuple of explicit positions.

  • color (str, optional) – Color of the gridlines. Default is grey.

  • linestyle (str, optional) – Line style for the gridlines. Default is dashed ‘–‘.

  • alpha (float, optional) – Opacity of the gridlines. Default is 0.5.

  • n_steps (int, optional) – Number of interpolation steps for the gridlines. Default is 300.

  • linewidth (float, optional) – Width of the gridlines. Default is 1.

  • crs (cartopy.crs.Projection, optional) – Coordinate reference system of the provided gridline positions. Default is PlateCarree.

  • **kwargs – Additional keyword arguments passed to ax.gridlines.

Returns:

The created gridliner object.

Return type:

cartopy.mpl.gridliner.Gridliner