From ad64412a6ba0f1929e16bb45321c5a00e773d891 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Wed, 6 Apr 2022 09:45:46 +0200 Subject: [PATCH] Use bool for bool keyword arguments --- doc/users/next_whats_new/custom_cap_widths.rst | 2 +- examples/statistics/boxplot_demo.py | 6 +++--- examples/user_interfaces/embedding_in_tk_sgskip.py | 2 +- tutorials/introductory/pyplot.py | 2 +- tutorials/introductory/quick_start.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/users/next_whats_new/custom_cap_widths.rst b/doc/users/next_whats_new/custom_cap_widths.rst index 55fc745ed621..137b9b6839f8 100644 --- a/doc/users/next_whats_new/custom_cap_widths.rst +++ b/doc/users/next_whats_new/custom_cap_widths.rst @@ -12,5 +12,5 @@ widths of the caps in box and whisker plots. x = np.linspace(-7, 7, 140) x = np.hstack([-25, x, 25]) fig, ax = plt.subplots() - ax.boxplot([x, x], notch=1, capwidths=[0.01, 0.2]) + ax.boxplot([x, x], notch=True, capwidths=[0.01, 0.2]) plt.show() diff --git a/examples/statistics/boxplot_demo.py b/examples/statistics/boxplot_demo.py index 25f85a43f3b1..0ad146aa1d2d 100644 --- a/examples/statistics/boxplot_demo.py +++ b/examples/statistics/boxplot_demo.py @@ -105,7 +105,7 @@ fig.canvas.manager.set_window_title('A Boxplot Example') fig.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25) -bp = ax1.boxplot(data, notch=0, sym='+', vert=1, whis=1.5) +bp = ax1.boxplot(data, notch=False, sym='+', vert=True, whis=1.5) plt.setp(bp['boxes'], color='black') plt.setp(bp['whiskers'], color='black') plt.setp(bp['fliers'], color='red', marker='+') @@ -221,7 +221,7 @@ def fake_bootstrapper(n): fig, ax = plt.subplots() pos = np.arange(len(treatments)) + 1 bp = ax.boxplot(treatments, sym='k+', positions=pos, - notch=1, bootstrap=5000, + notch=True, bootstrap=5000, usermedians=medians, conf_intervals=conf_intervals) @@ -239,7 +239,7 @@ def fake_bootstrapper(n): x = np.hstack([-25, x, 25]) fig, ax = plt.subplots() -ax.boxplot([x, x], notch=1, capwidths=[0.01, 0.2]) +ax.boxplot([x, x], notch=True, capwidths=[0.01, 0.2]) plt.show() diff --git a/examples/user_interfaces/embedding_in_tk_sgskip.py b/examples/user_interfaces/embedding_in_tk_sgskip.py index 176af735c3ae..5c9417b67a8c 100644 --- a/examples/user_interfaces/embedding_in_tk_sgskip.py +++ b/examples/user_interfaces/embedding_in_tk_sgskip.py @@ -62,6 +62,6 @@ def update_frequency(new_val): button_quit.pack(side=tkinter.BOTTOM) slider_update.pack(side=tkinter.BOTTOM) toolbar.pack(side=tkinter.BOTTOM, fill=tkinter.X) -canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1) +canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) tkinter.mainloop() diff --git a/tutorials/introductory/pyplot.py b/tutorials/introductory/pyplot.py index 6e858667c746..9f8990219813 100644 --- a/tutorials/introductory/pyplot.py +++ b/tutorials/introductory/pyplot.py @@ -327,7 +327,7 @@ def f(t): x = mu + sigma * np.random.randn(10000) # the histogram of the data -n, bins, patches = plt.hist(x, 50, density=1, facecolor='g', alpha=0.75) +n, bins, patches = plt.hist(x, 50, density=True, facecolor='g', alpha=0.75) plt.xlabel('Smarts') diff --git a/tutorials/introductory/quick_start.py b/tutorials/introductory/quick_start.py index 3481d9dbbcc9..ca0807466aeb 100644 --- a/tutorials/introductory/quick_start.py +++ b/tutorials/introductory/quick_start.py @@ -288,7 +288,7 @@ def my_plotter(ax, data1, data2, param_dict): x = mu + sigma * np.random.randn(10000) fig, ax = plt.subplots(figsize=(5, 2.7), layout='constrained') # the histogram of the data -n, bins, patches = ax.hist(x, 50, density=1, facecolor='C0', alpha=0.75) +n, bins, patches = ax.hist(x, 50, density=True, facecolor='C0', alpha=0.75) ax.set_xlabel('Length [cm]') ax.set_ylabel('Probability')