pyarts3.plots

Plotting ARTS data

This module provides functions related to plotting ARTS data based only on the type of the data. Each submodule is named exactly as the data type it can plot, which is also the name of a builtin group.

Each submodule provides a plot() function that takes the data type as its first argument and optional arguments to control the plotting. The plot() functions return the figure, a list of subplots, and nothing more.

pyarts3.plots.plot(data, *, fig=None, ax=None, **kwargs)[source]

Generic plotting function that dispatches to the appropriate plot module.

This function automatically determines the type of the input data and calls the corresponding plot module’s plot() function. All keyword arguments are forwarded to the specific plotting function.

Examples

>>> import pyarts3 as pyarts
>>> vec = pyarts.arts.Vector([1, 2, 3, 4])
>>> fig, ax = pyarts.plots.plot(vec)
>>> mat = pyarts.arts.Matrix([[1, 2], [3, 4]])
>>> fig, ax = pyarts.plots.plot(mat, cmap='viridis')
Parameters:
  • data (ARTS workspace type) – Any ARTS data type that has a corresponding plot module.

  • fig (matplotlib Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (matplotlib Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • **kwargs – All keyword arguments are forwarded to the specific plot function. Additional plot-specific parameters vary by data type.

Returns:

  • fig (matplotlib Figure) – The matplotlib figure object.

  • ax (matplotlib Axes or list of Axes) – The matplotlib axes object(s).

Raises:

TypeError – If no plot module exists for the given data type.

AbsorptionBands

pyarts3.plots.AbsorptionBands.plot(data: ~pyarts3.arts.AbsorptionBands, *, mode='normal', fig=None, ax=None, freqs: ~pyarts3.arts.AscendingGrid | int = 1000, atm: ~pyarts3.arts.AtmPoint | ~pyarts3.arts.AtmField | None = None, pol: ~pyarts3.arts.Propmat = [1, 0, 0, 0, 0, 0, 0], species: ~pyarts3.arts.SpeciesEnum = "AIR", path_point: ~pyarts3.arts.PropagationPathPoint = [unknown, unknown, 0, 0, 0, 0, 0, 1, 1], min_pm: float = None, cm: ~matplotlib.colors.ListedColormap = <matplotlib.colors.ListedColormap object>, **kwargs)[source]

Creates a plot of the absorption by the bands in the AbsorptionBands object.

If freqs is an index, this is the number of frequency points between the lowest and highest frequency in the AbsorptionBands object. If freqs is an AscendingGrid, it is used directly for the x-axis.

If atm is None, and atmospheric point is created by reading the tropical standard atmosphere from the ARTS database and extracting the AtmPoint at position by the path_point. If atm is an AtmField, the AtmPoint at position by the path_point is extracted.

pol is the dot product of the generated propagation matrix and defaults to the purely unpolarized case.

The species is passed directly to the AbsorptionBands.propagation_matrix() method and defaults to all species (AIR).

The path_point is passed directly to the AbsorptionBands.propagation_matrix() method and defaults to pos: [0, 0, 0], los: [0, 0].

The mode parameter controls the style of the plot. In ‘normal’ mode, all absorption lines are plotted as the sum of the call to AbsorptionBands.propagation_matrix(). In ‘important Y X’ modes, the full absorption is still shown, but the absorption bands object are split by X, where X is one of ‘bands’, ‘species’, or ‘isotopes’. Y is either ‘fill’ or nothing. If it is ‘fill’, matplotlib’s fill_between() is used to color the regions, otherwise line plots are used to show the absorption of the important contributors.

Parameters:
  • data (AbsorptionBands) – The AbsorptionBands object containing the data to plot.

  • mode (str, optional) – The mode to use for the plot - see text for descriptions. Defaults to ‘normal’.

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • freqs (AscendingGrid | int, optional) – The frequency grid to use for the x-axis. Defaults to None manually creating a range.

  • atm (AtmPoint | AtmField | None, optional) – The atmospheric point data to use for the plot. Defaults to None computed values.

  • pol (Propmat, optional) – The polarization state to consider. Defaults to [1, 0, 0, 0, 0, 0, 0].

  • species (SpeciesEnum, optional) – The species to include in the plot. Defaults to AIR for all species.

  • path_point (PropagationPathPoint, optional) – The propagation path point to use for the plot. Defaults to pos: [0, 0, 0], los: [0, 0].

  • min_pm (float, optional) – The minimum absorption to consider a band important. Only used in ‘important Y X’ modes. Defaults to 1% of the minimum absorption in the full propagation matrix.

  • cm (ListedColormap, optional) – The matplotlib colormap to use for coloring in “important Y X” mode Must be resampable. Defaults to ‘viridis’.

  • **kwargs (keyword arguments) – Additional keyword arguments to pass to the plotting functions.

Returns:

  • fig (As input) – As input.

  • ax (As input) – As input.

ArrayOfCIARecord

pyarts3.plots.ArrayOfCIARecord.plot(data: ArrayOfCIARecord, *, fig=None, ax=None, same: bool = False, freqs: AscendingGrid = None, atm: AtmPoint | AtmField | None = None, path_point: PropagationPathPoint = [unknown, unknown, 0, 0, 0, 0, 0, 1, 1], T_extrapolfac: float = 1e+99, **kwargs)[source]

Creates a plot of the absorption by the records in the ArrayOfCIARecord object.

The plot passes all relevant arguments to the CIARecord plotting routine.

If freqs is given, this range will be used, otherwise the built-in frequency range is used.

If atm is None, an atmospheric point is created by reading the tropical standard atmosphere from the ARTS database and extracting the AtmPoint at position by the path_point. If atm is an AtmField, the AtmPoint at position by the path_point is extracted.

The path_point is passed directly to the ArrayOfCIARecord.propagation_matrix() method and defaults to pos: [0, 0, 0], los: [0, 0].

same determines if each entry in the array is plotted onto the same plot or not.

Parameters:
  • data (ArrayOfCIARecord) – The ArrayOfCIARecord object containing the data to plot.

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • same (bool, optional) – Draw on a single canvas or not.

  • freqs (AscendingGrid | int, optional) – The frequency grid to use for the x-axis. Defaults to None manually creating a range.

  • atm (AtmPoint | AtmField | None, optional) – The atmospheric point data to use for the plot. Defaults to None computed values.

  • path_point (PropagationPathPoint, optional) – The propagation path point to use for the plot. Defaults to pos: [0, 0, 0], los: [0, 0].

  • T_extrapolfac (float, optional) – Internal extrapolation factor

  • **kwargs (keyword arguments) – Additional keyword arguments to pass to the plotting functions. Ignores label.

Returns:

  • fig (As input) – As input.

  • ax (As input) – As input.

ArrayOfPropagationPathPoint

Plotting routine the propagation path in polar coordinates

pyarts3.plots.ArrayOfPropagationPathPoint.plot(data: ArrayOfPropagationPathPoint, *, fig=None, ax=None, planetary_radius: float = 0.0, rscale: float = 1000, draw_lat_lon: bool = True, draw_map: bool = True, draw_za_aa: bool = False, **kwargs)[source]

Plots a single observation in a polar coordinate system

Use the draw_* variables to select which plots are done

The polar plots’ central point is at the surface of the planet, i.e., at planetary_radius/rscale. The radius of these plots are the scaled down radiuses of the input data[0].pos[0] / rscale + planetary_radius/rscale. The default radius value is thus just the altitude in kilometers. If you put, e.g., 6371e3 as the planetary_radius, the radius values will be the radius from the surface to the highest altitude

Note also that longitudes are unwrapped, e.g. a step longer than 180 degrees between data points will wrap around, or rather, create separate entries of the lat-lons.

Example

import pyarts3 as pyarts
import numpy as np

ws = pyarts.Workspace()

ws.atmospheric_fieldRead(toa=100e3, basename="planets/Earth/afgl/tropical/")
ws.surface_fieldEarth()
ws.ray_path_observer_agendaSetGeometric(
    add_crossings=True, remove_non_crossings=True
)
ws.ray_path_observersFieldProfilePseudo2D(nup=3, nlimb=3, ndown=3)
ws.ray_path_fieldFromObserverAgenda()

f, a = None, None
for x in ws.ray_path_field:
    f, a = pyarts.plots.ArrayOfPropagationPathPoint.plot(
        x, draw_za_aa=True, draw_map=False, fig=f, ax=a
    )

(Source code, svg, pdf)

_images/pyarts3-plots-1.svg
Parameters:
  • data (ArrayOfPropagationPathPoint) – A single propagation path object

  • fig (Figure, optional) – A figure. The default is None, which generates a new figure.

  • ax (A list of five subplots, optional) – A list of five subplot axes. The default is None, which generates new axes. The order is [lat, lon, map, za, aa]

  • planetary_radius (float, optional) – See polar_ray_path_helper in source tree

  • rscale (float, optional) – See polar_ray_path_helper in source tree

  • draw_lat_lon (bool, optional) – Whether or not latitude and longitude vs radius angles are drawn. Def: True

  • draw_map (bool, optional) – Whether or not latitude and longitude map is drawn. Def: True

  • draw_za_aa (bool, optional) – Whether or not Zenith and Azimuth angles are drawn. Def: False

  • **kwargs (keyword arguments) – Additional keyword arguments (currently unused).

Returns:

  • fig (As input) – As input.

  • ax (As input) – As input.

ArrayOfSensorObsel

Plotting routine for the sensor response

pyarts3.plots.ArrayOfSensorObsel.plot(data: ArrayOfSensorObsel, *, fig=None, ax=None, keys: str | list = 'f', pol: str | Stokvec = 'I', **kwargs)[source]

Plot the sensor observational element array.

Note

Any option other than “f” will sort the sensor observational element array by the corresponding key. The object lives via a pointer, so the original data is modified in-place.

This should not massively affect any radiative transfer computations, but it might result in different results down on the floating point epsilon error level.

Example

import pyarts3 as pyarts
import numpy as np

ws = pyarts.Workspace()
ws.measurement_sensorSimpleGaussian(std = 10e6, pos = [100e3, 0, 0], los = [180.0, 0.0],
                                    frequency_grid = np.linspace(-50e6, 50e6, 101))
pyarts.plots.ArrayOfSensorObsel.plot(ws.measurement_sensor)

(Source code, svg, pdf)

_images/pyarts3-plots-2.svg
Parameters:
  • data (ArrayOfSensorObsel) – A sensor observation element array.

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – Not used (function creates its own subplots). Accepted for API consistency.

  • keys (str | list) – The keys to use for plotting. Options are in SensorKeyType.

  • pol (str | Stokvec) – The polarization to use for plotting. Defaults to “I”, constructs a Stokvec.

  • **kwargs (keyword arguments) – Additional keyword arguments passed to the plotting function.

Returns:

  • fig (As input) – As input.

  • ax (list) – List of matplotlib axes objects.

AscendingGrid

Plotting routine for AscendingGrid

pyarts3.plots.AscendingGrid.plot(data: AscendingGrid, *, fig=None, ax=None, **kwargs)[source]

Plot an AscendingGrid as a scatter/line plot.

Example

import pyarts3 as pyarts
import numpy as np

# Create a frequency grid
freqs = pyarts.arts.AscendingGrid(np.logspace(9, 12, 20))

pyarts.plots.AscendingGrid.plot(freqs)

(Source code, svg, pdf)

_images/pyarts3-plots-3.svg
Parameters:
  • data (AscendingGrid) – A sorted ascending grid of values

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • **kwargs (keyword arguments) – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

AtmField

Plotting routine for profiles of the atmospheric field

pyarts3.plots.AtmField.plot(data: AtmField, *, fig=None, ax=None, alts: AscendingGrid | float = array([0., 2000., 4000., 6000., 8000., 10000., 12000., 14000., 16000., 18000., 20000., 22000., 24000., 26000., 28000., 30000., 32000., 34000., 36000., 38000., 40000., 42000., 44000., 46000., 48000., 50000., 52000., 54000., 56000., 58000., 60000., 62000., 64000., 66000., 68000., 70000., 72000., 74000., 76000., 78000., 80000., 82000., 84000., 86000., 88000., 90000., 92000., 94000., 96000., 98000., 100000.]), lats: LatGrid | float = 0, lons: LonGrid | float = 0, ygrid: Vector | None = None, keys: list[str] | None = None, apply_natural_scale: bool = False, **kwargs)[source]

Plot select atmospheric field parameters by extracting a profile.

Example

import pyarts3 as pyarts
import numpy as np

ws = pyarts.Workspace()

ws.atmospheric_fieldRead(toa=100e3, basename="planets/Earth/afgl/tropical/")

pyarts.plots.AtmField.plot(ws.atmospheric_field, keys=["p", "t"])

(Source code, svg, pdf)

_images/pyarts3-plots-4.svg
Parameters:
  • data (AtmField) – An atmospheric field

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – Not used (function creates its own subplots). Accepted for API consistency.

  • alts (AscendingGrid | float, optional) – A grid to plot on - must after broadcast with lats and lons be 1D. Defaults to np.linspace(0, 1e5, 51).

  • lats (LatGrid | float, optional) – A grid to plot on - must after broadcast with alts and lons be 1D. Defaults to 0.

  • lons (LonGrid | float, optional) – A grid to plot on - must after broadcast with alts and lats be 1D. Defaults to 0.

  • ygrid (~pyarts3.arts.Vector | None, optional) – Choice of y-grid for plotting. Uses broadcasted alts if None. Defaults to None.

  • keys (list, optional) – A list of keys to plot. Defaults to None for all keys in keys().

  • apply_natural_scale (bool, optional) – Whether to apply natural scaling to each parameter. Defaults to False.

  • **kwargs (keyword arguments) – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – As input.

  • ax (list) – List of matplotlib axes objects.

AzimuthGrid

Plotting routine for AzimuthGrid

pyarts3.plots.AzimuthGrid.plot(data: AzimuthGrid, *, fig=None, ax=None, polar: bool = False, **kwargs)[source]

Plot an AzimuthGrid showing azimuth angles.

Example

import pyarts3 as pyarts
import numpy as np

# Create azimuth angles (compass directions)
azimuth = pyarts.arts.AzimuthGrid(np.linspace(0, 360, 13)[:-1])

fig, ax = pyarts.plots.AzimuthGrid.plot(azimuth, polar=True)
ax.set_xlabel("Index")
ax.set_ylabel("Azimuth Angle [°]")
ax.set_title("Azimuth Grid")
ax.set_ylim(0, 360)
ax.grid(True, alpha=0.3)
ax.set_ylim(0, 1.2)
ax.set_theta_zero_location("N")  # 0° at North (top)
ax.set_theta_direction(-1)  # Clockwise (East = 90° clockwise from North)

(Source code, svg, pdf)

_images/pyarts3-plots-5.svg
Parameters:
  • data (AzimuthGrid) – A sorted grid of azimuth angles [0, 360)

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • polar (bool, optional) – If True, use polar plot. Defaults to False.

  • **kwargs – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

CIARecord

pyarts3.plots.CIARecord.plot(data: CIARecord, *, fig=None, ax=None, freqs: AscendingGrid = None, atm: AtmPoint | AtmField | None = None, path_point: PropagationPathPoint = [unknown, unknown, 0, 0, 0, 0, 0, 1, 1], T_extrapolfac: float = 1e+99, **kwargs)[source]

Creates a plot of the absorption by the records in the CIARecord object.

If freqs is given, this range will be used, otherwise the built-in frequency range is used.

If atm is None, an atmospheric point is created by reading the tropical standard atmosphere from the ARTS database and extracting the AtmPoint at position by the path_point. If atm is an AtmField, the AtmPoint at position by the path_point is extracted.

The path_point is passed directly to the CIARecord.propagation_matrix() method and defaults to pos: [0, 0, 0], los: [0, 0].

Parameters:
  • data (CIARecord) – The CIARecord object containing the data to plot.

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • freqs (AscendingGrid | int, optional) – The frequency grid to use for the x-axis. Defaults to None manually creating a range.

  • atm (AtmPoint | AtmField | None, optional) – The atmospheric point data to use for the plot. Defaults to None computed values.

  • path_point (PropagationPathPoint, optional) – The propagation path point to use for the plot. Defaults to pos: [0, 0, 0], los: [0, 0].

  • T_extrapolfac (float, optional) – Internal extrapolation factor

  • **kwargs (keyword arguments) – Additional keyword arguments to pass to the plotting functions.

Returns:

  • fig (As input) – As input.

  • ax (As input) – As input.

DisortFlux

Plotting routine for DisortFlux

pyarts3.plots.DisortFlux.plot(data: DisortFlux, *, fig=None, ax=None, freq_idx: int | None = None, freqs=None, alts=None, select: list | str = ['up', 'down_diffuse', 'down_direct'], **kwargs)[source]

Plot DISORT flux results.

Parameters:
  • data (DisortFlux) – A DisortFlux object containing flux results

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – Not used (function creates its own subplots). Accepted for API consistency.

  • freq_idx (int | None, optional) – Frequency index to plot. If None, plots all frequencies. Defaults to None.

  • alts (array-like, optional) – Altitude grid to use for plotting. If None, uses data.altitude_grid.

  • select (list or str, optional) – Which flux components to plot: ‘up’, ‘down_diffuse’, and/or ‘down_direct’. Defaults to all three.

  • **kwargs – Additional keyword arguments passed to matplotlib plotting functions.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (list) – List of matplotlib axes objects.

DisortRadiance

Plotting routine for DisortRadiance

pyarts3.plots.DisortRadiance.plot(data: DisortRadiance, *, fig=None, ax=None, alt_idx: int = 0, azi_idx: int = 0, plotstyle='contourf', select: list = ['up', 'down'], freqs=None, **kwargs)[source]

Plot DISORT radiance results as two 2D heatmaps (upward and downward).

Parameters:
  • data (DisortRadiance) – A DisortRadiance object containing radiance results

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – Not used (function creates its own subplots). Accepted for API consistency.

  • alt_idx (int, optional) – Altitude index to use. Defaults to 0 (top of atmosphere).

  • azi_idx (int, optional) – Azimuth index to use. Defaults to 0.

  • plotstyle (str, optional) – The matplotlib plotting function to use, ‘contourf’ or ‘plot’

  • freqs (array-like, optional) – Frequency grid to use for x-axis. Defaults to None, which uses data.frequency_grid.

  • select (list or str, optional) – Which directions to plot: ‘up’ and/or ‘down’. Defaults to [‘up’, ‘down’].

  • **kwargs – Additional keyword arguments passed to matplotlib plotting function.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (list) – List of two matplotlib axes objects [ax_up, ax_down].

GeodeticField2

Plotting routine for GeodeticField2

pyarts3.plots.GeodeticField2.plot(data: GeodeticField2, *, fig=None, ax=None, **kwargs)[source]

Plot a GeodeticField2 as a map on latitude/longitude grid.

Example

import pyarts3 as pyarts
import numpy as np

# Create a geographic field
lats = pyarts.arts.LatGrid(np.linspace(-90, 90, 20))
lons = pyarts.arts.LonGrid(np.linspace(-180, 175, 36))
lon_mesh, lat_mesh = np.meshgrid(lons, lats)

# Example: distance from equator
data = pyarts.arts.Matrix(np.abs(lat_mesh))

field = pyarts.arts.GeodeticField2()
field.grids = (lats, lons)
field.data = data
field.dataname = "Distance from Equator"

pyarts.plots.GeodeticField2.plot(field)

(Source code, svg, pdf)

_images/pyarts3-plots-6.svg
Parameters:
  • data (GeodeticField2) – A 2D geodetic field with lat/lon grids

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • **kwargs – Additional keyword arguments passed to matplotlib ploting functions.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

GriddedField2

Plotting routine for GriddedField2

pyarts3.plots.GriddedField2.plot(data: GriddedField2, *, fig=None, ax=None, **kwargs)[source]

Plot a GriddedField2 as a 2D heatmap using its grids.

Parameters:
  • data (GriddedField2) – A 2D gridded field with named grids

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • **kwargs – Additional keyword arguments passed to matplotlib ploting functions.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

LatGrid

Plotting routine for LatGrid

pyarts3.plots.LatGrid.plot(data: LatGrid, *, fig=None, ax=None, polar: bool = False, **kwargs)[source]

Plot a LatGrid showing latitude values.

Example

import pyarts3 as pyarts
import numpy as np

# Create a latitude grid
lats = pyarts.arts.LatGrid(np.linspace(-90, 90, 19))

pyarts.plots.LatGrid.plot(lats, polar=True)

(Source code, svg, pdf)

_images/pyarts3-plots-7.svg
Parameters:
  • data (LatGrid) – A sorted grid of latitude values [-90, 90]

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • polar (bool, optional) – If True, use polar plot. Defaults to False.

  • **kwargs – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

LonGrid

Plotting routine for LonGrid

pyarts3.plots.LonGrid.plot(data: LonGrid, *, fig=None, ax=None, polar: bool = False, **kwargs)[source]

Plot a LonGrid showing longitude values.

Example

import pyarts3 as pyarts
import numpy as np

# Create a longitude grid
lons = pyarts.arts.LonGrid(np.linspace(-180, 175, 36))

pyarts.plots.LonGrid.plot(lons, polar=True)

(Source code, svg, pdf)

_images/pyarts3-plots-8.svg
Parameters:
  • data (LonGrid) – A sorted grid of longitude values [-180, 180)

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • polar (bool, optional) – If True, use polar plot. Defaults to False.

  • **kwargs – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

MagneticAngles

pyarts3.plots.MagneticAngles.plot(data: MagneticAngles, *, mode='normal', fig=None, ax=None, N: int = 50, **kwargs)[source]

Plots the magnetic angles in 3D. The axis should be 3D.

The N parameter controls the number of points used to draw the angle arcs.

Parameters:
  • data (MagneticAngles) – The MagneticAngles object containing the data to plot.

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • N (int, optional) – Number of points to use for drawing the angle arcs. Default is 50.

Returns:

  • fig (As input) – As input.

  • ax (As input) – As input.

Matrix

Plotting routine for Matrix

pyarts3.plots.Matrix.plot(data: Matrix, *, fig=None, ax=None, xgrid: Vector | None = None, ygrid: Vector | None = None, **kwargs)[source]

Plot a Matrix as a 2D heatmap.

Example

import pyarts3 as pyarts
import numpy as np

# Create a simple matrix
x, y = np.meshgrid(np.linspace(-2, 2, 30), np.linspace(-2, 2, 30))
mat = pyarts.arts.Matrix(np.exp(-(x**2 + y**2)))

fig, ax = pyarts.plots.Matrix.plot(mat)
ax.set_title("2D Gaussian Matrix")

(Source code)

Parameters:
  • data (Matrix) – A 2D array of numeric values

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • xgrid (Vector | None = None,) – X-axis values. If None, uses column indices. Defaults to None.

  • ygrid (Vector | None = None,) – Y-axis values. If None, uses row indices. Defaults to None.

  • **kwargs – Additional keyword arguments passed to matplotlib plotting function.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

MuelmatVector

Plotting routine for transmission matrix

pyarts3.plots.MuelmatVector.plot(data: MuelmatVector, *, fig=None, ax=None, freqs: AscendingGrid = None, component: None | Muelmat = None, **kwargs)[source]

Plot the transmission matrix elements.

Selects a 1D plot if the transmission matrix is 1D, otherwise a 4x4 grid of plots.

Parameters:
  • data (MuelmatVector) – A vector of Mueller matrices representing the transmission properties.

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes or list, optional) – The matplotlib axes to draw on. For 1D plot: single axes. For 4x4 plot: 16 axes. Defaults to None for new axes.

  • freqs (AscendingGrid, optional) – A grid of frequencies to plot. Defaults to None for no frequency grid.

  • component (None | Muelmat, optional) – If None, plot the dot product of each Mueller matrix with the given component. If provided, plot each of the 16 elements M[i,j] across the vector.

  • **kwargs (optional) – Additional keyword arguments passed to matplotlib plot().

Returns:

  • fig (As input) – As input.

  • ax (As input) – As input. Single axis for 1D plot, or list of 16 axes for 4x4 plot.

PropmatMatrix

Plotting routine for PropmatMatrix

pyarts3.plots.PropmatMatrix.plot(data: PropmatMatrix, *, fig=None, ax=None, xgrid: Vector | None = None, ygrid: Vector | None = None, component: Propmat = [1, 0, 0, 0, 0, 0, 0], **kwargs)[source]

Plot a propagation matrix as a 2D heatmap

Parameters:
  • data (PropmatMatrix) – A matrix of propagation matrices (7-vector or 4x4 each)

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes or list, optional) – Axes to plot on. If None, new axes are created.

  • xgrid (Vector | None = None,) – X-axis values. If None, uses column indices. Defaults to None.

  • ygrid (Vector | None = None,) – Y-axis values. If None, uses row indices. Defaults to None.

  • component (Propmat, optional) – Choice of polarization for the heatmap.

  • **kwargs – Additional keyword arguments passed to matplotlib plotting function.

