@@ -1000,13 +1000,13 @@ def get_xyt(self):
1000
1000
xyt = None
1001
1001
return xyt
1002
1002
1003
- def plot_xy (self , * args , block = False , ** kwargs ):
1003
+ def plot_xy (self , * args , block = None , ** kwargs ):
1004
1004
"""
1005
1005
Plot estimated vehicle position
1006
1006
1007
1007
:param args: position arguments passed to :meth:`~matplotlib.axes.Axes.plot`
1008
1008
: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
1010
1010
:type block: bool, optional
1011
1011
1012
1012
Plot the estimated vehicle path in the xy-plane.
@@ -1018,16 +1018,19 @@ def plot_xy(self, *args, block=False, **kwargs):
1018
1018
kwargs ["color" ] = "r"
1019
1019
xyt = self .get_xyt ()
1020
1020
plt .plot (xyt [:, 0 ], xyt [:, 1 ], * args , ** kwargs )
1021
- # plt.show(block=block)
1021
+ if block is not None :
1022
+ plt .show (block = block )
1022
1023
1023
- def plot_ellipse (self , confidence = 0.95 , N = 10 , ** kwargs ):
1024
+ def plot_ellipse (self , confidence = 0.95 , N = 10 , block = None , ** kwargs ):
1024
1025
"""
1025
1026
Plot uncertainty ellipses
1026
1027
1027
1028
:param confidence: ellipse confidence interval, defaults to 0.95
1028
1029
:type confidence: float, optional
1029
1030
:param N: number of ellipses to plot, defaults to 10
1030
1031
:type N: int, optional
1032
+ :param block: hold plot until figure is closed, defaults to None
1033
+ :type block: bool, optional
1031
1034
:param kwargs: arguments passed to :meth:`spatialmath.base.graphics.plot_ellipse`
1032
1035
1033
1036
Plot ``N`` uncertainty ellipses spaced evenly along the trajectory.
@@ -1062,15 +1065,19 @@ def plot_ellipse(self, confidence=0.95, N=10, **kwargs):
1062
1065
inverted = True ,
1063
1066
** kwargs ,
1064
1067
)
1068
+ if block is not None :
1069
+ plt .show (block = block )
1065
1070
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 ):
1067
1072
r"""
1068
1073
Plot error with uncertainty bounds
1069
1074
1070
1075
:param bgcolor: background color, defaults to 'r'
1071
1076
:type bgcolor: str, optional
1072
1077
:param confidence: confidence interval, defaults to 0.95
1073
1078
:type confidence: float, optional
1079
+ :param block: hold plot until figure is closed, defaults to None
1080
+ :type block: bool, optional
1074
1081
1075
1082
Plot the error between actual and estimated vehicle
1076
1083
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):
1128
1135
ax .set_ylabel (labels [k ] + " error" )
1129
1136
ax .set_xlim (0 , t [- 1 ])
1130
1137
1138
+ if block is not None :
1139
+ plt .show (block = block )
1140
+
1131
1141
# subplot(opt.nplots*100+12)
1132
1142
# if opt.confidence
1133
1143
# edge = [pxy(:,2); -pxy(end:-1:1,2)];
@@ -1176,7 +1186,7 @@ def get_map(self):
1176
1186
xy .append (xf )
1177
1187
return np .array (xy )
1178
1188
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 ):
1180
1190
"""
1181
1191
Plot estimated landmarks
1182
1192
@@ -1186,6 +1196,8 @@ def plot_map(self, marker=None, ellipse=None, confidence=0.95):
1186
1196
:type ellipse: dict, optional
1187
1197
:param confidence: ellipse confidence interval, defaults to 0.95
1188
1198
:type confidence: float, optional
1199
+ :param block: hold plot until figure is closed, defaults to None
1200
+ :type block: bool, optional
1189
1201
1190
1202
Plot a marker and covariance ellipses for each estimated landmark.
1191
1203
@@ -1232,6 +1244,8 @@ def plot_map(self, marker=None, ellipse=None, confidence=0.95):
1232
1244
** ellipse ,
1233
1245
)
1234
1246
# plot_ellipse( P * chi2inv_rtb(opt.confidence, 2), xf, args{:});
1247
+ if block is not None :
1248
+ plt .show (block = block )
1235
1249
1236
1250
def get_P (self , k = None ):
1237
1251
"""
0 commit comments