Skip to content

Commit 5dfb1cf

Browse files
committed
added plot labels
1 parent bcf064f commit 5dfb1cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

roboticstoolbox/tools/trajectory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,22 @@ def plot(self, block=False, plotargs=None, textargs=None):
172172
# accel phase
173173
tf = self.t[-1]
174174
k = self.t <= self.tblend
175-
ax.plot(self.t[k], self.s[k], color="red", **plotopts)
175+
ax.plot(self.t[k], self.s[k], color="red", label="acceleration", **plotopts)
176176

177177
# coast phase
178178
k = (self.t > self.tblend) & (self.t <= (tf - self.tblend))
179179
ax.plot(self.t[k], self.s[k], color="green", **plotopts)
180180
k = np.where(k)[0][0]
181181
ax.plot(
182-
self.t[k - 1 : k + 1], self.s[k - 1 : k + 1], color="green", **plotopts
182+
self.t[k - 1 : k + 1], self.s[k - 1 : k + 1], color="green", label="linear", **plotopts
183183
)
184184

185185
# decel phase
186186
k = self.t > (tf - self.tblend)
187187
ax.plot(self.t[k], self.s[k], color="blue", **plotopts)
188188
k = np.where(k)[0][0]
189189
ax.plot(
190-
self.t[k - 1 : k + 1], self.s[k - 1 : k + 1], color="blue", **plotopts
190+
self.t[k - 1 : k + 1], self.s[k - 1 : k + 1], color="blue", label="deceleration", **plotopts
191191
)
192192

193193
ax.grid(True)

0 commit comments

Comments
 (0)