Ejemplo n.º 1
0
    def test_plot_axy_lines_are_set_to_width_of_below_default(self):
        plotter = LinePlots(self.image_axes, self.mock_colorbar)
        x, y = np.arange(10.), np.arange(10.) * 2

        plotter.plot_y_line(x, y)
        self.axy.plot.assert_called_once_with(y, x, scaley=False)
        self.assert_that_a_call_has_been_made_to_this_object_containing_linewidth_and_half(
            self.axy.plot)
Ejemplo n.º 2
0
    def test_delete_plot_lines_with_plots_present(self):
        plotter = LinePlots(self.image_axes, self.mock_colorbar)
        xfig, yfig = MagicMock(), MagicMock()
        self.axx.plot.side_effect = [[xfig]]
        self.axy.plot.side_effect = [[yfig]]
        x, y = np.arange(10.), np.arange(10.)
        plotter.plot_x_line(x, y)
        plotter.plot_y_line(x, y)

        plotter.delete_line_plot_lines()

        xfig.remove.assert_called_once()
        yfig.remove.assert_called_once()
Ejemplo n.º 3
0
    def test_plot_with_line_present_sets_data(self):
        plotter = LinePlots(self.image_axes, self.mock_colorbar)
        x, y = np.arange(10.), np.arange(10.) * 2
        plotter.plot_x_line(x, y)
        plotter.plot_y_line(x, y)
        self.axx.reset_mock()
        self.axy.reset_mock()

        plotter.plot_x_line(x, y)
        plotter.plot_y_line(x, y)

        plotter._xfig.set_data.assert_called_once_with(x, y)
        plotter._yfig.set_data.assert_called_once_with(y, x)
        self.axx.plot.assert_not_called()
        self.axy.plot.assert_not_called()
Ejemplo n.º 4
0
    def test_plot_with_no_line_present_creates_line_artist(self):
        plotter = LinePlots(self.image_axes, self.mock_colorbar)
        self.axx.set_xlabel.reset_mock()
        x, y = np.arange(10.), np.arange(10.) * 2

        plotter.plot_x_line(x, y)
        self.axx.plot.assert_called_once_with(x, y, scalex=False)
        self.axx.set_xlabel.assert_called_once_with(
            self.image_axes.get_xlabel())

        self.axy.set_ylabel.reset_mock()
        self.axy.set_xlim.reset_mock()
        plotter.plot_y_line(x, y)
        self.axy.plot.assert_called_once_with(y, x, scaley=False)
        self.axy.set_ylabel.assert_called_once_with(
            self.image_axes.get_ylabel())