Skip to content

Spines

GenericSpineBuilder

Source code in itfit/plot/spines.py
class GenericSpineBuilder:
    def __init__(self, plot_builder: PlotBuilder, spine_builder: SpineBuilder):
        """Spine builder. Used to modify plot spines.

        Args:
            plot_builder (itfit.plot.spines.GenericSpineBuilder): GenericSpineBuilder instance.
        """
        self._plot_builder_ = plot_builder
        self._spine_builder_ = spine_builder
        self._dict_: dict[str, object] = {}

    def alpha(self, alpha: float):
        """Sets spines alpha.

        Args:
            alpha (float): alpha value

        Returns:
            (itfit.plot.spines.GenericSpineBuilder): Returns itself.
        """
        self._dict_.update({'alpha':alpha})
        return self

    def visible(self):
        """Sets spine visible.

        Returns:
            (itfit.plot.spines.GenericSpineBuilder): Returns itself.
        """
        self._dict_.update({'visible':True})
        return self

    def invisible(self):
        """Sets spine invisible.

        Returns:
            (itfit.plot.spines.GenericSpineBuilder): Returns itself.
        """
        self._dict_.update({'visible':False})
        return self

    def color(self, color):
        """Sets the color of the spine.

        Args:
            color (str|tuple[float]): Color for the spine.

        Returns:
            (itfit.plot.spines.GenericSpineBuilder): Returns itself.
        """
        self._dict_.update({'color': color})
        return self

    def linestyle(self, linestyle):
        """Changes spine linestyle.

        Args:
            linestyle (str): Spine linestyle.

        Returns:
            (itfit.plot.spines.GenericSpineBuilder): Returns itself.
        """
        self._dict_.update({'linestyle': linestyle})
        return self

    def linewidth(self, linewidth):
        """Changes spine linewidth.

        Args:
            linewidth (float): Spine linewidth.

        Returns:
            (itfit.plot.spines.GenericSpineBuilder): Returns itself.
        """
        self._dict_.update({'linewidth': linewidth})
        return self

    def _end_spine_builder(self, spine):
        self._plot_builder_.ax.spines[spine].set(**self._dict_)
        return self._spine_builder_

__init__(plot_builder, spine_builder)

Spine builder. Used to modify plot spines.

Parameters:

Name Type Description Default
plot_builder itfit.plot.spines.GenericSpineBuilder

GenericSpineBuilder instance.

required
Source code in itfit/plot/spines.py
def __init__(self, plot_builder: PlotBuilder, spine_builder: SpineBuilder):
    """Spine builder. Used to modify plot spines.

    Args:
        plot_builder (itfit.plot.spines.GenericSpineBuilder): GenericSpineBuilder instance.
    """
    self._plot_builder_ = plot_builder
    self._spine_builder_ = spine_builder
    self._dict_: dict[str, object] = {}

alpha(alpha)

Sets spines alpha.

Parameters:

Name Type Description Default
alpha float

alpha value

required

Returns:

Type Description
itfit.plot.spines.GenericSpineBuilder

Returns itself.

Source code in itfit/plot/spines.py
def alpha(self, alpha: float):
    """Sets spines alpha.

    Args:
        alpha (float): alpha value

    Returns:
        (itfit.plot.spines.GenericSpineBuilder): Returns itself.
    """
    self._dict_.update({'alpha':alpha})
    return self

color(color)

Sets the color of the spine.

Parameters:

Name Type Description Default
color str | tuple[float]

Color for the spine.

required

Returns:

Type Description
itfit.plot.spines.GenericSpineBuilder

Returns itself.

Source code in itfit/plot/spines.py
def color(self, color):
    """Sets the color of the spine.

    Args:
        color (str|tuple[float]): Color for the spine.

    Returns:
        (itfit.plot.spines.GenericSpineBuilder): Returns itself.
    """
    self._dict_.update({'color': color})
    return self

invisible()

Sets spine invisible.

Returns:

Type Description
itfit.plot.spines.GenericSpineBuilder

Returns itself.

Source code in itfit/plot/spines.py
def invisible(self):
    """Sets spine invisible.

    Returns:
        (itfit.plot.spines.GenericSpineBuilder): Returns itself.
    """
    self._dict_.update({'visible':False})
    return self

linestyle(linestyle)

Changes spine linestyle.

Parameters:

Name Type Description Default
linestyle str

Spine linestyle.

required

Returns:

