pydiodon.plot_components_splines

pydiodon.plot_components_splines(Y, n_axis=- 1, v_col='red', title=None, x11=True, imfile=None, fmt='png')[source]

Plots principal components as lines smoothed with cublic splines, one per item

Parameters
Ya 2D numpy array of principal components
n_axisan integer, number of axis to include in the plot

default value is n_axis=-1 (all axis are considered)

v_cola string or a list; colors for splines

default value is “red” if a list : as list with one color per item

titlea string ; title for the plot

default value is None, no title

x11boolean ; whether to display the plot on the screen or not

default value is True, with display

imfilea string ; name of a file for saving the plot

default value is None, no saving

fmta string ; format for saving the plot

possible values are: “png”, “eps”, “pdf”

Notes

This displays parallel coordinates with one line per row of Y. up to n_axis components. See https://en.wikipedia.org/wiki/Parallel_coordinates for a presentation of parallel coordinates.

Let Y be the array of principal components. Let n_axis=k. An item i is row i of Y, restricted to k first columns: y_i = Y[i, 1:k]. Then, there is one curve per item, passing through the k points (1,Y[i,1]), (2, Y[i,2]), …, (k,Y[i,k]). Here, these lines are not piecewise linear, but smoothed by cubic splines.

Example

>>> import pydiodon as dio
>>> A, rn, cn = dio.load_dataset("diatoms_sweden")
>>> Y, L, V = dio.pca(A)
>>> dio.plot_components_splines(Y)

af, 23.01.18