Returns:

  • fig (Figure) – The matplotlib figure.

  • ax (list or Axes) – List of axes (grid mode) or single axes (dot product/element/component mode).

PropmatVector

Plotting routine for PropmatVector

pyarts3.plots.PropmatVector.plot(data: PropmatVector, *, fig=None, ax=None, freqs: AscendingGrid | None = None, component: Propmat | None = None, **kwargs)[source]

Plot a propagation matrix.

Parameters:
  • data (PropmatVector) – A vector of propagation matrices

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes or list, optional) – Axes to plot on. If None, new axes are created.

  • freqs (AscendingGrid or None, optional) – Frequency or position grid for x-axis. If None, uses indices.

  • component (Propmat or None, optional) – If None, show grid of 16 subplots (M[i,j]). If a 7-vector, plot dot product. If int, plot compact component.

  • **kwargs – Additional keyword arguments passed to matplotlib plot().

Returns:

  • fig (Figure) – The matplotlib figure.

  • ax (list or Axes) – List of axes (grid mode) or single axes (dot product/element/component mode).

SortedGriddedField1

Plotting routine for SortedGriddedField1

pyarts3.plots.SortedGriddedField1.plot(data: SortedGriddedField1, *, fig=None, ax=None, **kwargs)[source]

Plot a SortedGriddedField1 as a line plot using its grid.

