GraphPlot#

class skfda.exploratory.visualization.representation.GraphPlot(fdata, chart=None, *, fig=None, axes=None, n_rows=None, n_cols=None, n_points=None, domain_range=None, group=None, group_colors=None, group_names=None, gradient_criteria=None, max_grad=None, min_grad=None, colormap=None, legend=False, **kwargs)[source]#

Class used to plot the FDataGrid object graph as hypersurfaces.

When plotting functional data, we can either choose manually a color, a group of colors for the representations. Besides, we can use a list of variables (depths, scalar regression targets…) can be used as an argument to display the functions wtih a gradient of colors.

Parameters:
  • fdata (FData) – functional data set that we want to plot.

  • gradient_criteria (Sequence[float] | None) – list of real values used to determine the color in which each of the instances will be plotted.

  • max_grad (float | None) – maximum value that the gradient_list can take, it will be used to normalize the gradient_criteria in order to get values that can be used in the function colormap.__call__(). If not declared it will be initialized to the maximum value of gradient_list.

  • min_grad (float | None) – minimum value that the gradient_list can take, it will be used to normalize the gradient_criteria in order to get values that can be used in the function colormap.__call__(). If not declared it will be initialized to the minimum value of gradient_list.

  • chart (Figure | Axes | None) – figure over with the graphs are plotted or axis over where the graphs are plotted. If None and ax is also None, the figure is initialized.

  • fig (Figure | None) – figure over with the graphs are plotted in case ax is not specified. If None and ax is also None, the figure is initialized.

  • axes (Axes | None) – axis over where the graphs are plotted. If None, see param fig.

  • n_rows (int | None) – designates the number of rows of the figure to plot the different dimensions of the image. Only specified if fig and ax are None.

  • n_cols (int | None) – designates the number of columns of the figure to plot the different dimensions of the image. Only specified if fig and ax are None.

  • n_points (int | Tuple[int, int] | None) – Number of points to evaluate in the plot. In case of surfaces a tuple of length 2 can be pased with the number of points to plot in each axis, otherwise the same number of points will be used in the two axes. By default in unidimensional plots will be used 501 points; in surfaces will be used 30 points per axis, wich makes a grid with 900 points.

  • domain_range (DomainRangeLike | None) – Range where the function will be plotted. In objects with unidimensional domain the domain range should be a tuple with the bounds of the interval; in the case of surfaces a list with 2 tuples with the ranges for each dimension. Default uses the domain range of the functional object.

  • group (Sequence[K] | None) – contains integers from [0 to number of labels) indicating to which group each sample belongs to. Then, the samples with the same label are plotted in the same color. If None, the default value, each sample is plotted in the color assigned by matplotlib.pyplot.rcParams[‘axes.prop_cycle’].

  • group_colors (Indexable[K, ColorLike] | None) – colors in which groups are represented, there must be one for each group. If None, each group is shown with distict colors in the “Greys” colormap.

  • group_names (Indexable[K, str] | None) – name of each of the groups which appear in a legend, there must be one for each one. Defaults to None and the legend is not shown. Implies legend=True.

  • colormap (Colormap | str | None) – name of the colormap to be used. By default we will use autumn.

  • legend (bool) – if True, show a legend with the groups. If group_names is passed, it will be used for finding the names to display in the legend. Otherwise, the values passed to group will be used.

  • kwargs (Any) – if dim_domain is 1, keyword arguments to be passed to the matplotlib.pyplot.plot function; if dim_domain is 2, keyword arguments to be passed to the matplotlib.pyplot.plot_surface function.

Attributes:

gradient_list – normalization of the values from gradient color_list that will be used to determine the intensity of the color each function will have.

Methods

hover(event)

Activate the annotation when hovering a point.

plot()

Plot the object and its data.

hover(event)[source]#

Activate the annotation when hovering a point.

Callback method that activates the annotation when hovering a specific point in a graph. The annotation is a description of the point containing its coordinates.

Parameters:

event (MouseEvent) – event object containing the artist of the point hovered.

Return type:

None

plot()[source]#

Plot the object and its data.

Returns:

figure object in which the displays and

widgets will be plotted.

Return type:

Figure