Source code for data_morph.shapes.lines.x_lines
"""X lines shape."""
from ...data.dataset import Dataset
from ..bases.line_collection import LineCollection
[docs]
class XLines(LineCollection):
"""
Class for the X shape consisting of two crossing, perpendicular lines.
.. plot::
:scale: 75
:caption:
This shape is generated using the panda dataset.
from data_morph.data.loader import DataLoader
from data_morph.plotting.diagnostics import plot_shape_on_dataset
from data_morph.shapes.lines import XLines
dataset = DataLoader.load_dataset('panda')
shape = XLines(dataset)
plot_shape_on_dataset(dataset, shape, show_bounds=False, alpha=0.25)
Parameters
----------
dataset : Dataset
The starting dataset to morph into other shapes.
"""
name = 'x'
def __init__(self, dataset: Dataset) -> None:
(xmin, xmax), (ymin, ymax) = dataset.morph_bounds
super().__init__([[xmin, ymin], [xmax, ymax]], [[xmin, ymax], [xmax, ymin]])