@@ -401,11 +401,50 @@ def plot_box(
401401 return r
402402
403403def plot_arrow (start , end , ax = None , ** kwargs ):
404+ """
405+ Plot 2D arrow
406+
407+ :param start: start point, arrow tail
408+ :type start: array_like(2)
409+ :param end: end point, arrow head
410+ :type end: array_like(2)
411+ :param ax: axes to draw into, defaults to None
412+ :type ax: Axes, optional
413+ :param kwargs: argumetns to pass to :class:`matplotlib.patches.Arrow`
414+
415+ Example:
416+
417+ .. runblock:: pycon
418+
419+ >>> from spatialmath.base import plotvol2, plot_arrow
420+ >>> plotvol2(5)
421+ >>> plot_arrow((-2, 2), (3, 4), color='r', width=0.1) # red arrow
422+ """
404423 ax = axes_logic (ax , 2 )
405424
406425 ax .arrow (start [0 ], start [1 ], end [0 ] - start [0 ], end [1 ] - start [1 ], length_includes_head = True , ** kwargs )
407426
408427def plot_polygon (vertices , * fmt , close = False , ** kwargs ):
428+ """
429+ Plot polygon
430+
431+ :param vertices: vertices
432+ :type vertices: ndarray(2,N)
433+ :param close: close the polygon, defaults to False
434+ :type close: bool, optional
435+ :param kwargs: arguments passed to Patch
436+ :return: Matplotlib artist
437+ :rtype: line or patch
438+
439+ Example:
440+
441+ .. runblock:: pycon
442+
443+ >>> from spatialmath.base import plotvol2, plot_polygon
444+ >>> plotvol2(5)
445+ >>> vertices = np.array([[-1, 2, -1], [1, 0, -1]])
446+ >>> plot_polygon(vertices, filled=True, facecolor='g') # green filled triangle
447+ """
409448
410449 if close :
411450 vertices = np .hstack ((vertices , vertices [:, [0 ]]))
@@ -471,7 +510,7 @@ def plot_circle(
471510 :param args:
472511 :param radius: radius of circle
473512 :type radius: float
474- :param resolution: number of points on circumferece , defaults to 50
513+ :param resolution: number of points on circumference , defaults to 50
475514 :type resolution: int, optional
476515 :return: the matplotlib object
477516 :rtype: list of Line2D or Patch.Polygon
@@ -1168,17 +1207,13 @@ def plotvol2(dim, ax=None, equal=True, grid=False, labels=True):
11681207
11691208 Initialize axes with dimensions given by ``dim`` which can be:
11701209
1171- * A (scalar), -A:A x -A:A
1172- * [A,B], A:B x A:B
1173- * [A,B,C,D], A:B x C:D
1174-
1175- ================== ====== ======
1176- input xrange yrange
1177- ================== ====== ======
1178- A (scalar) -A:A -A:A
1179- [A, B] A:B A:B
1180- [A, B, C, D, E, F] A:B C:D
1181- ================== ====== ======
1210+ ============== ====== ======
1211+ input xrange yrange
1212+ ============== ====== ======
1213+ A (scalar) -A:A -A:A
1214+ [A, B] A:B A:B
1215+ [A, B, C, D] A:B C:D
1216+ ============== ====== ======
11821217
11831218 :seealso: :func:`plotvol3`, :func:`expand_dims`
11841219 """
@@ -1259,7 +1294,7 @@ def plotvol3(
12591294
12601295def expand_dims (dim = None , nd = 2 ):
12611296 """
1262- Expact compact axis dimensions
1297+ Expand compact axis dimensions
12631298
12641299 :param dim: dimensions, defaults to None
12651300 :type dim: scalar, array_like(2), array_like(4), array_like(6), optional
0 commit comments