예제 #1
0
    def test_scatter_plot_legacy(self):
        tm._skip_if_no_scipy()

        df = DataFrame(randn(100, 2))

        def scat(**kwds):
            return plotting.scatter_matrix(df, **kwds)

        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat)
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, marker='+')
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, vmin=0)
        if _ok_for_gaussian_kde('kde'):
            with tm.assert_produces_warning(UserWarning):
                _check_plot_works(scat, diagonal='kde')
        if _ok_for_gaussian_kde('density'):
            with tm.assert_produces_warning(UserWarning):
                _check_plot_works(scat, diagonal='density')
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, diagonal='hist')
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, range_padding=.1)

        def scat2(x, y, by=None, ax=None, figsize=None):
            return plotting.scatter_plot(df, x, y, by, ax, figsize=None)

        _check_plot_works(scat2, x=0, y=1)
        grouper = Series(np.repeat([1, 2, 3, 4, 5], 20), df.index)
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat2, x=0, y=1, by=grouper)
예제 #2
0
파일: test_misc.py 프로젝트: cgrin/pandas
    def test_scatter_plot_legacy(self):
        tm._skip_if_no_scipy()

        df = DataFrame(randn(100, 2))

        def scat(**kwds):
            return plotting.scatter_matrix(df, **kwds)

        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat)
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, marker='+')
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, vmin=0)
        if _ok_for_gaussian_kde('kde'):
            with tm.assert_produces_warning(UserWarning):
                _check_plot_works(scat, diagonal='kde')
        if _ok_for_gaussian_kde('density'):
            with tm.assert_produces_warning(UserWarning):
                _check_plot_works(scat, diagonal='density')
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, diagonal='hist')
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat, range_padding=.1)

        def scat2(x, y, by=None, ax=None, figsize=None):
            return plotting.scatter_plot(df, x, y, by, ax, figsize=None)

        _check_plot_works(scat2, x=0, y=1)
        grouper = Series(np.repeat([1, 2, 3, 4, 5], 20), df.index)
        with tm.assert_produces_warning(UserWarning):
            _check_plot_works(scat2, x=0, y=1, by=grouper)
예제 #3
0
파일: test_series.py 프로젝트: BRGM/Pic-EAU
 def test_partially_invalid_plot_data(self):
     s = Series(['a', 'b', 1.0, 2])
     for kind in plotting._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with tm.assertRaises(TypeError):
             s.plot(kind=kind)
예제 #4
0
파일: test_series.py 프로젝트: BRGM/Pic-EAU
 def test_invalid_plot_data(self):
     s = Series(list('abcd'))
     for kind in plotting._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with tm.assertRaises(TypeError):
             s.plot(kind=kind)
예제 #5
0
파일: test_series.py 프로젝트: BRGM/Pic-EAU
 def test_kind_both_ways(self):
     s = Series(range(3))
     for kind in plotting._common_kinds + plotting._series_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         s.plot(kind=kind)
         getattr(s.plot, kind)()
예제 #6
0
 def test_partially_invalid_plot_data(self):
     s = Series(['a', 'b', 1.0, 2])
     for kind in plotting._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with tm.assertRaises(TypeError):
             s.plot(kind=kind)
예제 #7
0
 def test_invalid_plot_data(self):
     s = Series(list('abcd'))
     for kind in plotting._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with tm.assertRaises(TypeError):
             s.plot(kind=kind)
예제 #8
0
 def test_kind_both_ways(self):
     s = Series(range(3))
     for kind in plotting._common_kinds + plotting._series_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         s.plot(kind=kind)
         getattr(s.plot, kind)()
예제 #9
0
 def test_partially_invalid_plot_data(self):
     s = Series(['a', 'b', 1.0, 2])
     _, ax = self.plt.subplots()
     for kind in plotting._core._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with pytest.raises(TypeError):
             s.plot(kind=kind, ax=ax)
예제 #10
0
 def test_invalid_plot_data(self):
     s = Series(list('abcd'))
     _, ax = self.plt.subplots()
     for kind in plotting._core._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with pytest.raises(TypeError):
             s.plot(kind=kind, ax=ax)
예제 #11
0
 def test_invalid_plot_data(self):
     s = Series(list('abcd'))
     _, ax = self.plt.subplots()
     for kind in plotting._core._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with pytest.raises(TypeError):
             s.plot(kind=kind, ax=ax)
예제 #12
0
 def test_partially_invalid_plot_data(self):
     s = Series(['a', 'b', 1.0, 2])
     _, ax = self.plt.subplots()
     for kind in plotting._core._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         with pytest.raises(TypeError):
             s.plot(kind=kind, ax=ax)
예제 #13
0
 def test_kind_both_ways(self):
     s = Series(range(3))
     kinds = (plotting._core._common_kinds + plotting._core._series_kinds)
     _, ax = self.plt.subplots()
     for kind in kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         s.plot(kind=kind, ax=ax)
         getattr(s.plot, kind)()
예제 #14
0
 def test_kind_both_ways(self):
     s = Series(range(3))
     kinds = (plotting._core._common_kinds +
              plotting._core._series_kinds)
     _, ax = self.plt.subplots()
     for kind in kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         s.plot(kind=kind, ax=ax)
         getattr(s.plot, kind)()
