maad.util.plot_features_map

maad.util.plot_features_map(df, norm=True, mode='24h', **kwargs)[source]

Plot features values on a heatmap.

The plot has the features the vertical axis and the time on the horizontal axis.

Parameters:
dfPanda DataFrame

DataFrame with features (ie. indices).

normboolean, default is True

if True, the features are scaled between 0 to 1

modestring in {‘24h’}, default is ‘24h’

Select if the timeline of the phenology:

-‘24h’ : average of the results over a day - otherwise, the timeline is the timeline of the dataframe

**kwargs

Specific to this function:

Specific to matplotlib:

  • figsize : tuple of integers, optional, default: (4,10) width, height in inches.

  • title : string, optional, default : ‘Spectrogram’ title of the figure

  • xlabel : string, optional, default : ‘Time [s]’ label of the horizontal axis

  • ylabel : string, optional, default : ‘Amplitude [AU]’ label of the vertical axis

  • xtickstuple of ndarrays, optional, defaultnone
    • ticks : array_like => A list of positions at which ticks should be placed. You can pass an empty list to disable yticks.

    • labels : array_like, optional => A list of explicit labels to place at the given locs.

  • ytickstuple of ndarrays, optional, defaultnone
    • ticks : array_like => A list of positions at which ticks should be placed. You can pass an empty list to disable yticks.

    • labels : array_like, optional => A list of explicit labels to place at the given locs.

  • cmapstring or Colormap object, optional, default is ‘gray’

    See https://matplotlib.org/examples/color/colormaps_reference.html in order to get all the existing colormaps examples: ‘hsv’, ‘hot’, ‘bone’, ‘tab20c’, ‘jet’, ‘seismic’, ‘viridis’…

  • vmin, vmaxscalar, optional, default: None

    vmin and vmax are used in conjunction with norm to normalize luminance data. Note if you pass a norm instance, your settings for vmin and vmax will be ignored.

  • extentlist of scalars [left, right, bottom, top], optional, default: None

    The location, in data-coordinates, of the lower-left and upper-right corners. If None, the image is positioned such that the pixel centers fall on zero-based (row, column) indices.

  • nowboolean, optional, defaultTrue

    if True, display now. Cannot display multiple images. To display mutliple images, set now=False until the last call for the last image

… and more, see matplotlib

Returns:
figFigure

The Figure instance

axAxis

The Axis instance

Examples

see plot_extract_alpha_indices.py advanced example for a complete example

>>> import numpy as np
>>> import pandas as pd
>>> np.random.seed(2021)
>>> M = np.random.rand(24, 7)
>>> df = pd.DataFrame(M)
>>> indices = ['A','B','C','D','E','F','G']
>>> df.columns = indices
>>> df.index =pd.date_range(start=pd.Timestamp('00:00:00'), end=pd.Timestamp('23:00:00'), freq='1H')
>>> maad.util.plot_features_map(df)