Example

import pyarts3 as pyarts
import numpy as np

# Create a gridded field
freqs = pyarts.arts.AscendingGrid(np.linspace(1e9, 1e12, 100))
data = pyarts.arts.Vector(np.exp(-((freqs - 5e11)/1e11)**2))

field = pyarts.arts.SortedGriddedField1()
field.grids = (freqs,)
field.data = data
field.gridnames = ("Frequency [Hz]",)
field.dataname = "Response"

pyarts.plots.SortedGriddedField1.plot(field)

(Source code)

Parameters:
  • data (SortedGriddedField1) – A 1D sorted gridded field with named grid

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • **kwargs – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

SortedGriddedField2

Plotting routine for SortedGriddedField2

pyarts3.plots.SortedGriddedField2.plot(data: SortedGriddedField2, *, fig=None, ax=None, **kwargs)[source]

Plot a SortedGriddedField2 as a 2D heatmap using its sorted grids.

Parameters:
  • data (SortedGriddedField2) – A 2D sorted gridded field with ascending grids

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • **kwargs – Additional keyword arguments passed to matplotlib ploting functions.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

StokvecMatrix

Plotting routine for StokvecMatrix

pyarts3.plots.StokvecMatrix.plot(data: StokvecMatrix, *, fig=None, ax=None, xgrid: Vector | None = None, ygrid: Vector | None = None, component: Stokvec = [1, 0, 0, 0], **kwargs)[source]