예제 #15
0
    def test_plot(self):
        _check_plot_works(self.ts.plot, label='foo')
        _check_plot_works(self.ts.plot, use_index=False)
        axes = _check_plot_works(self.ts.plot, rot=0)
        self._check_ticks_props(axes, xrot=0)

        ax = _check_plot_works(self.ts.plot, style='.', logy=True)
        self._check_ax_scales(ax, yaxis='log')

        ax = _check_plot_works(self.ts.plot, style='.', logx=True)
        self._check_ax_scales(ax, xaxis='log')

        ax = _check_plot_works(self.ts.plot, style='.', loglog=True)
        self._check_ax_scales(ax, xaxis='log', yaxis='log')

        _check_plot_works(self.ts[:10].plot.bar)
        _check_plot_works(self.ts.plot.area, stacked=False)
        _check_plot_works(self.iseries.plot)

        for kind in ['line', 'bar', 'barh', 'kde', 'hist', 'box']:
            if not _ok_for_gaussian_kde(kind):
                continue
            _check_plot_works(self.series[:5].plot, kind=kind)

        _check_plot_works(self.series[:10].plot.barh)
        ax = _check_plot_works(Series(randn(10)).plot.bar, color='black')
        self._check_colors([ax.patches[0]], facecolors=['black'])

        # GH 6951
        ax = _check_plot_works(self.ts.plot, subplots=True)
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))

        ax = _check_plot_works(self.ts.plot, subplots=True, layout=(-1, 1))
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))
        ax = _check_plot_works(self.ts.plot, subplots=True, layout=(1, -1))
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))
예제 #16
0
    def test_plot(self):
        _check_plot_works(self.ts.plot, label='foo')
        _check_plot_works(self.ts.plot, use_index=False)
        axes = _check_plot_works(self.ts.plot, rot=0)
        self._check_ticks_props(axes, xrot=0)

        ax = _check_plot_works(self.ts.plot, style='.', logy=True)
        self._check_ax_scales(ax, yaxis='log')

        ax = _check_plot_works(self.ts.plot, style='.', logx=True)
        self._check_ax_scales(ax, xaxis='log')

        ax = _check_plot_works(self.ts.plot, style='.', loglog=True)
        self._check_ax_scales(ax, xaxis='log', yaxis='log')

        _check_plot_works(self.ts[:10].plot.bar)
        _check_plot_works(self.ts.plot.area, stacked=False)
        _check_plot_works(self.iseries.plot)

        for kind in ['line', 'bar', 'barh', 'kde', 'hist', 'box']:
            if not _ok_for_gaussian_kde(kind):
                continue
            _check_plot_works(self.series[:5].plot, kind=kind)

        _check_plot_works(self.series[:10].plot.barh)
        ax = _check_plot_works(Series(randn(10)).plot.bar, color='black')
        self._check_colors([ax.patches[0]], facecolors=['black'])

        # GH 6951
        ax = _check_plot_works(self.ts.plot, subplots=True)
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))

        ax = _check_plot_works(self.ts.plot, subplots=True, layout=(-1, 1))
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))
        ax = _check_plot_works(self.ts.plot, subplots=True, layout=(1, -1))
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))
예제 #17
0
    def test_plot(self):
        _check_plot_works(self.ts.plot, label="foo")
        _check_plot_works(self.ts.plot, use_index=False)
        axes = _check_plot_works(self.ts.plot, rot=0)
        self._check_ticks_props(axes, xrot=0)

        ax = _check_plot_works(self.ts.plot, style=".", logy=True)
        self._check_ax_scales(ax, yaxis="log")

        ax = _check_plot_works(self.ts.plot, style=".", logx=True)
        self._check_ax_scales(ax, xaxis="log")

        ax = _check_plot_works(self.ts.plot, style=".", loglog=True)
        self._check_ax_scales(ax, xaxis="log", yaxis="log")

        _check_plot_works(self.ts[:10].plot.bar)
        _check_plot_works(self.ts.plot.area, stacked=False)
        _check_plot_works(self.iseries.plot)

        for kind in ["line", "bar", "barh", "kde", "hist", "box"]:
            if not _ok_for_gaussian_kde(kind):
                continue
            _check_plot_works(self.series[:5].plot, kind=kind)

        _check_plot_works(self.series[:10].plot.barh)
        ax = _check_plot_works(Series(randn(10)).plot.bar, color="black")
        self._check_colors([ax.patches[0]], facecolors=["black"])

        # GH 6951
        ax = _check_plot_works(self.ts.plot, subplots=True)
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))

        ax = _check_plot_works(self.ts.plot, subplots=True, layout=(-1, 1))
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))
        ax = _check_plot_works(self.ts.plot, subplots=True, layout=(1, -1))
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1))
예제 #18
0
 def test_valid_object_plot(self):
     s = Series(lrange(10), dtype=object)
     for kind in plotting._core._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         _check_plot_works(s.plot, kind=kind)
예제 #19
0
 def test_valid_object_plot(self):
     s = Series(lrange(10), dtype=object)
     for kind in plotting._core._common_kinds:
         if not _ok_for_gaussian_kde(kind):
             continue
         _check_plot_works(s.plot, kind=kind)