Type Description
itfit.plot.spines.GenericSpineBuilder

Returns itself.

Source code in itfit/plot/spines.py
def linestyle(self, linestyle):
    """Changes spine linestyle.

    Args:
        linestyle (str): Spine linestyle.

    Returns:
        (itfit.plot.spines.GenericSpineBuilder): Returns itself.
    """
    self._dict_.update({'linestyle': linestyle})
    return self

linewidth(linewidth)

Changes spine linewidth.

Parameters:

Name Type Description Default
linewidth float

Spine linewidth.

required

Returns:

Type Description
itfit.plot.spines.GenericSpineBuilder

Returns itself.

Source code in itfit/plot/spines.py
def linewidth(self, linewidth):
    """Changes spine linewidth.

    Args:
        linewidth (float): Spine linewidth.

    Returns:
        (itfit.plot.spines.GenericSpineBuilder): Returns itself.
    """
    self._dict_.update({'linewidth': linewidth})
    return self

visible()

Sets spine visible.

Returns:

Type Description
itfit.plot.spines.GenericSpineBuilder

Returns itself.

Source code in itfit/plot/spines.py
def visible(self):
    """Sets spine visible.

    Returns:
        (itfit.plot.spines.GenericSpineBuilder): Returns itself.
    """
    self._dict_.update({'visible':True})
    return self

SpineBuilder

Source code in itfit/plot/spines.py
class SpineBuilder:
    def __init__(self, plot_builder: PlotBuilder):
        """Spine builder. Used to modify plot spines.

        Args:
            plot_builder (itfit.plot.PlotBuilder): PlotBuilder instance.
        """
        self._plot_builder_ = plot_builder
        self._dict_: dict[str, object] = {}

    def start_left_spine(self):
        """Starts a left spine builder.

        Returns:
            (itift.plot.spines.leftSpineBuilder): left spine builder.
        """
        return leftSpineBuilder(self._plot_builder_, self)

    def start_right_spine(self):
        """Starts a right spine builder.

        Returns:
            (itift.plot.spines.rightSpineBuilder): right spine builder.
        """
        return rightSpineBuilder(self._plot_builder_, self)

    def start_top_spine(self):
        """Starts a top spine builder.

        Returns:
            (itift.plot.spines.topSpineBuilder): top spine builder.
        """
        return topSpineBuilder(self._plot_builder_, self)

    def start_bottom_spine(self):
        """Starts a bottom spine builder.

        Returns:
            (itift.plot.spines.bottomSpineBuilder): bottom spine builder.
        """
        return bottomSpineBuilder(self._plot_builder_, self)

    def end_spines(self):
        """Ends spine builder.

        Returns:
            (itfit.plot.PlotBuilder): Returns the PlotBuilder.
        """
        return self._plot_builder_

__init__(plot_builder)

Spine builder. Used to modify plot spines.

Parameters:

Name Type Description Default
plot_builder itfit.plot.PlotBuilder

PlotBuilder instance.

required
Source code in itfit/plot/spines.py
def __init__(self, plot_builder: PlotBuilder):
    """Spine builder. Used to modify plot spines.

    Args:
        plot_builder (itfit.plot.PlotBuilder): PlotBuilder instance.
    """
    self._plot_builder_ = plot_builder
    self._dict_: dict[str, object] = {}

end_spines()

Ends spine builder.

Returns:

Type Description
itfit.plot.PlotBuilder

Returns the PlotBuilder.

Source code in itfit/plot/spines.py
def end_spines(self):
    """Ends spine builder.

    Returns:
        (itfit.plot.PlotBuilder): Returns the PlotBuilder.
    """
    return self._plot_builder_

start_bottom_spine()

Starts a bottom spine builder.

Returns:

Type Description
itift.plot.spines.bottomSpineBuilder

bottom spine builder.

Source code in itfit/plot/spines.py
def start_bottom_spine(self):
    """Starts a bottom spine builder.

    Returns:
        (itift.plot.spines.bottomSpineBuilder): bottom spine builder.
    """
    return bottomSpineBuilder(self._plot_builder_, self)

start_left_spine()

Starts a left spine builder.

Returns:

Type Description
itift.plot.spines.leftSpineBuilder

left spine builder.

Source code in itfit/plot/spines.py
def start_left_spine(self):
    """Starts a left spine builder.

    Returns:
        (itift.plot.spines.leftSpineBuilder): left spine builder.
    """
    return leftSpineBuilder(self._plot_builder_, self)