Plot a Stokes vector matrix as a 2D heatmap for a specific component.

Example

import pyarts3 as pyarts
import numpy as np

# Create a 2D radiance field
nx, ny = 40, 30
x = np.linspace(0, 2*np.pi, nx)
y = np.linspace(0, 2*np.pi, ny)
X, Y = np.meshgrid(x, y, indexing='ij')

stokes_mat = pyarts.arts.StokvecMatrix(np.zeros((nx, ny, 4)))
stokes_mat[:, :, 0] = np.sin(X) * np.cos(Y)  # I component

pyarts.plots.StokvecMatrix.plot(stokes_mat)

(Source code)

Parameters:
  • data (StokvecMatrix) – A matrix of Stokes vectors (4 components each)

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • xgrid (Vector | None = None,) – X-axis values. If None, uses column indices. Defaults to None.

  • ygrid (Vector | None = None,) – Y-axis values. If None, uses row indices. Defaults to None.

  • component (Stokvec, optional) – Which Stokes component to plot. Defaults to I.

  • **kwargs – Additional keyword arguments passed to matplotlib plotting function.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

StokvecVector

Plotting routine for StokvecVector

pyarts3.plots.StokvecVector.plot(data: StokvecVector, *, fig=None, ax=None, freqs: ndarray | None = None, component: Stokvec | None = None, **kwargs)[source]

