From 4b43716bef55107c2aeedeec0d77e2cb86a60ec3 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 6 Feb 2020 20:27:09 +0100 Subject: [PATCH] Style-fix some examples and update .flake8 per-file-ignores. --- .flake8 | 27 +++++++++---------- .../axes_grid1/scatter_hist_locatable_axes.py | 3 ++- examples/pyplots/text_commands.py | 2 +- .../pyplots/whats_new_98_4_fill_between.py | 4 +-- examples/pyplots/whats_new_98_4_legend.py | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.flake8 b/.flake8 index 1da5cbf5b3c7..3bbcf1ded796 100644 --- a/.flake8 +++ b/.flake8 @@ -101,7 +101,7 @@ per-file-ignores = examples/animation/frame_grabbing_sgskip.py: E402 examples/axes_grid1/inset_locator_demo.py: E402 - examples/axes_grid1/scatter_hist_locatable_axes.py: E401, E402 + examples/axes_grid1/scatter_hist_locatable_axes.py: E402 examples/axisartist/demo_curvelinear_grid.py: E402 examples/color/color_by_yvalue.py: E402 examples/color/color_cycle_default.py: E402 @@ -178,32 +178,31 @@ per-file-ignores = examples/pie_and_polar_charts/polar_legend.py: E402 examples/pie_and_polar_charts/polar_scatter.py: E402 examples/pyplots/align_ylabels.py: E402 - examples/pyplots/annotate_transform.py: E228, E251, E402 + examples/pyplots/annotate_transform.py: E251, E402 examples/pyplots/annotation_basic.py: E402 - examples/pyplots/annotation_polar.py: E231, E402 - examples/pyplots/auto_subplots_adjust.py: E231, E302, E402 + examples/pyplots/annotation_polar.py: E402 + examples/pyplots/auto_subplots_adjust.py: E302, E402 examples/pyplots/axline.py: E402 - examples/pyplots/boxplot_demo_pyplot.py: E231, E402 - examples/pyplots/compound_path_demo.py: E231 + examples/pyplots/boxplot_demo_pyplot.py: E402 examples/pyplots/dollar_ticks.py: E402 examples/pyplots/fig_axes_customize_simple.py: E402 examples/pyplots/fig_axes_labels_simple.py: E402 examples/pyplots/fig_x.py: E402 - examples/pyplots/pyplot_formatstr.py: E231, E402 - examples/pyplots/pyplot_mathtext.py: E231, E402 + examples/pyplots/pyplot_formatstr.py: E402 + examples/pyplots/pyplot_mathtext.py: E402 examples/pyplots/pyplot_scales.py: E402 - examples/pyplots/pyplot_simple.py: E231, E402 + examples/pyplots/pyplot_simple.py: E402 examples/pyplots/pyplot_text.py: E402 examples/pyplots/pyplot_three.py: E402 examples/pyplots/pyplot_two_subplots.py: E402 - examples/pyplots/text_commands.py: E231, E402 - examples/pyplots/text_layout.py: E231, E402 + examples/pyplots/text_commands.py: E402 + examples/pyplots/text_layout.py: E402 examples/pyplots/whats_new_1_subplot3d.py: E402 - examples/pyplots/whats_new_98_4_fill_between.py: E225, E402 - examples/pyplots/whats_new_98_4_legend.py: E228, E402 + examples/pyplots/whats_new_98_4_fill_between.py: E402 + examples/pyplots/whats_new_98_4_legend.py: E402 examples/pyplots/whats_new_99_axes_grid.py: E402 examples/pyplots/whats_new_99_mplot3d.py: E402 - examples/pyplots/whats_new_99_spines.py: E231, E402 + examples/pyplots/whats_new_99_spines.py: E402 examples/scales/power_norm.py: E402 examples/scales/scales.py: E402 examples/shapes_and_collections/artist_reference.py: E402 diff --git a/examples/axes_grid1/scatter_hist_locatable_axes.py b/examples/axes_grid1/scatter_hist_locatable_axes.py index 2a1758ae83e9..60dec95d71b9 100644 --- a/examples/axes_grid1/scatter_hist_locatable_axes.py +++ b/examples/axes_grid1/scatter_hist_locatable_axes.py @@ -73,7 +73,8 @@ # The use of the following functions, methods and classes is shown # in this example: -import matplotlib, mpl_toolkits +import matplotlib +import mpl_toolkits mpl_toolkits.axes_grid1.axes_divider.make_axes_locatable matplotlib.axes.Axes.set_aspect matplotlib.axes.Axes.scatter diff --git a/examples/pyplots/text_commands.py b/examples/pyplots/text_commands.py index 1f6647faede0..931f549f417e 100644 --- a/examples/pyplots/text_commands.py +++ b/examples/pyplots/text_commands.py @@ -19,7 +19,7 @@ ax.set_ylabel('ylabel') ax.text(3, 8, 'boxed italics text in data coords', style='italic', - bbox={'facecolor':'red', 'alpha':0.5, 'pad':10}) + bbox={'facecolor': 'red', 'alpha': 0.5, 'pad': 10}) ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15) diff --git a/examples/pyplots/whats_new_98_4_fill_between.py b/examples/pyplots/whats_new_98_4_fill_between.py index 8719a5428e03..7193cfd02d1f 100644 --- a/examples/pyplots/whats_new_98_4_fill_between.py +++ b/examples/pyplots/whats_new_98_4_fill_between.py @@ -14,8 +14,8 @@ fig, ax = plt.subplots() ax.plot(x, y1, x, y2, color='black') -ax.fill_between(x, y1, y2, where=y2 >y1, facecolor='yellow', alpha=0.5) -ax.fill_between(x, y1, y2, where=y2 <=y1, facecolor='red', alpha=0.5) +ax.fill_between(x, y1, y2, where=(y2 > y1), facecolor='yellow', alpha=0.5) +ax.fill_between(x, y1, y2, where=(y2 <= y1), facecolor='red', alpha=0.5) ax.set_title('Fill Between') plt.show() diff --git a/examples/pyplots/whats_new_98_4_legend.py b/examples/pyplots/whats_new_98_4_legend.py index ed534ca18992..0252245a0be1 100644 --- a/examples/pyplots/whats_new_98_4_legend.py +++ b/examples/pyplots/whats_new_98_4_legend.py @@ -12,7 +12,7 @@ ax = plt.subplot(111) t1 = np.arange(0.0, 1.0, 0.01) for n in [1, 2, 3, 4]: - plt.plot(t1, t1**n, label="n=%d"%(n,)) + plt.plot(t1, t1**n, label=f"n={n}") leg = plt.legend(loc='best', ncol=2, mode="expand", shadow=True, fancybox=True) leg.get_frame().set_alpha(0.5)