2 from python_qt_binding.QtCore
import Slot, Qt, QTimer, qWarning, Signal
3 from python_qt_binding.QtGui
import QColor
4 from python_qt_binding.QtWidgets
import QWidget, QVBoxLayout, QSizePolicy
5 from python_qt_binding
import QT_BINDING_VERSION
6 from distutils.version
import LooseVersion
7 from matplotlib.figure
import Figure
13 from trajectory_msgs.msg
import JointTrajectory
14 if LooseVersion(QT_BINDING_VERSION) >= LooseVersion(
'5.0.0'):
15 from matplotlib.backends.backend_qt5agg
import FigureCanvasQTAgg
as FigureCanvas
17 from matplotlib.backends.backend_qt4agg
import FigureCanvasQTAgg
as FigureCanvas
22 super(PlotCanvas, self).
__init__(Figure())
23 self.
axes = self.figure.add_subplot(111)
24 self.axes.grid(
True, color=
'gray')
25 self.figure.tight_layout()
26 self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
32 super(PlotWidget, self).
__init__(parent)
36 vbox.addWidget(self.
canvas)
40 self.canvas.axes.clear()
41 self.canvas.axes.grid(
True, color=
'gray')
42 for name
in curve_names:
43 xdata, ydata = data[name]
44 self.canvas.axes.plot(xdata, ydata,
'o-', label=name)[0]
49 handles, labels = self.canvas.axes.get_legend_handles_labels()
50 self.canvas.axes.legend(handles, labels, loc=
'upper left')