Plot the Stokes vectors.

Parameters:
  • data (StokvecVector) – A vector of Stokes vectors (each with 4 components: I, Q, U, V)

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes or list, optional) – Axes to plot on. If None, new axes are created.

  • freqs (ndarray | None, optional) – Frequency or position grid for x-axis. If None, uses indices.

  • component (Stokvec | None, optional) – If None, show grid of 4 subplots (I,Q,U,V). If a 4-vector, plot dot product with each sample.

  • **kwargs (keyword arguments) – Additional keyword arguments passed to matplotlib plot().

Returns:

  • fig (Figure) – The matplotlib figure.

  • ax (list or Axes) – List of axes (grid mode) or single axes (dot product mode).

SubsurfaceField

Plotting routine for profiles of the subsurface field

pyarts3.plots.SubsurfaceField.plot(data: SubsurfaceField, *, fig=None, ax=None, alts: AscendingGrid | float = array([-1., -0.5, 0.]), lats: LatGrid | float = 0, lons: LonGrid | float = 0, ygrid: Vector | None = None, keys: list[str] | None = None, **kwargs)[source]

Plot select subsurface field parameters by extracting a profile.

Parameters:
  • data (SubsurfaceField) – A subsurface field

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes or list of Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • alts (AscendingGrid | float, optional) – A grid to plot on - must after broadcast with lats and lons be 1D. Defaults to np.linspace(0, 1e5, 51).

  • lats (LatGrid | float, optional) – A grid to plot on - must after broadcast with alts and lons be 1D. Defaults to 0.

  • lons (LonGrid | float, optional) – A grid to plot on - must after broadcast with alts and lats be 1D. Defaults to 0.

  • ygrid (~pyarts3.arts.Vector | None, optional) – Choice of y-grid for plotting. Uses broadcasted alts if None. Defaults to None.

  • keys (list, optional) – A list of keys to plot. Defaults to None for all keys in keys().

  • **kwargs (keyword arguments) – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – As input.

  • ax (list) – List of matplotlib axes objects.

