Skip to content

BUG: Correct the previous bug fixing on xlim for plotting #28059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
restore change for datetimelike
  • Loading branch information
charlesdong1991 committed Aug 21, 2019
commit 1c2d02fc2a687b69b1ee73c1a37074ab45c4a20d
16 changes: 7 additions & 9 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def test_finder_minutely(self):
_, ax = self.plt.subplots()
ser.plot(ax=ax)
xaxis = ax.get_xaxis()
rs = xaxis.get_majorticklocs()[1]
rs = xaxis.get_majorticklocs()[0]
xp = Period("1/1/1999", freq="Min").ordinal

assert rs == xp
Expand All @@ -542,7 +542,7 @@ def test_finder_hourly(self):
_, ax = self.plt.subplots()
ser.plot(ax=ax)
xaxis = ax.get_xaxis()
rs = xaxis.get_majorticklocs()[1]
rs = xaxis.get_majorticklocs()[0]
xp = Period("1/1/1999", freq="H").ordinal

assert rs == xp
Expand Down Expand Up @@ -1418,9 +1418,7 @@ def test_plot_outofbounds_datetime(self):

def test_format_timedelta_ticks_narrow(self):

expected_labels = [
"00:00:00.0000000{:0>2d}".format(i) for i in np.arange(0, 10, 2)
]
expected_labels = ["00:00:00.0000000{:0>2d}".format(i) for i in np.arange(10)]

rng = timedelta_range("0", periods=10, freq="ns")
df = DataFrame(np.random.randn(len(rng), 3), rng)
Expand All @@ -1430,8 +1428,8 @@ def test_format_timedelta_ticks_narrow(self):
labels = ax.get_xticklabels()

result_labels = [x.get_text() for x in labels]
assert (len(result_labels) - 2) == len(expected_labels)
assert result_labels[1:-1] == expected_labels
assert len(result_labels) == len(expected_labels)
assert result_labels == expected_labels

def test_format_timedelta_ticks_wide(self):
expected_labels = [
Expand All @@ -1454,8 +1452,8 @@ def test_format_timedelta_ticks_wide(self):
labels = ax.get_xticklabels()

result_labels = [x.get_text() for x in labels]
assert (len(result_labels) - 2) == len(expected_labels)
assert result_labels[1:-1] == expected_labels
assert len(result_labels) == len(expected_labels)
assert result_labels == expected_labels

def test_timedelta_plot(self):
# test issue #8711
Expand Down