eolearn.visualization.eopatch

This module implements visualizations for EOPatch

class eolearn.visualization.eopatch.PlotBackend(value)[source]

Bases: Enum

Types of backend for plotting

MATPLOTLIB = 'matplotlib'
eolearn.visualization.eopatch.plot_eopatch(*args, backend=PlotBackend.MATPLOTLIB, **kwargs)[source]

The main EOPatch plotting function. It pr

Parameters:
  • args (Any) – Positional arguments to be propagated to a plotting backend.

  • backend (PlotBackend | str) – Which plotting backend to use.

  • kwargs (Any) – Keyword arguments to be propagated to a plotting backend.

Returns:

A plot object that depends on the backend used.

Return type:

object

class eolearn.visualization.eopatch.PlotConfig(rgb_factor=3.5, timestamp_column='TIMESTAMP', geometry_column='geometry', subplot_width=8, subplot_height=8, interpolation='none', subplot_kwargs=<factory>, show_title=True, title_kwargs=<factory>, label_kwargs=<factory>, bbox_kwargs=<factory>)[source]

Bases: object

Advanced plotting configurations

Parameters:
  • rgb_factor (float | None) – A factor by which to scale RGB images to make them look better.

  • timestamp_column (str | None) – A name of a column containing timestamps in a GeoDataFrame feature. If set to None it will plot temporal vector features as if they were timeless.

  • geometry_column (str) – A name of a column containing geometries in a GeoDataFrame feature.

  • subplot_width (float | int) – A width of each subplot in a grid

  • subplot_height (float | int) – A height of each subplot in a grid

  • subplot_kwargs (dict[str, object]) – A dictionary of parameters that will be passed to matplotlib.pyplot.subplots function.

  • show_title (bool) – A flag to specify if plot title should be shown.

  • title_kwargs (dict[str, object]) – A dictionary of parameters that will be passed to matplotlib.figure.Figure.suptitle.

  • label_kwargs (dict[str, object]) – A dictionary of parameters that will be passed to matplotlib methods for setting axes labels.

  • bbox_kwargs (dict[str, object]) – A dictionary of parameters that will be passed to GeoDataFrame.plot when plotting a bounding box.

  • interpolation (str) –

rgb_factor: float | None = 3.5
timestamp_column: str | None = 'TIMESTAMP'
geometry_column: str = 'geometry'
subplot_width: float | int = 8
subplot_height: float | int = 8
interpolation: str = 'none'
subplot_kwargs: dict[str, object]
show_title: bool = True
title_kwargs: dict[str, object]
label_kwargs: dict[str, object]
bbox_kwargs: dict[str, object]
class eolearn.visualization.eopatch.MatplotlibVisualization(eopatch, feature, *, axes=None, config=None, times=None, channels=None, channel_names=None, rgb=None)[source]

Bases: object

EOPatch visualization using matplotlib framework.

Parameters:
  • eopatch (EOPatch) – An EOPatch with a feature to plot.

  • feature (Feature) – A feature from the given EOPatch to plot.

  • axes (np.ndarray | None) – A grid of axes on which to write plots. If not provided it will create a new grid.

  • config (PlotConfig | None) – A configuration object with advanced plotting parameters.

  • times (list[int] | slice | None) – A list or a slice of indices on temporal axis to be used for plotting. If not provided all indices will be used.

  • channels (list[int] | slice | None) – A list or a slice of indices on channels axis to be used for plotting. If not provided all indices will be used.

  • channel_names (list[str] | None) – Names of channels of the last dimension in the given raster feature.

  • rgb (tuple[int, int, int] | None) – If provided, it should be a list of 3 indices of RGB channels to be plotted. It will plot only RGB images with these channels. This only works for raster features with spatial dimension.

plot()[source]

Plots the given feature

Return type:

ndarray

collect_and_prepare_feature(eopatch)[source]

Collects a feature from EOPatch and modifies it according to plotting parameters

Parameters:

eopatch (EOPatch) –

Return type:

tuple[Any, list[datetime.datetime] | None]