diff --git a/plot_types/arrays/imshow.py b/plot_types/arrays/imshow.py index f9c4830d54cb..7f478b883396 100644 --- a/plot_types/arrays/imshow.py +++ b/plot_types/arrays/imshow.py @@ -21,6 +21,6 @@ ax.imshow(Z, extent=[0, 8, 0, 8], interpolation="nearest", cmap=plt.get_cmap('Blues'), vmin=0, vmax=1.6) -ax.set_xticks([]) -ax.set_yticks([]) +ax.set(xticks=[], yticks=[]) + plt.show() diff --git a/plot_types/arrays/quiver.py b/plot_types/arrays/quiver.py index 29572971a371..d857fe07607c 100644 --- a/plot_types/arrays/quiver.py +++ b/plot_types/arrays/quiver.py @@ -19,9 +19,7 @@ plt.quiver(X, Y, U, V, color="C0", angles='xy', scale_units='xy', scale=0.5, width=.05) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/basic/bar.py b/plot_types/basic/bar.py index 560c4d5e25b3..c796a1ff20cb 100644 --- a/plot_types/basic/bar.py +++ b/plot_types/basic/bar.py @@ -17,8 +17,7 @@ ax.bar(X, Y, width=1, edgecolor="white", linewidth=0.7) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) + plt.show() diff --git a/plot_types/basic/pie.py b/plot_types/basic/pie.py index d139f7ae214d..6cdb825e6933 100644 --- a/plot_types/basic/pie.py +++ b/plot_types/basic/pie.py @@ -23,9 +23,7 @@ ax.pie(X, colors=colors, radius=3, center=(4, 4), wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/basic/plot.py b/plot_types/basic/plot.py index d149f12aef72..cc2ca13cd837 100644 --- a/plot_types/basic/plot.py +++ b/plot_types/basic/plot.py @@ -18,8 +18,7 @@ ax.plot(X, Y, linewidth=2.0) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) + plt.show() diff --git a/plot_types/basic/scatter_plot.py b/plot_types/basic/scatter_plot.py index a204025bcf01..a7469372db6e 100644 --- a/plot_types/basic/scatter_plot.py +++ b/plot_types/basic/scatter_plot.py @@ -20,8 +20,7 @@ ax.scatter(X, Y, s=S, c=-S, cmap=plt.get_cmap('Blues'), vmin=-100, vmax=0) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) + plt.show() diff --git a/plot_types/basic/stem.py b/plot_types/basic/stem.py index 45a2b7d95669..cd03e82f8174 100644 --- a/plot_types/basic/stem.py +++ b/plot_types/basic/stem.py @@ -18,8 +18,7 @@ ax.stem(X, Y, bottom=0, linefmt="-", markerfmt="d") -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) + plt.show() diff --git a/plot_types/basic/step.py b/plot_types/basic/step.py index c2150d57ae8c..ae8776c1c6d0 100644 --- a/plot_types/basic/step.py +++ b/plot_types/basic/step.py @@ -18,8 +18,7 @@ ax.step(X, Y, linewidth=2.5) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) + plt.show() diff --git a/plot_types/stats/barbs.py b/plot_types/stats/barbs.py index 2ef37a0091ed..a8688bec5462 100644 --- a/plot_types/stats/barbs.py +++ b/plot_types/stats/barbs.py @@ -21,9 +21,7 @@ ax.barbs(X, Y, U, V, barbcolor="C0", flagcolor="C0", length=10, linewidth=1.5) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/stats/boxplot_plot.py b/plot_types/stats/boxplot_plot.py index 513e0ba81054..de3708df692b 100644 --- a/plot_types/stats/boxplot_plot.py +++ b/plot_types/stats/boxplot_plot.py @@ -22,9 +22,7 @@ whiskerprops={"color": "C0", "linewidth": 1.5}, capprops={"color": "C0", "linewidth": 1.5}) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/stats/errorbar_plot.py b/plot_types/stats/errorbar_plot.py index fc2e5892bf02..e3554531462f 100644 --- a/plot_types/stats/errorbar_plot.py +++ b/plot_types/stats/errorbar_plot.py @@ -19,9 +19,7 @@ ax.errorbar(X, Y, E, linewidth=2, capsize=6) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/stats/eventplot.py b/plot_types/stats/eventplot.py index 535742fa555e..15bc73baa408 100644 --- a/plot_types/stats/eventplot.py +++ b/plot_types/stats/eventplot.py @@ -18,9 +18,7 @@ ax.eventplot(D, orientation="vertical", lineoffsets=X, linewidth=0.75) -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/stats/hexbin.py b/plot_types/stats/hexbin.py index bf87bfeb0fba..cb6270c906f2 100644 --- a/plot_types/stats/hexbin.py +++ b/plot_types/stats/hexbin.py @@ -18,7 +18,6 @@ ax.hexbin(x, y, gridsize=20) -ax.set_xlim(-2, 2) -ax.set_ylim(-3, 3) +ax.set(xlim=(-2, 2), ylim=(-3, 3)) plt.show() diff --git a/plot_types/stats/hist2d.py b/plot_types/stats/hist2d.py index 894ce5b756f5..e36c7f0717bd 100644 --- a/plot_types/stats/hist2d.py +++ b/plot_types/stats/hist2d.py @@ -18,7 +18,6 @@ ax.hist2d(x, y, bins=(np.arange(-3, 3, 0.1), np.arange(-3, 3, 0.1))) -ax.set_xlim(-2, 2) -ax.set_ylim(-3, 3) +ax.set(xlim=(-2, 2), ylim=(-3, 3)) plt.show() diff --git a/plot_types/stats/hist_plot.py b/plot_types/stats/hist_plot.py index c59543fddb16..dae6e99fe205 100644 --- a/plot_types/stats/hist_plot.py +++ b/plot_types/stats/hist_plot.py @@ -17,9 +17,7 @@ ax.hist(X, bins=8, linewidth=0.5, edgecolor="white") -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 80) -ax.set_yticks(np.arange(1, 80, 10)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/stats/violin.py b/plot_types/stats/violin.py index df611a6d4e7c..ead0d23cab39 100644 --- a/plot_types/stats/violin.py +++ b/plot_types/stats/violin.py @@ -17,13 +17,10 @@ VP = ax.violinplot(D, [2, 4, 6], widths=2, showmeans=False, showmedians=False, showextrema=False) -#style: +# styling: for body in VP['bodies']: body.set_alpha(0.9) - -ax.set_xlim(0, 8) -ax.set_xticks(np.arange(1, 8)) -ax.set_ylim(0, 8) -ax.set_yticks(np.arange(1, 8)) +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() diff --git a/plot_types/unstructured/tricontour.py b/plot_types/unstructured/tricontour.py index 1296fe54f058..d5770cf585c8 100644 --- a/plot_types/unstructured/tricontour.py +++ b/plot_types/unstructured/tricontour.py @@ -28,7 +28,6 @@ levs = np.linspace(np.min(Z), np.max(Z), 7) ax.tricontourf(x, y, z, levels=levs) -ax.set_xlim(-3, 3) -ax.set_ylim(-3, 3) +ax.set(xlim=(-3, 3), ylim=(-3, 3)) plt.show() diff --git a/plot_types/unstructured/tripcolor.py b/plot_types/unstructured/tripcolor.py index a414da4b7a2e..fd3400876d03 100644 --- a/plot_types/unstructured/tripcolor.py +++ b/plot_types/unstructured/tripcolor.py @@ -27,7 +27,6 @@ ax.plot(x, y, '.k', alpha=0.5) ax.tripcolor(x, y, z) -ax.set_xlim(-3, 3) -ax.set_ylim(-3, 3) +ax.set(xlim=(-3, 3), ylim=(-3, 3)) plt.show() diff --git a/plot_types/unstructured/triplot.py b/plot_types/unstructured/triplot.py index d3e74099c8c2..7ef9a8f30d7b 100644 --- a/plot_types/unstructured/triplot.py +++ b/plot_types/unstructured/triplot.py @@ -23,7 +23,6 @@ ax.triplot(x, y) -ax.set_xlim(-3, 3) -ax.set_ylim(-3, 3) +ax.set(xlim=(-3, 3), ylim=(-3, 3)) plt.show()