Skip to content

Parallel coordinate

daspi.plotlib.plotter.ParallelCoordinate(source, target, feature, identity, show_scatter=True, target_on_y=True, color=None, marker=None, ax=None, visible_spines=None, hide_axis=None, **kwds)

Bases: Plotter

This plotter allows to compare the feature of several individual observations on a set of numeric variables.

PARAMETER DESCRIPTION
source

Pandas long format DataFrame containing the data source for the plot.

TYPE: pandas DataFrame

target

Column name of the target variable for the plot.

TYPE: str

feature

Column name of the categorical feature variable (coordinates).

TYPE: str

identity

Column name containing identities of each sample, must occur once for each coordinate.

TYPE: str

show_scatter

Flag indicating whether to show the individual points, by default True.

TYPE: bool DEFAULT: True

target_on_y

Flag indicating whether the target variable is plotted on the y-axis, by default True.

TYPE: bool DEFAULT: True

color

Color to be used to draw the artists. If None, the first color is taken from the color cycle, by default None.

TYPE: str | None DEFAULT: None

marker

The marker style for the scatter plot. Available markers see: https://matplotlib.org/stable/api/markers_api.html, by default None

TYPE: str | None DEFAULT: None

ax

The axes object for the plot. If None, the current axes is fetched using plt.gca(). If no axes are available, a new one is created. Defaults to None.

TYPE: Axes | None DEFAULT: None

visible_spines

Specifies which spines are visible, the others are hidden. If 'none', no spines are visible. If None, the spines are drawn according to the stylesheet. Defaults to None.

TYPE: Literal['target', 'feature', 'none'] | None DEFAULT: None

hide_axis

Specifies which axes should be hidden. If None, both axes are displayed. Defaults to None.

TYPE: Literal['target', 'feature', 'both'] | None DEFAULT: None

**kwds

Those arguments have no effect. Only serves to catch further arguments that have no use here (occurs when this class is used within chart objects).

DEFAULT: {}

Examples:

Apply to an existing Axes object:

import matplotlib.pyplot as plt
from daspi import ParallelCoordinate, load_dataset

fig, ax = plt.subplots()
df = load_dataset('shoe-sole')
parallel = ParallelCoordinate(
    source=df, target='wear', feature='status', identity='tester',
    show_scatter=True, ax=ax)
parallel()
parallel.label_feature_ticks()

Apply using the plot method of a DaSPi Chart object:

import numpy as np
import daspi as dsp
import pandas as pd

df = dsp.load_dataset('shoe-sole')
chart = dsp.SingleChart(
        source=df,
        target='wear',
        feature='status',
        categorical_feature=True,
    ).plot(
        dsp.ParallelCoordinate,
        identity='tester',
        show_scatter=True,
    ).label() # neded to label feature ticks

identity = identity instance-attribute

Column name containing identities of each sample.

show_scatter = show_scatter instance-attribute

Whether to show the individual points or not.

kw_default property

Default keyword arguments for plotting (read-only)