Skip to content

Commit a4de7f8

Browse files
committed
Move test_scatter_line_xticks from Series to DataFrame tests
Relocated the `test_scatter_line_xticks` test from `test_series.py` to `test_frame.py` for better alignment with DataFrame-specific functionality. This refactor ensures the test resides in the appropriate context based on its usage and focus.
1 parent 102f5a9 commit a4de7f8

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pandas/tests/plotting/frame/test_frame.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,20 @@ def test_scatter_on_datetime_time_data(self):
847847
df["dtime"] = date_range(start="2014-01-01", freq="h", periods=10).time
848848
df.plot(kind="scatter", x="dtime", y="a")
849849

850+
def test_scatter_line_xticks(self):
851+
# GH#61005
852+
datetime_list = [datetime(year=2025, month=1, day=1, hour=n) for n in range(3)]
853+
df = DataFrame(columns=["datetime", "y"])
854+
for i, n in enumerate(datetime_list):
855+
df.loc[len(df)] = [n, i]
856+
fig, ax = plt.subplots(2, sharex=True)
857+
df.plot.scatter(x="datetime", y="y", ax=ax[0])
858+
scatter_xticks = ax[0].get_xticks()
859+
df.plot(x="datetime", y="y", ax=ax[1])
860+
line_xticks = ax[1].get_xticks()
861+
assert scatter_xticks[0] == line_xticks[0]
862+
assert scatter_xticks[-1] == line_xticks[-1]
863+
850864
@pytest.mark.parametrize("x, y", [("dates", "vals"), (0, 1)])
851865
def test_scatterplot_datetime_data(self, x, y):
852866
# GH 30391

pandas/tests/plotting/test_series.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -971,17 +971,3 @@ def test_secondary_y_subplot_axis_labels(self):
971971
s1.plot(ax=ax2)
972972
assert len(ax.xaxis.get_minor_ticks()) == 0
973973
assert len(ax.get_xticklabels()) > 0
974-
975-
def test_scatter_line_xticks(self):
976-
# GH#61005
977-
datetime_list = [datetime(year=2025, month=1, day=1, hour=n) for n in range(3)]
978-
df = DataFrame(columns=["datetime", "y"])
979-
for i, n in enumerate(datetime_list):
980-
df.loc[len(df)] = [n, i]
981-
fig, ax = plt.subplots(2, sharex=True)
982-
df.plot.scatter(x="datetime", y="y", ax=ax[0])
983-
scatter_xticks = ax[0].get_xticks()
984-
df.plot(x="datetime", y="y", ax=ax[1])
985-
line_xticks = ax[1].get_xticks()
986-
assert scatter_xticks[0] == line_xticks[0]
987-
assert scatter_xticks[-1] == line_xticks[-1]

0 commit comments

Comments
 (0)