@@ -1000,13 +1000,13 @@ def get_xyt(self):
10001000 xyt = None
10011001 return xyt
10021002
1003- def plot_xy (self , * args , block = False , ** kwargs ):
1003+ def plot_xy (self , * args , block = None , ** kwargs ):
10041004 """
10051005 Plot estimated vehicle position
10061006
10071007 :param args: position arguments passed to :meth:`~matplotlib.axes.Axes.plot`
10081008 :param kwargs: keywords arguments passed to :meth:`~matplotlib.axes.Axes.plot`
1009- :param block: hold plot until figure is closed, defaults to False
1009+ :param block: hold plot until figure is closed, defaults to None
10101010 :type block: bool, optional
10111011
10121012 Plot the estimated vehicle path in the xy-plane.
@@ -1018,16 +1018,19 @@ def plot_xy(self, *args, block=False, **kwargs):
10181018 kwargs ["color" ] = "r"
10191019 xyt = self .get_xyt ()
10201020 plt .plot (xyt [:, 0 ], xyt [:, 1 ], * args , ** kwargs )
1021- # plt.show(block=block)
1021+ if block is not None :
1022+ plt .show (block = block )
10221023
1023- def plot_ellipse (self , confidence = 0.95 , N = 10 , ** kwargs ):
1024+ def plot_ellipse (self , confidence = 0.95 , N = 10 , block = None , ** kwargs ):
10241025 """
10251026 Plot uncertainty ellipses
10261027
10271028 :param confidence: ellipse confidence interval, defaults to 0.95
10281029 :type confidence: float, optional
10291030 :param N: number of ellipses to plot, defaults to 10
10301031 :type N: int, optional
1032+ :param block: hold plot until figure is closed, defaults to None
1033+ :type block: bool, optional
10311034 :param kwargs: arguments passed to :meth:`spatialmath.base.graphics.plot_ellipse`
10321035
10331036 Plot ``N`` uncertainty ellipses spaced evenly along the trajectory.
@@ -1062,15 +1065,19 @@ def plot_ellipse(self, confidence=0.95, N=10, **kwargs):
10621065 inverted = True ,
10631066 ** kwargs ,
10641067 )
1068+ if block is not None :
1069+ plt .show (block = block )
10651070
1066- def plot_error (self , bgcolor = "r" , confidence = 0.95 , ax = None , ** kwargs ):
1071+ def plot_error (self , bgcolor = "r" , confidence = 0.95 , ax = None , block = None , ** kwargs ):
10671072 r"""
10681073 Plot error with uncertainty bounds
10691074
10701075 :param bgcolor: background color, defaults to 'r'
10711076 :type bgcolor: str, optional
10721077 :param confidence: confidence interval, defaults to 0.95
10731078 :type confidence: float, optional
1079+ :param block: hold plot until figure is closed, defaults to None
1080+ :type block: bool, optional
10741081
10751082 Plot the error between actual and estimated vehicle
10761083 path :math:`(x, y, \theta)`` versus time as three stacked plots.
@@ -1128,6 +1135,9 @@ def plot_error(self, bgcolor="r", confidence=0.95, ax=None, **kwargs):
11281135 ax .set_ylabel (labels [k ] + " error" )
11291136 ax .set_xlim (0 , t [- 1 ])
11301137
1138+ if block is not None :
1139+ plt .show (block = block )
1140+
11311141 # subplot(opt.nplots*100+12)
11321142 # if opt.confidence
11331143 # edge = [pxy(:,2); -pxy(end:-1:1,2)];
@@ -1176,7 +1186,7 @@ def get_map(self):
11761186 xy .append (xf )
11771187 return np .array (xy )
11781188
1179- def plot_map (self , marker = None , ellipse = None , confidence = 0.95 ):
1189+ def plot_map (self , marker = None , ellipse = None , confidence = 0.95 , block = None ):
11801190 """
11811191 Plot estimated landmarks
11821192
@@ -1186,6 +1196,8 @@ def plot_map(self, marker=None, ellipse=None, confidence=0.95):
11861196 :type ellipse: dict, optional
11871197 :param confidence: ellipse confidence interval, defaults to 0.95
11881198 :type confidence: float, optional
1199+ :param block: hold plot until figure is closed, defaults to None
1200+ :type block: bool, optional
11891201
11901202 Plot a marker and covariance ellipses for each estimated landmark.
11911203
@@ -1232,6 +1244,8 @@ def plot_map(self, marker=None, ellipse=None, confidence=0.95):
12321244 ** ellipse ,
12331245 )
12341246 # plot_ellipse( P * chi2inv_rtb(opt.confidence, 2), xf, args{:});
1247+ if block is not None :
1248+ plt .show (block = block )
12351249
12361250 def get_P (self , k = None ):
12371251 """
0 commit comments