Skip to content

TST: fix some mpl warnings #38574

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 6 commits into from
Dec 22, 2020
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
11 changes: 8 additions & 3 deletions pandas/plotting/_matplotlib/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def normalize(series):
df = frame.drop(class_column, axis=1).apply(normalize)

if ax is None:
ax = plt.gca(xlim=[-1, 1], ylim=[-1, 1])
ax = plt.gca()
ax.set_xlim([-1, 1])
ax.set_ylim([-1, 1])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can even use ax.set_xlim(-1, 1), without extra brackets.
The same for other cases as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


to_plot: Dict[Label, List[List]] = {}
colors = get_standard_colors(
Expand Down Expand Up @@ -260,7 +262,8 @@ def f(t):
)
colors = dict(zip(classes, color_values))
if ax is None:
ax = plt.gca(xlim=(-np.pi, np.pi))
ax = plt.gca()
ax.set_xlim((-np.pi, np.pi))
for i in range(n):
row = df.iloc[i].values
f = function(row)
Expand Down Expand Up @@ -440,7 +443,9 @@ def autocorrelation_plot(
n = len(series)
data = np.asarray(series)
if ax is None:
ax = plt.gca(xlim=(1, n), ylim=(-1.0, 1.0))
ax = plt.gca()
ax.set_xlim((1, n))
ax.set_ylim((-1.0, 1.0))
mean = np.mean(data)
c0 = np.sum((data - mean) ** 2) / float(n)

Expand Down