8000 BUG: xticks unnecessarily rotated by MarcoGorelli · Pull Request #34334 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: xticks unnecessarily rotated #34334

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 32 commits into from
Sep 13, 2020
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4282445
adjust brackets in condition to rotate xticklabels
MarcoGorelli May 23, 2020
06e283f
check rotation in use_index cases too
MarcoGorelli May 23, 2020
2249626
revert empty line
MarcoGorelli May 23, 2020
aa8bd31
revert forced error
MarcoGorelli May 23, 2020
09f93bd
Merge remote-tracking branch 'upstream/master' into subplots-non-date
MarcoGorelli May 23, 2020
9c26c59
Merge remote-tracking branch 'upstream/master' into subplots-non-date
MarcoGorelli May 25, 2020
cdb6ce2
Update v1.1.0.rst
MarcoGorelli May 25, 2020
ea92292
add comment
MarcoGorelli Jun 14, 2020
d87f25f
Merge remote-tracking branch 'origin/subplots-non-date' into subplots…
MarcoGorelli Jun 14, 2020
3fc9930
add tests which cover all the conditions
MarcoGorelli Jun 14, 2020
85638c0
wip
MarcoGorelli Jun 14, 2020
76c3b8d
Merge remote-tracking branch 'upstream/master' into subplots-non-date
MarcoGorelli Jun 17, 2020
7e01df8
remove xfails
MarcoGorelli Jun 17, 2020
2ea78de
check rot in existing test
MarcoGorelli Jun 17, 2020
2358716
:art:
MarcoGorelli Jun 17, 2020
eacbe0a
add regular time series test
MarcoGorelli Jun 17, 2020
836dd0d
reword whatsnew
MarcoGorelli Jun 18, 2020
ea525ec
:art:
MarcoGorelli Jun 18, 2020
85c4dc8
move _size_of_fmt to module level func
MarcoGorelli Jun 18, 2020
645905d
regroup tests
MarcoGorelli Jun 18, 2020
c0c0e99
revert accidental change
MarcoGorelli Jun 18, 2020
fbff1bd
Merge branch 'master' into subplots-non-date
MarcoGorelli Jun 27, 2020
c897d57
Merge remote-tracking branch 'upstream/master' into subplots-non-date
MarcoGorelli Jul 17, 2020
bb5b080
typo
MarcoGorelli Jul 17, 2020
9bc93da
Merge remote-tracking branch 'upstream/master' into subplots-non-date
MarcoGorelli Aug 11, 2020
69a4c36
doc
MarcoGorelli Aug 11, 2020
b093d68
remove unrealtde
MarcoGorelli Aug 11, 2020
5746bd6
remove unrealtde
MarcoGorelli Aug 11, 2020
29de029
make whatsnew more readable
MarcoGorelli Aug 18, 2020
cc9aebf
Merge remote-tracking branch 'upstream/master' into subplots-non-date
MarcoGorelli Sep 4, 2020
ee4d9bd
Merge remote-tracking branch 'upstream/master' into subplots-non-date
MarcoGorelli Sep 13, 2020
7ef0382
:pencil2:
MarcoGorelli Sep 13, 2020
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
Merge branch 'master' into subplots-non-date
  • Loading branch information
MarcoGorelli authored Jun 27, 2020
commit fbff1bd08d6876ff0d6b7bcacd89c838535692fa
60 changes: 55 additions & 5 deletions pandas/tests/plotting/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3368,11 +3368,61 @@ def test_colors_of_columns_with_same_name(self):
for legend, line in zip(result.get_legend().legendHandles, result.lines):
assert legend.get_color() == line.get_color()

def test_subplots_non_date_axis(self):
# https://github.com/pandas-dev/pandas/issues/29460
df = pd.DataFrame({"b": [0, 1, 0], "a": [1, 2, 3]})
ax = _check_plot_works(df.plot, subplots=True)
self._check_ticks_props(ax, xrot=0)
@pytest.mark.parametrize(
"index_name, old_label, new_label",
[
(None, "", "new"),
("old", "old", "new"),
(None, "", ""),
(None, "", 1),
(None, "", [1, 2]),
],
)
@pytest.mark.parametrize("kind", ["line", "area", "bar"])
def test_xlabel_ylabel_dataframe_single_plot(
self, kind, index_name, old_label, new_label
):
# GH 9093
df = pd.DataFrame([[1, 2], [2, 5]], columns=["Type A", "Type B"])
df.index.name = index_name

# default is the ylabel is not shown and xlabel is index name
ax = df.plot(kind=kind)
assert ax.get_xlabel() == old_label
assert ax.get_ylabel() == ""

# old xlabel will be overriden and assigned ylabel will be used as ylabel
ax = df.plot(kind=kind, ylabel=new_label, xlabel=new_label)
assert ax.get_ylabel() == str(new_label)
assert ax.get_xlabel() == str(new_label)

@pytest.mark.parametrize(
"index_name, old_label, new_label",
[
(None, "", "new"),
("old", "old", "new"),
(None, "", ""),
(None, "", 1),
(None, "", [1, 2]),
],
)
@pytest.mark.parametrize("kind", ["line", "area", "bar"])
def test_xlabel_ylabel_dataframe_subplots(
self, kind, index_name, old_label, new_label
):
# GH 9093
df = pd.DataFrame([[1, 2], [2, 5]], columns=["Type A", "Type B"])
df.index.name = index_name

# default is the ylabel is not shown and xlabel is index name
axes = df.plot(kind=kind, subplots=True)
assert all(ax.get_ylabel() == "" for ax in axes)
assert all(ax.get_xlabel() == old_label for ax in axes)

# old xlabel will be overriden and assigned ylabel will be used as ylabel
axes = df.plot(kind=kind, ylabel=new_label, xlabel=new_label, subplots=True)
assert all(ax.get_ylabel() == str(new_label) for ax in axes)
assert all(ax.get_xlabel() == str(new_label) for ax in axes)


def _generate_4_axes_via_gridspec():
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0