hibou.utils.TaylorDiagramAxes#
- class hibou.utils.TaylorDiagramAxes(*args, **kwargs)#
This class inherits from
PolarAxesand modify thisAxessubclass to looks like a Taylor diagram.As
TaylorDiagramAxesis a subclass ofPolarAxes, all the common manipulations (e.g.set_title,legend,grid) are still functionnal.Methods#
- adjust_axes(is_extended: bool = False, corr_labels: array = None)#
Adjusts axes and the ticks of the Taylor diagram also plot the RMSD.
Parameters#
- is_extended
bool, optionnal By default:
False. If set onTrue, the Taylor diagram will be extended to negative value of correlation coefficient.- corr_labels
np.array, optionnal By default:
np.array( [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 1] )
The labels for the correlation ticks. You should pass floats. If
is_extendedisTrue, the corr_labels will be duplicated with a minus sign. So you should never have to pass negative values.
- is_extended
- set_reference(reference: array, *args, **kwargs)#
Sets the reference for the normalization of the standard deviation. It also plot the point of reference on Taylor diagram.
Parameters#
- reference
np.array The data of reference.
- args
Positionnal arguments to be passed to
Axes.scatter.- kwargs
Keyword arguments to be passed to
Axes.scatter.
- reference
Examples#
A basic example:
import numpy as np import matplotlib.pyplot as plt from hibou.utils import TaylorDiagramAxes # instanciate figure and axes fig = plt.figure() axes = fig.add_subplot(1, 1, 1, axes_class=TaylorDiagramAxes) # data to plot on the Taylor diagram ref_data = np.array([1, 2, 3]) data = np.array([0, 1, 2.5]) # plot points on the diagram axes.set_reference(ref_data, marker="*", color="black", label="reference") axes.add_point(data, label="data 1") # finalize diagram and show axes.adjust_axes() axes.legend(loc="upper right", bbox_to_anchor=(0, 1)) plt.show()