skspatial.objects.Vector.plot_2d

Vector.plot_2d(ax_2d: Axes, point: Union[ndarray, Sequence] = (0, 0), scalar: float = 1, **kwargs) None[source]

Plot a 2D vector.

The vector is plotted as an arrow.

Parameters:
ax_2dAxes

Instance of Axes.

pointarray_like, optional

Position of the vector tail (default is origin).

scalar{int, float}, optional

Value used to scale the vector (default 1).

kwargsdict, optional

Additional keywords passed to arrow().

Examples

>>> import matplotlib.pyplot as plt
>>> from skspatial.objects import Vector
>>> _, ax = plt.subplots()
>>> Vector([1, 1]).plot_2d(ax, point=(-3, 5), scalar=2, head_width=0.5)
>>> limits = ax.axis([-5, 5, 0, 10])

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

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