diff --git a/.flake8 b/.flake8 index 4cb738b4b544..1073244a2de8 100644 --- a/.flake8 +++ b/.flake8 @@ -185,7 +185,7 @@ per-file-ignores = examples/pyplots/pyplot_simple.py: E231, E402 examples/pyplots/pyplot_text.py: E402 examples/pyplots/pyplot_three.py: E402 - examples/pyplots/pyplot_two_subplots.py: E302, E402 + examples/pyplots/pyplot_two_subplots.py: E402 examples/pyplots/text_commands.py: E231, E402 examples/pyplots/text_layout.py: E231, E402 examples/pyplots/whats_new_1_subplot3d.py: E402 diff --git a/examples/lines_bars_and_markers/barh.py b/examples/lines_bars_and_markers/barh.py index 54b8fcb8a7cd..c537c0d9b215 100644 --- a/examples/lines_bars_and_markers/barh.py +++ b/examples/lines_bars_and_markers/barh.py @@ -21,8 +21,7 @@ performance = 3 + 10 * np.random.rand(len(people)) error = np.random.rand(len(people)) -ax.barh(y_pos, performance, xerr=error, align='center', - color='green', ecolor='black') +ax.barh(y_pos, performance, xerr=error, align='center') ax.set_yticks(y_pos) ax.set_yticklabels(people) ax.invert_yaxis() # labels read top-to-bottom diff --git a/examples/lines_bars_and_markers/broken_barh.py b/examples/lines_bars_and_markers/broken_barh.py index 72f2f90a9048..c0691beaf255 100644 --- a/examples/lines_bars_and_markers/broken_barh.py +++ b/examples/lines_bars_and_markers/broken_barh.py @@ -8,9 +8,9 @@ import matplotlib.pyplot as plt fig, ax = plt.subplots() -ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='blue') +ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='tab:blue') ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9), - facecolors=('red', 'yellow', 'green')) + facecolors=('tab:orange', 'tab:green', 'tab:red')) ax.set_ylim(5, 35) ax.set_xlim(0, 200) ax.set_xlabel('seconds since start') diff --git a/examples/lines_bars_and_markers/eventcollection_demo.py b/examples/lines_bars_and_markers/eventcollection_demo.py index 18c76fb135a0..abdb6e6c05f5 100644 --- a/examples/lines_bars_and_markers/eventcollection_demo.py +++ b/examples/lines_bars_and_markers/eventcollection_demo.py @@ -32,16 +32,17 @@ # plot the data fig = plt.figure() ax = fig.add_subplot(1, 1, 1) -ax.plot(xdata1, ydata1, 'r', xdata2, ydata2, 'b') +ax.plot(xdata1, ydata1, color='tab:blue') +ax.plot(xdata2, ydata2, color='tab:orange') # create the events marking the x data points -xevents1 = EventCollection(xdata1, color=[1, 0, 0], linelength=0.05) -xevents2 = EventCollection(xdata2, color=[0, 0, 1], linelength=0.05) +xevents1 = EventCollection(xdata1, color='tab:blue', linelength=0.05) +xevents2 = EventCollection(xdata2, color='tab:orange', linelength=0.05) # create the events marking the y data points -yevents1 = EventCollection(ydata1, color=[1, 0, 0], linelength=0.05, +yevents1 = EventCollection(ydata1, color='tab:blue', linelength=0.05, orientation='vertical') -yevents2 = EventCollection(ydata2, color=[0, 0, 1], linelength=0.05, +yevents2 = EventCollection(ydata2, color='tab:orange', linelength=0.05, orientation='vertical') # add the events to the axis diff --git a/examples/lines_bars_and_markers/eventplot_demo.py b/examples/lines_bars_and_markers/eventplot_demo.py index 32e74c8ffe89..d1be2fbe91f1 100644 --- a/examples/lines_bars_and_markers/eventplot_demo.py +++ b/examples/lines_bars_and_markers/eventplot_demo.py @@ -20,12 +20,7 @@ data1 = np.random.random([6, 50]) # set different colors for each set of positions -colors1 = np.array([[1, 0, 0], - [0, 1, 0], - [0, 0, 1], - [1, 1, 0], - [1, 0, 1], - [0, 1, 1]]) +colors1 = ['C{}'.format(i) for i in range(6)] # set different line properties for each set of positions # note that some overlap @@ -49,7 +44,7 @@ # use individual values for the parameters this time # these values will be used for all data sets (except lineoffsets2, which # sets the increment between each data set in this usage) -colors2 = [[0, 0, 0]] +colors2 = 'black' lineoffsets2 = 1 linelengths2 = 1 diff --git a/examples/lines_bars_and_markers/joinstyle.py b/examples/lines_bars_and_markers/joinstyle.py index 7ac68883cfd4..f1db93a4145a 100644 --- a/examples/lines_bars_and_markers/joinstyle.py +++ b/examples/lines_bars_and_markers/joinstyle.py @@ -14,12 +14,13 @@ def plot_angle(ax, x, y, angle, style): phi = np.radians(angle) xx = [x + .5, x, x + .5*np.cos(phi)] yy = [y, y, y + .5*np.sin(phi)] - ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style) + ax.plot(xx, yy, lw=8, color='tab:blue', solid_joinstyle=style) ax.plot(xx[1:], yy[1:], lw=1, color='black') ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black') - ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3) + ax.plot(xx[1:2], yy[1:2], 'o', color='tab:red', markersize=3) ax.text(x, y + .2, '%.0f degrees' % angle) + fig, ax = plt.subplots() ax.set_title('Join style') diff --git a/examples/lines_bars_and_markers/markevery_prop_cycle.py b/examples/lines_bars_and_markers/markevery_prop_cycle.py index ac020e1ba713..295de4756736 100644 --- a/examples/lines_bars_and_markers/markevery_prop_cycle.py +++ b/examples/lines_bars_and_markers/markevery_prop_cycle.py @@ -1,7 +1,7 @@ """ -================================================================= -Implemented support for prop_cycle property markevery in rcParams -================================================================= +========================================= +prop_cycle property markevery in rcParams +========================================= This example demonstrates a working solution to issue #8576, providing full support of the markevery property for axes.prop_cycle assignments through diff --git a/examples/lines_bars_and_markers/scatter_with_legend.py b/examples/lines_bars_and_markers/scatter_with_legend.py index 1327f5cd170b..f7b7af5ac3b3 100644 --- a/examples/lines_bars_and_markers/scatter_with_legend.py +++ b/examples/lines_bars_and_markers/scatter_with_legend.py @@ -13,7 +13,7 @@ fig, ax = plt.subplots() -for color in ['red', 'green', 'blue']: +for color in ['tab:blue', 'tab:orange', 'tab:green']: n = 750 x, y = rand(2, n) scale = 200.0 * rand(n) diff --git a/examples/pyplots/fig_axes_customize_simple.py b/examples/pyplots/fig_axes_customize_simple.py index 9f1268a16a9d..0d665b6a4747 100644 --- a/examples/pyplots/fig_axes_customize_simple.py +++ b/examples/pyplots/fig_axes_customize_simple.py @@ -22,13 +22,13 @@ for label in ax1.xaxis.get_ticklabels(): # label is a Text instance - label.set_color('red') + label.set_color('tab:red') label.set_rotation(45) label.set_fontsize(16) for line in ax1.yaxis.get_ticklines(): # line is a Line2D instance - line.set_color('green') + line.set_color('tab:green') line.set_markersize(25) line.set_markeredgewidth(3) diff --git a/examples/pyplots/pyplot_two_subplots.py b/examples/pyplots/pyplot_two_subplots.py index 4578f096bbb4..8c6453477b21 100644 --- a/examples/pyplots/pyplot_two_subplots.py +++ b/examples/pyplots/pyplot_two_subplots.py @@ -8,18 +8,21 @@ import numpy as np import matplotlib.pyplot as plt + def f(t): return np.exp(-t) * np.cos(2*np.pi*t) + t1 = np.arange(0.0, 5.0, 0.1) t2 = np.arange(0.0, 5.0, 0.02) plt.figure() plt.subplot(211) -plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k') +plt.plot(t1, f(t1), color='tab:blue', marker='o') +plt.plot(t2, f(t2), color='black') plt.subplot(212) -plt.plot(t2, np.cos(2*np.pi*t2), 'r--') +plt.plot(t2, np.cos(2*np.pi*t2), color='tab:orange', linestyle='--') plt.show() ############################################################################# diff --git a/examples/text_labels_and_annotations/figlegend_demo.py b/examples/text_labels_and_annotations/figlegend_demo.py index b8410d228e24..674b7627f09f 100644 --- a/examples/text_labels_and_annotations/figlegend_demo.py +++ b/examples/text_labels_and_annotations/figlegend_demo.py @@ -15,11 +15,13 @@ x = np.arange(0.0, 2.0, 0.02) y1 = np.sin(2 * np.pi * x) y2 = np.exp(-x) -l1, l2 = axs[0].plot(x, y1, 'rs-', x, y2, 'go') +l1, = axs[0].plot(x, y1) +l2, = axs[0].plot(x, y2, marker='o') y3 = np.sin(4 * np.pi * x) y4 = np.exp(-2 * x) -l3, l4 = axs[1].plot(x, y3, 'yd-', x, y4, 'k^') +l3, = axs[1].plot(x, y3, color='tab:green') +l4, = axs[1].plot(x, y4, color='tab:red', marker='^') fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left') fig.legend((l3, l4), ('Line 3', 'Line 4'), 'upper right')