def on_scroll(self, event):
        if event.inaxes == self.fig.axes:
            base_scale = 0.5
            xdata, ydata = event.xdata, event.ydata

            # get the current x and y limits
            cur_xlim = self.fig.axes.get_xlim()
            cur_ylim = self.fig.axes.get_ylim()

            # Get distance from the cursor to the edge of the figure frame
            x_left = xdata - cur_xlim[0]
            x_right = cur_xlim[1] - xdata
            y_top = ydata - cur_ylim[0]
            y_bottom = cur_ylim[1] - ydata

            if event.button == 'up':
                # deal with zoom in
                scale_factor = 1 / base_scale
            elif event.button == 'down':
                # deal with zoom out
                scale_factor = base_scale
            else:
                # deal with something that should never happen
                scale_factor = 1.0
                print event.button

            if 0.005 < self.zoom_factor * scale_factor <= 1.5:
                self.zoom_factor *= scale_factor

                self.fig.axes.set_xlim([xdata - x_left * scale_factor, xdata + x_right * scale_factor])
                self.fig.axes.set_ylim([ydata - y_top * scale_factor, ydata + y_bottom * scale_factor])
                self.fig.figure.canvas.draw()

        return
Copy firstname and lastname of users from Profile to User model.
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/scripts/sct_viewer.py/SinglePlot.on_scroll--crossover with--dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/txcommon/migrations/0003_copy_firstname_and_lastname_from_profile.py/Migration.forwards