def on_motion(self, event):
    '\n        Motion event to rotate the scene\n        '
    if (self.mouse is None):
        return
    if (event.inaxes != self.axes):
        return
    (button, x, y) = (event.button, event.xdata, event.ydata)
    (dx, dy) = ((x - self.mouse[1]), (y - self.mouse[2]))
    self.mouse = (button, x, y)
    self.trackball.drag_to(x, y, dx, dy)
    self.transform = ((self.proj @ self.view) @ self.trackball.model.T)
    self.update(self.transform)
    self.figure.canvas.draw()
Motion event to rotate the scene
def on_motion(self, event):
    '\n        \n        '
    if (self.mouse is None):
        return
    if (event.inaxes != self.axes):
        return
    (button, x, y) = (event.button, event.xdata, event.ydata)
    (dx, dy) = ((x - self.mouse[1]), (y - self.mouse[2]))
    self.mouse = (button, x, y)
    self.trackball.drag_to(x, y, dx, dy)
    self.transform = ((self.proj @ self.view) @ self.trackball.model.T)
    self.update(self.transform)
    self.figure.canvas.draw()