def test_mixed_freq_regular_first_df(self):
     # GH 9852
     s1 = tm.makeTimeSeries().to_frame()
     s2 = s1.iloc[[0, 5, 10, 11, 12, 13, 14, 15], :]
     _, ax = self.plt.subplots()
     s1.plot(ax=ax)
     ax2 = s2.plot(style='g', ax=ax)
     lines = ax2.get_lines()
     idx1 = PeriodIndex(lines[0].get_xdata())
     idx2 = PeriodIndex(lines[1].get_xdata())
     assert idx1.equals(s1.index.to_period('B'))
     assert idx2.equals(s2.index.to_period('B'))
     left, right = ax2.get_xlim()
     pidx = s1.index.to_period()
     assert left == pidx[0].ordinal
     assert right == pidx[-1].ordinal
Beispiel #2
0
 def test_mixed_freq_regular_first_df(self):
     # GH 9852
     import matplotlib.pyplot as plt  # noqa
     s1 = tm.makeTimeSeries().to_frame()
     s2 = s1.iloc[[0, 5, 10, 11, 12, 13, 14, 15], :]
     ax = s1.plot()
     ax2 = s2.plot(style='g', ax=ax)
     lines = ax2.get_lines()
     idx1 = PeriodIndex(lines[0].get_xdata())
     idx2 = PeriodIndex(lines[1].get_xdata())
     self.assertTrue(idx1.equals(s1.index.to_period('B')))
     self.assertTrue(idx2.equals(s2.index.to_period('B')))
     left, right = ax2.get_xlim()
     pidx = s1.index.to_period()
     self.assertEqual(left, pidx[0].ordinal)
     self.assertEqual(right, pidx[-1].ordinal)
Beispiel #3
0
 def test_mixed_freq_regular_first_df(self):
     # GH 9852
     import matplotlib.pyplot as plt  # noqa
     s1 = tm.makeTimeSeries().to_frame()
     s2 = s1.iloc[[0, 5, 10, 11, 12, 13, 14, 15], :]
     ax = s1.plot()
     ax2 = s2.plot(style='g', ax=ax)
     lines = ax2.get_lines()
     idx1 = PeriodIndex(lines[0].get_xdata())
     idx2 = PeriodIndex(lines[1].get_xdata())
     self.assertTrue(idx1.equals(s1.index.to_period('B')))
     self.assertTrue(idx2.equals(s2.index.to_period('B')))
     left, right = ax2.get_xlim()
     pidx = s1.index.to_period()
     self.assertEqual(left, pidx[0].ordinal)
     self.assertEqual(right, pidx[-1].ordinal)
    def test_mixed_freq_regular_first(self):
        # TODO
        s1 = tm.makeTimeSeries()
        s2 = s1[[0, 5, 10, 11, 12, 13, 14, 15]]

        # it works!
        s1.plot()

        ax2 = s2.plot(style='g')
        lines = ax2.get_lines()
        idx1 = PeriodIndex(lines[0].get_xdata())
        idx2 = PeriodIndex(lines[1].get_xdata())
        assert idx1.equals(s1.index.to_period('B'))
        assert idx2.equals(s2.index.to_period('B'))
        left, right = ax2.get_xlim()
        pidx = s1.index.to_period()
        assert left == pidx[0].ordinal
        assert right == pidx[-1].ordinal
    def test_mixed_freq_regular_first(self):
        import matplotlib.pyplot as plt  # noqa
        s1 = tm.makeTimeSeries()
        s2 = s1[[0, 5, 10, 11, 12, 13, 14, 15]]

        # it works!
        s1.plot()

        ax2 = s2.plot(style='g')
        lines = ax2.get_lines()
        idx1 = PeriodIndex(lines[0].get_xdata())
        idx2 = PeriodIndex(lines[1].get_xdata())
        assert idx1.equals(s1.index.to_period('B'))
        assert idx2.equals(s2.index.to_period('B'))
        left, right = ax2.get_xlim()
        pidx = s1.index.to_period()
        assert left == pidx[0].ordinal
        assert right == pidx[-1].ordinal