skspatial.objects.Triangle.plot_2d

Triangle.plot_2d(ax_2d: matplotlib.axes._axes.Axes, part: str = 'points', **kwargs: str) None[source]

Plot a triangle in 2D.

Parameters
ax_2dAxes

Instance of Axes.

partstr, optional

Part of the triangle to plot. Either ‘points’ or ‘lines’ (default ‘points’).

kwargsdict, optional

Additional keywords passed to plot_2d() or plot_2d().

Examples

>>> import matplotlib.pyplot as plt
>>> from skspatial.objects import Triangle
>>> triangle = Triangle([0, 0], [1, 0], [0, 1])
>>> _, ax = plt.subplots()
>>> triangle.plot_2d(ax, part='points', s=100, zorder=3)
>>> triangle.plot_2d(ax, part='lines', c='k')

(Source code, png, hires.png, pdf)

../../../_images/skspatial-objects-Triangle-plot_2d-1.png