Sun

Plotting routine for Sun

pyarts3.plots.Sun.plot(data: Sun, *, fig=None, ax=None, freqs: AscendingGrid | None = None, **kwargs)[source]

Plot the solar spectrum.

Example

import pyarts3 as pyarts
import numpy as np

# Create a simplified sun object
sun = pyarts.arts.Sun()
sun.spectrum = pyarts.arts.Vector(np.ones(100) * 1e-3)  # Accepts Vector
sun.radius = 6.96e8  # meters
sun.distance = 1.496e11  # meters (1 AU)
sun.latitude = 0.0
sun.longitude = 0.0

pyarts.plots.Sun.plot(sun)

(Source code, svg, pdf)

_images/pyarts3-plots-12.svg
Parameters:
  • data (Sun) – A Sun object containing spectrum and properties

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • freqs (AscendingGrid | None, optional) – Frequency grid for x-axis. If None, uses indices. Defaults to None.

  • **kwargs – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

SurfaceField

Plotting routine for SurfaceField

pyarts3.plots.SurfaceField.plot(data: SurfaceField, *, fig=None, ax=None, lats: LatGrid | None = None, lons: LonGrid | None = None, keys: list[str] | None = None, **kwargs)[source]

Plot surface field parameters on a grid.

Parameters:
  • data (SurfaceField) – A surface field containing surface parameters

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – Not used (function creates its own subplots). Accepted for API consistency.

  • lats (LatGrid | None, optional) – Latitude grid for sampling. Defaults to None for automatic grid.

  • lons (LonGrid | None, optional) – Longitude grid for sampling. Defaults to None for automatic grid.

  • keys (list[str] | None, optional) – List of keys to plot. If None, plots all available keys. Defaults to None.

  • **kwargs – Additional keyword arguments passed to matplotlib plotting function.

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (list) – List of matplotlib axes objects.