start_right_spine()

Starts a right spine builder.

Returns:

Type Description
itift.plot.spines.rightSpineBuilder

right spine builder.

Source code in itfit/plot/spines.py
def start_right_spine(self):
    """Starts a right spine builder.

    Returns:
        (itift.plot.spines.rightSpineBuilder): right spine builder.
    """
    return rightSpineBuilder(self._plot_builder_, self)

start_top_spine()

Starts a top spine builder.

Returns:

Type Description
itift.plot.spines.topSpineBuilder

top spine builder.

Source code in itfit/plot/spines.py
def start_top_spine(self):
    """Starts a top spine builder.

    Returns:
        (itift.plot.spines.topSpineBuilder): top spine builder.
    """
    return topSpineBuilder(self._plot_builder_, self)

bottomSpineBuilder

Bases: GenericSpineBuilder

Source code in itfit/plot/spines.py
class bottomSpineBuilder(GenericSpineBuilder):
    def __init__(self, plot_builder, spine_builder):
        super().__init__(plot_builder, spine_builder)
        self._spine = "bottom"

    def end_bottom_spine(self):
        """Ends bottom spine builder.

        Returns:
            (itfit.plot.PlotBuilder): Returns the PlotBuilder.
        """
        return self._end_spine_builder(self._spine)

end_bottom_spine()

Ends bottom spine builder.

Returns:

Type Description
itfit.plot.PlotBuilder

Returns the PlotBuilder.

Source code in itfit/plot/spines.py
def end_bottom_spine(self):
    """Ends bottom spine builder.

    Returns:
        (itfit.plot.PlotBuilder): Returns the PlotBuilder.
    """
    return self._end_spine_builder(self._spine)

leftSpineBuilder

Bases: GenericSpineBuilder

Source code in itfit/plot/spines.py
class leftSpineBuilder(GenericSpineBuilder):
    def __init__(self, plot_builder, spine_builder):
        super().__init__(plot_builder, spine_builder)
        self._spine = "left"

    def end_left_spine(self):
        """Ends left spine builder.

        Returns:
            (itfit.plot.PlotBuilder): Returns the PlotBuilder.
        """
        return self._end_spine_builder(self._spine)

end_left_spine()

Ends left spine builder.

Returns:

Type Description
itfit.plot.PlotBuilder

Returns the PlotBuilder.

Source code in itfit/plot/spines.py
def end_left_spine(self):
    """Ends left spine builder.

    Returns:
        (itfit.plot.PlotBuilder): Returns the PlotBuilder.
    """
    return self._end_spine_builder(self._spine)

rightSpineBuilder

Bases: GenericSpineBuilder

Source code in itfit/plot/spines.py
class rightSpineBuilder(GenericSpineBuilder):
    def __init__(self, plot_builder, spine_builder):
        super().__init__(plot_builder, spine_builder)
        self._spine = "right"

    def end_right_spine(self):
        """Ends right spine builder.

        Returns:
            (itfit.plot.PlotBuilder): Returns the PlotBuilder.
        """
        return self._end_spine_builder(self._spine)

end_right_spine()

Ends right spine builder.

Returns:

Type Description
itfit.plot.PlotBuilder

Returns the PlotBuilder.

Source code in itfit/plot/spines.py
def end_right_spine(self):
    """Ends right spine builder.

    Returns:
        (itfit.plot.PlotBuilder): Returns the PlotBuilder.
    """
    return self._end_spine_builder(self._spine)

topSpineBuilder

Bases: GenericSpineBuilder

Source code in itfit/plot/spines.py
class topSpineBuilder(GenericSpineBuilder):
    def __init__(self, plot_builder, spine_builder):
        super().__init__(plot_builder, spine_builder)
        self._spine = "top"

    def end_top_spine(self):
        """Ends top spne builder.

        Returns:
            (itfit.plot.PlotBuilder): Returns the PlotBuilder.
        """
        return self._end_spine_builder(self._spine)

end_top_spine()

Ends top spne builder.

Returns:

Type Description
itfit.plot.PlotBuilder

Returns the PlotBuilder.

Source code in itfit/plot/spines.py
def end_top_spine(self):
    """Ends top spne builder.

    Returns:
        (itfit.plot.PlotBuilder): Returns the PlotBuilder.
    """
    return self._end_spine_builder(self._spine)