torch_harmonics.plotting.plot_sphere#

torch_harmonics.plotting.plot_sphere(
data,
fig=None,
projection='robinson',
cmap='RdBu',
title=None,
colorbar=False,
coastlines=False,
gridlines=False,
central_latitude=0,
central_longitude=0,
lon=None,
lat=None,
**kwargs,
)[source]#

Plots a function defined on the sphere using pcolormesh

Parameters:
  • data (numpy.ndarray or torch.Tensor) – Data to plot with shape (nlat, nlon)

  • fig (matplotlib.figure.Figure, optional) – Figure to plot on, by default None (creates new figure)

  • projection (str, optional) – Map projection type, by default “robinson”

  • cmap (str, optional) – Colormap name, by default “RdBu”

  • title (str, optional) – Plot title, by default None

  • colorbar (bool, optional) – Whether to add a colorbar, by default False

  • coastlines (bool, optional) – Whether to add coastlines, by default False

  • gridlines (bool, optional) – Whether to add gridlines, by default False

  • central_latitude (float, optional) – Central latitude for projection, by default 0

  • central_longitude (float, optional) – Central longitude for projection, by default 0

  • lon (numpy.ndarray, optional) – Longitude coordinates, by default None (auto-generated)

  • lat (numpy.ndarray, optional) – Latitude coordinates, by default None (auto-generated)

  • **kwargs – Additional arguments passed to pcolormesh

Returns:

The plotted image object

Return type:

matplotlib.collections.QuadMesh