Vector

Plotting routine for Vector

pyarts3.plots.Vector.plot(data: Vector, *, fig=None, ax=None, xgrid=None, **kwargs)[source]

Plot a Vector as a line plot.

Example

import pyarts3 as pyarts
import numpy as np

# Create a simple vector
x = np.linspace(0, 2*np.pi, 50)
vec = pyarts.arts.Vector(np.sin(x))

pyarts.plots.Vector.plot(vec, xgrid=pyarts.arts.convert.rad2deg(x))

(Source code, svg, pdf)

_images/pyarts3-plots-13.svg
Parameters:
  • data (Vector) – A 1D array of numeric values

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • xgrid (Vector, optional) – The x-coordinates for the plot. If None, the index of the data is used.

  • **kwargs – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

ZenithGrid

Plotting routine for ZenithGrid

pyarts3.plots.ZenithGrid.plot(data: ZenithGrid, *, fig=None, ax=None, polar: bool = False, **kwargs)[source]

Plot a ZenithGrid showing zenith angles.

Example

import pyarts3 as pyarts
import numpy as np

# Create zenith angles from 0° (up) to 180° (down)
zenith = pyarts.arts.ZenithGrid(np.linspace(0, 180, 19))

pyarts.plots.ZenithGrid.plot(zenith, polar=True)

