-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
TST: Fix some plotting xfails #55440
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
Changes from all commits
1de5ce2
ce5535c
7cbbe19
a597859
761c6a7
4b0d321
cea2ef4
9de4e12
e525fd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,7 +293,6 @@ def test_plot_multiple_inferred_freq(self): | |
ser = Series(np.random.default_rng(2).standard_normal(len(dr)), index=dr) | ||
_check_plot_works(ser.plot) | ||
|
||
@pytest.mark.xfail(reason="Api changed in 3.6.0") | ||
def test_uhf(self): | ||
import pandas.plotting._matplotlib.converter as conv | ||
|
||
|
@@ -309,7 +308,7 @@ def test_uhf(self): | |
tlocs = axis.get_ticklocs() | ||
tlabels = axis.get_ticklabels() | ||
for loc, label in zip(tlocs, tlabels): | ||
xp = conv._from_ordinal(loc).strftime("%H:%M:%S.%f") | ||
xp = conv._from_ordinal(loc).strftime("%H:%M:%S") | ||
rs = str(label.get_text()) | ||
if len(rs): | ||
assert xp == rs | ||
|
@@ -1428,7 +1427,6 @@ def test_secondary_legend_nonts_multi_col(self): | |
# TODO: color cycle problems | ||
assert len(colors) == 4 | ||
|
||
@pytest.mark.xfail(reason="Api changed in 3.6.0") | ||
def test_format_date_axis(self): | ||
rng = date_range("1/1/2012", periods=12, freq="ME") | ||
df = DataFrame(np.random.default_rng(2).standard_normal((len(rng), 3)), rng) | ||
|
@@ -1437,7 +1435,7 @@ def test_format_date_axis(self): | |
xaxis = ax.get_xaxis() | ||
for line in xaxis.get_ticklabels(): | ||
if len(line.get_text()) > 0: | ||
assert line.get_rotation() == 30 | ||
assert line.get_rotation() == 0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label is not rotated visually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, should it be? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the previous - on 3.5 |
||
|
||
def test_ax_plot(self): | ||
x = date_range(start="2012-01-02", periods=10, freq="D") | ||
|
@@ -1652,19 +1650,16 @@ def test_overlapping_datetime(self): | |
s2.plot(ax=ax) | ||
s1.plot(ax=ax) | ||
|
||
@pytest.mark.xfail(reason="GH9053 matplotlib does not use ax.xaxis.converter") | ||
def test_add_matplotlib_datetime64(self): | ||
# GH9053 - ensure that a plot with PeriodConverter still understands | ||
# datetime64 data. This still fails because matplotlib overrides the | ||
# ax.xaxis.converter with a DatetimeConverter | ||
# datetime64 data. | ||
s = Series( | ||
np.random.default_rng(2).standard_normal(10), | ||
index=date_range("1970-01-02", periods=10), | ||
) | ||
ax = s.plot() | ||
with tm.assert_produces_warning(DeprecationWarning): | ||
# multi-dimensional indexing | ||
ax.plot(s.index, s.values, color="g") | ||
# multi-dimensional indexing | ||
ax.plot(s.index, s.values, color="g") | ||
l1, l2 = ax.lines | ||
tm.assert_numpy_array_equal(l1.get_xydata(), l2.get_xydata()) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed the decimal here is not shown in the label when plotting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question. On matplotlib 3.5, the code
rs = str(label.get_text())
returns the empty string and the subsequent assert is not ran. On 3.6, we get"21:59:51"
forrs
. In both cases,21:59:51
is displayed on the resulting plot. So I believe the test was incorrect on our end.