Visualization#

Visualization methods are one of the most important tools for exploratory analysis. They can provide intuition over particular data that is very difficult to obtain otherwise. As functional data is infinite dimensional, good visualization tools capable to summarize and illustrate the main features of the data are of particular importance. The visualization module provides a thorough collection of these tools. Each of them highlights different characteristics of the data and thus they complement each other.

Basic representation#

Functional data with domain dimension of 1 or 2 can be represented directly as function graphs, which will be curves or surfaces respectively. Each codomain dimension will be plotted separately. Additionally, for discretized data, the discretization points can be plotted as a scatter plot. The following classes implement these plotting methods.

skfda.exploratory.visualization.representation.GraphPlot(fdata)

Class used to plot the FDataGrid object graph as hypersurfaces.

skfda.exploratory.visualization.representation.ScatterPlot(fdata)

Class used to scatter the FDataGrid object.

Note that the plot() and plot() methods simply instantiate and plot an object of one of these classes.

Parametric plot#

Parametric plots are used to plot one function versus another when they have the same domain. This is used for example in phase plane plots, showing the relation between two derivatives of different order. It is also useful to plot observations corresponding to curves in 2D, as it shows both dimensions of the codomain in the same plot.

skfda.exploratory.visualization.ParametricPlot(fdata1)

Parametric Plot visualization.

Functional Data Boxplot#

The functional data boxplot is an extension of the univariate boxplot to the functional data domain. As such, it is a very useful tool to detect outliers and check the magnitude of the variation of the data. There are two variants of this plot, depending on the number of dimensions (1 or 2) of the domain.

If the dimension of the domain is 1, the following class must be used. See the Boxplot example for detailed explanation.

skfda.exploratory.visualization.Boxplot(...)

Representation of the functional boxplot.

If the dimension of the domain is 2, this one. See the Surface Boxplot example for detailed explanation.

skfda.exploratory.visualization.SurfaceBoxplot(...)

Representation of the surface boxplot.

Outliergram#

The outliergram represents each functional observation as a point whose coordinates are its modified band depth and its modified epigraph index. These quantities are related, and in absence of crossings between observations the points should lie on a parabola. Thus, substantial deviations from that behavior characterize observations that are shape outliers.

skfda.exploratory.visualization.Outliergram(fdata)

Outliergram method of visualization.

DD-Plot#

The DD-plot plots the depth of each observation in two different distributions.

This is useful to understand how our data is more related with one subset of the data / distribution than another one.

skfda.exploratory.visualization.DDPlot(...)

DDPlot visualization.

Magnitude-Shape Plot#

The Magnitude-Shape plot tries to summarize the shape and magnitude of an observation as real numbers, and plot them in a scatter plot. In addition it computes an ellipse, which serves as a decision boundary for detecting outliers.

This is a very useful tool to detect shape and magnitude outliers and differentiate between them.

skfda.exploratory.visualization.MagnitudeShapePlot(fdata)

Implementation of the magnitude-shape plot.

Clustering Plots#

In order to show the results of the cluster algorithms in a visual way, this module is implemented. It contains the following classes:

In the first one, the samples of the FDataGrid are divided by clusters which are assigned different colors. The following functions, are only valid for the class FuzzyKMeans to see the results graphically in the form of a parallel coordinates plot or a barplot respectively.

See Clustering Example for detailed explanation.

Functional Principal Component Analysis Plots#

In order to show the modes of variation that the principal components represent, the following class is implemented:

skfda.exploratory.visualization.FPCAPlot(...)

FPCAPlot visualization.

See the example Functional Principal Component Analysis for detailed explanation.

Mixed Data Plots#

The MixedDataPlot class is used to visualize datasets that contain both functional and scalar variables. It is particularly useful in exploratory analysis of mixed-type data represented as rows in a pandas.DataFrame, where each column may represent a scalar or a functional variable.

Functional variables are plotted using their native plot() methods. If the functional data is multivariate (i.e., vector-valued), each component is overlaid in the same subplot unless otherwise specified. Scalar variables are visualized using standard scatter plots.

The plot also supports grouping samples by category, with options to assign specific colors and display legends for better interpretability.

skfda.exploratory.visualization.representation.MixedDataPlot(df)

Class used to plot a Mixed Data object represented in DataFrames.

See the example sphx-glr-auto-examples-representation-plot-mixed-data-py for a detailed explanation and usage demonstration.