(Source code, svg, pdf)

_images/pyarts3-plots-14.svg
Parameters:
  • data (ZenithGrid) – A sorted grid of zenith angles [0, 180]

  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • polar (bool, optional) – If True, use polar plot. Defaults to False.

  • **kwargs – Additional keyword arguments passed to plot()

Returns:

  • fig (As input) – The matplotlib figure.

  • ax (As input) – The matplotlib axes.

common

pyarts3.plots.common.default_fig_ax(fig=None, ax=None, nrows=1, ncols=1, N=-1, fig_kwargs={}, ax_kwargs={})[source]

Utility to create default matplotlib figure and axes if not provided.

Parameters:
  • fig (Figure, optional) – The matplotlib figure to draw on. Defaults to None for new figure.

  • ax (Axes, optional) – The matplotlib axes to draw on. Defaults to None for new axes.

  • fig_kwargs (dict, optional) – Keyword arguments for creating new figure if fig is None. Defaults to {}.

  • ax_kwargs (dict, optional) – Keyword arguments for creating new axes if ax is None. Defaults to {}.

Returns:

  • fig (Figure) – The matplotlib figure.

  • ax (Axes) – The matplotlib axes.

pyarts3.plots.common.select_flat_ax(ax, index)[source]

Utility to select a single Axes from possibly multi-dimensional axes array.

Parameters:
  • ax (Axes or array of Axes) – The matplotlib axes or array of axes.

  • index (int) – The index of the desired Axes in flattened order.

Returns:

selected_ax – The selected matplotlib axes.

Return type:

Axes

plot

Generic plotting function that dispatches to the appropriate plot module.

This function automatically determines the type of the input data and calls the corresponding plot module’s plot() function. All keyword arguments are forwarded to the specific plotting function.

Examples

>>> import pyarts3 as pyarts
>>> vec = pyarts.arts.Vector([1, 2, 3, 4])
>>> fig, ax = pyarts.plots.plot(vec)
>>> mat = pyarts.arts.Matrix([[1, 2], [3, 4]])
>>> fig, ax = pyarts.plots.plot(mat, cmap='viridis')
param data:

Any ARTS data type that has a corresponding plot module.

type data:

ARTS workspace type

param fig:

The matplotlib figure to draw on. Defaults to None for new figure.

type fig:

matplotlib Figure, optional

param ax:

The matplotlib axes to draw on. Defaults to None for new axes.

type ax:

matplotlib Axes, optional

param **kwargs:

All keyword arguments are forwarded to the specific plot function. Additional plot-specific parameters vary by data type.

returns:
  • fig (matplotlib Figure) – The matplotlib figure object.

  • ax (matplotlib Axes or list of Axes) – The matplotlib axes object(s).

raises TypeError:

If no plot module exists for the given data type.

pyarts3.plots.plot.__call__(*args, **kwargs)

Call self as a function.

pyarts3.plots.plot.__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.