diff --git a/examples/color/color_cycle_demo.py b/examples/color/color_cycle_demo.py index 70ec991f9bc9..5fdd01cd287e 100644 --- a/examples/color/color_cycle_demo.py +++ b/examples/color/color_cycle_demo.py @@ -17,7 +17,7 @@ yy = np.transpose([np.sin(x + phi) for phi in offsets]) plt.rc('lines', linewidth=4) -fig, (ax0, ax1) = plt.subplots(nrows=2) +fig, (ax0, ax1) = plt.subplots(nrows=2) plt.rc('axes', color_cycle=['r', 'g', 'b', 'y']) ax0.plot(yy) diff --git a/examples/event_handling/looking_glass.py b/examples/event_handling/looking_glass.py index b51f00605a06..c02738c130fb 100644 --- a/examples/event_handling/looking_glass.py +++ b/examples/event_handling/looking_glass.py @@ -4,7 +4,7 @@ x, y = np.random.rand(2, 200) fig, ax = plt.subplots() -circ = patches.Circle( (0.5, 0.5), 0.25, alpha=0.8, fc='yellow') +circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow') ax.add_patch(circ) diff --git a/examples/event_handling/pipong.py b/examples/event_handling/pipong.py index c8335c10ceb7..125303375fd8 100755 --- a/examples/event_handling/pipong.py +++ b/examples/event_handling/pipong.py @@ -62,7 +62,7 @@ def __init__(self, disp, pad, field): def _reset(self,pad): self.x = pad.x + pad.xoffset if pad.y < 0: - self.y = pad.y + pad.yoffset + self.y = pad.y + pad.yoffset else: self.y = pad.y - pad.yoffset self.vx = pad.x - self.x @@ -145,15 +145,15 @@ def __init__(self, ax): self.inst = True # show instructions from the beginning self.background = None self.pads = [] - self.pads.append( Pad(pA,0,padAy)) - self.pads.append( Pad(pB,padBx,padBy,'r')) + self.pads.append(Pad(pA,0,padAy)) + self.pads.append(Pad(pB,padBx,padBy,'r')) self.pucks =[] self.i = self.ax.annotate(instructions,(.5,0.5), name='monospace', verticalalignment='center', horizontalalignment='center', multialignment='left', - textcoords='axes fraction',animated=True ) + textcoords='axes fraction',animated=True) self.canvas.mpl_connect('key_press_event', self.key_press) def draw(self, evt): diff --git a/examples/misc/contour_manual.py b/examples/misc/contour_manual.py index 4a9708365c6e..4dadfcd781ce 100644 --- a/examples/misc/contour_manual.py +++ b/examples/misc/contour_manual.py @@ -6,15 +6,15 @@ import matplotlib.cm as cm # Contour lines for each level are a list/tuple of polygons. -lines0 = [ [[0,0],[0,4]] ] -lines1 = [ [[2,0],[1,2],[1,3]] ] -lines2 = [ [[3,0],[3,2]], [[3,3],[3,4]] ] # Note two lines. +lines0 = [[[0,0],[0,4]]] +lines1 = [[[2,0],[1,2],[1,3]]] +lines2 = [[[3,0],[3,2]], [[3,3],[3,4]]] # Note two lines. # Filled contours between two levels are also a list/tuple of polygons. # Points can be ordered clockwise or anticlockwise. -filled01 = [ [[0,0],[0,4],[1,3],[1,2],[2,0]] ] -filled12 = [ [[2,0],[3,0],[3,2],[1,3],[1,2]], # Note two polygons. - [[1,4],[3,4],[3,3]] ] +filled01 = [[[0,0],[0,4],[1,3],[1,2],[2,0]]] +filled12 = [[[2,0],[3,0],[3,2],[1,3],[1,2]], # Note two polygons. + [[1,4],[3,4],[3,3]]] plt.figure() @@ -38,8 +38,8 @@ # Here a code type of 1 is a MOVETO, and 2 is a LINETO. plt.figure() -filled01 = [ [[0,0],[3,0],[3,3],[0,3],[1,1],[1,2],[2,2],[2,1]] ] -kinds01 = [ [1,2,2,2,1,2,2,2] ] +filled01 = [[[0,0],[3,0],[3,3],[0,3],[1,1],[1,2],[2,2],[2,1]]] +kinds01 = [[1,2,2,2,1,2,2,2]] cs = ContourSet(plt.gca(), [0,1], [filled01], [kinds01], filled=True) cbar = plt.colorbar(cs) diff --git a/examples/misc/font_indexing.py b/examples/misc/font_indexing.py index ea21ebafdc3f..9193b012c179 100644 --- a/examples/misc/font_indexing.py +++ b/examples/misc/font_indexing.py @@ -30,7 +30,7 @@ coded[name] = ccode glyphd[name] = glyphind -code = coded['A'] +code = coded['A'] glyph = font.load_char(code) #print glyph.bbox print(glyphd['A'], glyphd['V'], coded['A'], coded['V']) diff --git a/examples/misc/rc_traits.py b/examples/misc/rc_traits.py index cad1bba47333..e5241b0d1d60 100644 --- a/examples/misc/rc_traits.py +++ b/examples/misc/rc_traits.py @@ -13,10 +13,10 @@ doprint = True flexible_true_trait = traits.Trait( True, - { 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True, + {'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True, 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False - } ) -flexible_false_trait = traits.Trait( False, flexible_true_trait ) + }) +flexible_false_trait = traits.Trait(False, flexible_true_trait) colors = { 'c' : '#00bfbf', @@ -83,7 +83,7 @@ def hex_to_rgba(ob, name, val): def colorname_to_rgba(ob, name, val): hex = colors[val.lower()] - r,g,b = hex2color(hex) + r,g,b = hex2color(hex) return RGBA(r,g,b,1.0) colorname_to_rgba.info = 'a named color' @@ -102,7 +102,7 @@ def file_exists(ob, name, val): fh = file(val, 'r') return val -linestyles = ('-', '--', '-.', ':', 'steps', 'None') +linestyles = ('-', '--', '-.', ':', 'steps', 'None') TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4) linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's', '+', 'x', 'd', 'D', '|', '_', 'h', 'H', @@ -116,23 +116,23 @@ def file_exists(ob, name, val): class LineRC(traits.HasTraits): - linewidth = traits.Float(0.5) - linestyle = traits.Trait(*linestyles) - color = Color - marker = traits.Trait(*linemarkers) + linewidth = traits.Float(0.5) + linestyle = traits.Trait(*linestyles) + color = Color + marker = traits.Trait(*linemarkers) markerfacecolor = Color markeredgecolor = Color markeredgewidth = traits.Float(0.5) - markersize = traits.Float(6) - antialiased = flexible_true_trait - data_clipping = flexible_false_trait + markersize = traits.Float(6) + antialiased = flexible_true_trait + data_clipping = flexible_false_trait class PatchRC(traits.HasTraits): - linewidth = traits.Float(1.0) + linewidth = traits.Float(1.0) facecolor = Color edgecolor = Color - antialiased = flexible_true_trait + antialiased = flexible_true_trait timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more backends = ('GTKAgg', 'Cairo', 'GDK', 'GTK', 'Agg', @@ -142,11 +142,11 @@ class PatchRC(traits.HasTraits): class RC(traits.HasTraits): backend = traits.Trait(*backends) - interactive = flexible_false_trait - toolbar = traits.Trait('toolbar2', 'classic', None) - timezone = traits.Trait(*timezones) - lines = traits.Trait(LineRC()) - patch = traits.Trait(PatchRC()) + interactive = flexible_false_trait + toolbar = traits.Trait('toolbar2', 'classic', None) + timezone = traits.Trait(*timezones) + lines = traits.Trait(LineRC()) + patch = traits.Trait(PatchRC()) rc = RC() rc.lines.color = 'r' diff --git a/examples/pylab_examples/anchored_artists.py b/examples/pylab_examples/anchored_artists.py index fd888048f54e..343967fe7b1b 100644 --- a/examples/pylab_examples/anchored_artists.py +++ b/examples/pylab_examples/anchored_artists.py @@ -98,7 +98,7 @@ def __init__(self, width, height, xdescent, ydescent, # draw a horizontal bar with length of 0.1 in Data coordinate # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, + asb = AnchoredSizeBar(ax.transData, 0.1, r"1$^{\prime}$", loc=8, diff --git a/examples/pylab_examples/anscombe.py b/examples/pylab_examples/anscombe.py index 3950b63fa8a6..92e14e79d93a 100755 --- a/examples/pylab_examples/anscombe.py +++ b/examples/pylab_examples/anscombe.py @@ -11,7 +11,7 @@ from pylab import * -x = array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5]) +x = array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5]) y1 = array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68]) y2 = array([9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74]) y3 = array([7.46, 6.77, 12.74, 7.11, 7.81, 8.84, 6.08, 5.39, 8.15, 6.42, 5.73]) @@ -23,7 +23,7 @@ def fit(x): return 3+0.5*x -xfit = array( [amin(x), amax(x) ] ) +xfit = array([amin(x), amax(x)]) subplot(221) plot(x,y1,'ks', xfit, fit(xfit), 'r-', lw=2) diff --git a/examples/pylab_examples/axes_demo.py b/examples/pylab_examples/axes_demo.py index 34ace972d0bf..83ef911f177d 100644 --- a/examples/pylab_examples/axes_demo.py +++ b/examples/pylab_examples/axes_demo.py @@ -11,7 +11,7 @@ # the main axes is subplot(111) by default plot(t, s) -axis([0, 1, 1.1*amin(s), 2*amax(s) ]) +axis([0, 1, 1.1*amin(s), 2*amax(s)]) xlabel('time (s)') ylabel('current (nA)') title('Gaussian colored noise') diff --git a/examples/pylab_examples/axis_equal_demo.py b/examples/pylab_examples/axis_equal_demo.py index 33c75a694e86..0e1aa11bcbf6 100644 --- a/examples/pylab_examples/axis_equal_demo.py +++ b/examples/pylab_examples/axis_equal_demo.py @@ -7,22 +7,22 @@ an = linspace(0,2*pi,100) subplot(221) -plot( 3*cos(an), 3*sin(an) ) +plot(3*cos(an), 3*sin(an)) title('not equal, looks like ellipse',fontsize=10) subplot(222) -plot( 3*cos(an), 3*sin(an) ) +plot(3*cos(an), 3*sin(an)) axis('equal') title('equal, looks like circle',fontsize=10) subplot(223) -plot( 3*cos(an), 3*sin(an) ) +plot(3*cos(an), 3*sin(an)) axis('equal') axis([-3,3,-3,3]) title('looks like circle, even after changing limits',fontsize=10) subplot(224) -plot( 3*cos(an), 3*sin(an) ) +plot(3*cos(an), 3*sin(an)) axis('equal') axis([-3,3,-3,3]) plot([0,4],[0,4]) diff --git a/examples/pylab_examples/bar_stacked.py b/examples/pylab_examples/bar_stacked.py index f1cf8c0c38bb..adab80c8668e 100644 --- a/examples/pylab_examples/bar_stacked.py +++ b/examples/pylab_examples/bar_stacked.py @@ -5,10 +5,10 @@ N = 5 -menMeans = (20, 35, 30, 35, 27) +menMeans = (20, 35, 30, 35, 27) womenMeans = (25, 32, 34, 20, 25) -menStd = (2, 3, 4, 1, 2) -womenStd = (3, 5, 2, 3, 3) +menStd = (2, 3, 4, 1, 2) +womenStd = (3, 5, 2, 3, 3) ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars: can also be len(x) sequence @@ -18,8 +18,8 @@ plt.ylabel('Scores') plt.title('Scores by group and gender') -plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5') ) +plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5')) plt.yticks(np.arange(0,81,10)) -plt.legend( (p1[0], p2[0]), ('Men', 'Women') ) +plt.legend((p1[0], p2[0]), ('Men', 'Women')) plt.show() diff --git a/examples/pylab_examples/boxplot_demo.py b/examples/pylab_examples/boxplot_demo.py index 3db92bfe9730..e804e1182601 100644 --- a/examples/pylab_examples/boxplot_demo.py +++ b/examples/pylab_examples/boxplot_demo.py @@ -41,7 +41,7 @@ center = ones(25) * 40 flier_high = rand(10) * 100 + 100 flier_low = rand(10) * -100 -d2 = concatenate( (spread, center, flier_high, flier_low), 0 ) +d2 = concatenate((spread, center, flier_high, flier_low), 0) data.shape = (-1, 1) d2.shape = (-1, 1) #data = concatenate( (data, d2), 1 ) diff --git a/examples/pylab_examples/boxplot_demo3.py b/examples/pylab_examples/boxplot_demo3.py index d7f9b0546e96..bade3a09d71e 100644 --- a/examples/pylab_examples/boxplot_demo3.py +++ b/examples/pylab_examples/boxplot_demo3.py @@ -42,6 +42,6 @@ def fakeBootStrapper(n): ax.set_xlabel('treatment') ax.set_ylabel('response') -plt.setp(bp['whiskers'], color='k', linestyle='-' ) +plt.setp(bp['whiskers'], color='k', linestyle='-') plt.setp(bp['fliers'], markersize=3.0) plt.show() diff --git a/examples/pylab_examples/broken_axis.py b/examples/pylab_examples/broken_axis.py index a5927d9132cd..8e89bdbc80e7 100644 --- a/examples/pylab_examples/broken_axis.py +++ b/examples/pylab_examples/broken_axis.py @@ -6,7 +6,7 @@ # 30 points between 0 0.2] originally made using np.random.rand(30)*.2 -pts = np.array([ 0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, +pts = np.array([0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018, 0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075, 0.109, 0.195, 0.05 , 0.074, 0.079, 0.155, 0.02 , 0.01 , 0.061, 0.008]) diff --git a/examples/pylab_examples/broken_barh.py b/examples/pylab_examples/broken_barh.py index 9d8085f52252..332d58809d84 100644 --- a/examples/pylab_examples/broken_barh.py +++ b/examples/pylab_examples/broken_barh.py @@ -4,8 +4,8 @@ import matplotlib.pyplot as plt fig, ax = plt.subplots() -ax.broken_barh([ (110, 30), (150, 10) ] , (10, 9), facecolors='blue') -ax.broken_barh([ (10, 50), (100, 20), (130, 10)] , (20, 9), +ax.broken_barh([(110, 30), (150, 10)] , (10, 9), facecolors='blue') +ax.broken_barh([(10, 50), (100, 20), (130, 10)] , (20, 9), facecolors=('red', 'yellow', 'green')) ax.set_ylim(5,35) ax.set_xlim(0,200) diff --git a/examples/pylab_examples/contour_label_demo.py b/examples/pylab_examples/contour_label_demo.py index e0943d65eb1e..70caf7f74641 100644 --- a/examples/pylab_examples/contour_label_demo.py +++ b/examples/pylab_examples/contour_label_demo.py @@ -48,7 +48,7 @@ def __repr__(self): return '%.1f' % self.__float__() # Recast levels to new class -CS.levels = [nf(val) for val in CS.levels ] +CS.levels = [nf(val) for val in CS.levels] # Label levels with specially formatted floats if plt.rcParams["text.usetex"]: @@ -67,8 +67,8 @@ def __repr__(self): CS = plt.contour(X, Y, Z) fmt = {} -strs = [ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh' ] -for l,s in zip( CS.levels, strs ): +strs = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh'] +for l,s in zip(CS.levels, strs): fmt[l] = s # Label every other level using strings diff --git a/examples/pylab_examples/coords_report.py b/examples/pylab_examples/coords_report.py index 738408f4ec3c..50e63db24f54 100644 --- a/examples/pylab_examples/coords_report.py +++ b/examples/pylab_examples/coords_report.py @@ -8,8 +8,8 @@ def millions(x): return '$%1.1fM' % (x*1e-6) -x = rand(20) -y = 1e7*rand(20) +x = rand(20) +y = 1e7*rand(20) fig, ax = subplots() ax.fmt_ydata = millions diff --git a/examples/pylab_examples/cursor_demo.py b/examples/pylab_examples/cursor_demo.py index a6e4a3612c2d..df8c239d0c36 100755 --- a/examples/pylab_examples/cursor_demo.py +++ b/examples/pylab_examples/cursor_demo.py @@ -21,17 +21,17 @@ def __init__(self, ax): self.ly = ax.axvline(color='k') # the vert line # text location in axes coords - self.txt = ax.text( 0.7, 0.9, '', transform=ax.transAxes) + self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) def mouse_move(self, event): if not event.inaxes: return x, y = event.xdata, event.ydata # update the line positions - self.lx.set_ydata(y ) - self.ly.set_xdata(x ) + self.lx.set_ydata(y) + self.ly.set_xdata(x) - self.txt.set_text( 'x=%1.2f, y=%1.2f'%(x,y) ) + self.txt.set_text('x=%1.2f, y=%1.2f'%(x,y)) draw() @@ -48,7 +48,7 @@ def __init__(self, ax, x, y): self.x = x self.y = y # text location in axes coords - self.txt = ax.text( 0.7, 0.9, '', transform=ax.transAxes) + self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) def mouse_move(self, event): @@ -60,10 +60,10 @@ def mouse_move(self, event): x = self.x[indx] y = self.y[indx] # update the line positions - self.lx.set_ydata(y ) - self.ly.set_xdata(x ) + self.lx.set_ydata(y) + self.ly.set_xdata(x) - self.txt.set_text( 'x=%1.2f, y=%1.2f'%(x,y) ) + self.txt.set_text('x=%1.2f, y=%1.2f'%(x,y)) print ('x=%1.2f, y=%1.2f'%(x,y)) draw() diff --git a/examples/pylab_examples/custom_ticker1.py b/examples/pylab_examples/custom_ticker1.py index 77beda526018..0cc2c22ca732 100755 --- a/examples/pylab_examples/custom_ticker1.py +++ b/examples/pylab_examples/custom_ticker1.py @@ -14,7 +14,7 @@ import matplotlib.pyplot as plt import numpy as np -x = np.arange(4) +x = np.arange(4) money = [1.5e5, 2.5e6, 5.5e6, 2.0e7] @@ -27,5 +27,5 @@ def millions(x, pos): fig, ax = plt.subplots() ax.yaxis.set_major_formatter(formatter) plt.bar(x, money) -plt.xticks( x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue') ) +plt.xticks(x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue')) plt.show() diff --git a/examples/pylab_examples/data_helper.py b/examples/pylab_examples/data_helper.py index 1c1157d7aa7e..50a00871e4da 100755 --- a/examples/pylab_examples/data_helper.py +++ b/examples/pylab_examples/data_helper.py @@ -15,12 +15,12 @@ def get_two_stock_data(): file1 = cbook.get_sample_data('INTC.dat.gz') file2 = cbook.get_sample_data('AAPL.dat.gz') - M1 = fromstring( file1.read(), ' 0.5', 'Masked if < -0.5') , +legend(('No mask', 'Masked if > 0.5', 'Masked if < -0.5') , loc = 'upper right') title('Masked line demo') show() diff --git a/examples/pylab_examples/multiline.py b/examples/pylab_examples/multiline.py index 9c918c348f56..3b0f2045c762 100644 --- a/examples/pylab_examples/multiline.py +++ b/examples/pylab_examples/multiline.py @@ -14,8 +14,8 @@ text(2, 7,'this is\nyet another test', rotation=45, horizontalalignment = 'center', - verticalalignment = 'top', - multialignment = 'center') + verticalalignment = 'top', + multialignment = 'center') grid(True) diff --git a/examples/pylab_examples/pythonic_matplotlib.py b/examples/pylab_examples/pythonic_matplotlib.py index 16e822070113..f0c1911ba733 100644 --- a/examples/pylab_examples/pythonic_matplotlib.py +++ b/examples/pylab_examples/pythonic_matplotlib.py @@ -63,7 +63,7 @@ ax1 = fig.add_subplot(211) ax1.plot(t, sin(2*pi*t)) ax1.grid(True) -ax1.set_ylim( (-2,2) ) +ax1.set_ylim((-2,2)) ax1.set_ylabel('1 Hz') ax1.set_title('A sine wave or two') @@ -74,7 +74,7 @@ ax2 = fig.add_subplot(212) ax2.plot(t, sin(2*2*pi*t)) ax2.grid(True) -ax2.set_ylim( (-2,2) ) +ax2.set_ylim((-2,2)) l = ax2.set_xlabel('Hi mom') l.set_color('g') l.set_fontsize('large') diff --git a/examples/pylab_examples/quiver_demo.py b/examples/pylab_examples/quiver_demo.py index 95173a35cd71..d4e1ad574dfa 100644 --- a/examples/pylab_examples/quiver_demo.py +++ b/examples/pylab_examples/quiver_demo.py @@ -11,13 +11,13 @@ from pylab import * from numpy import ma -X,Y = meshgrid( arange(0,2*pi,.2),arange(0,2*pi,.2) ) +X,Y = meshgrid(arange(0,2*pi,.2),arange(0,2*pi,.2)) U = cos(X) V = sin(Y) #1 figure() -Q = quiver( U, V) +Q = quiver(U, V) qk = quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$', labelpos='W', fontproperties={'weight': 'bold'}) l,r,b,t = axis() @@ -28,7 +28,7 @@ #2 figure() -Q = quiver( X, Y, U, V, units='width') +Q = quiver(X, Y, U, V, units='width') qk = quiverkey(Q, 0.9, 0.95, 2, r'$2 \frac{m}{s}$', labelpos='E', coordinates='figure', @@ -38,17 +38,17 @@ #3 figure() -Q = quiver( X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], - pivot='mid', color='r', units='inches' ) +Q = quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], + pivot='mid', color='r', units='inches') qk = quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', fontproperties={'weight': 'bold'}) -plot( X[::3, ::3], Y[::3, ::3], 'k.') +plot(X[::3, ::3], Y[::3, ::3], 'k.') axis([-1, 7, -1, 7]) title("pivot='mid'; every third arrow; units='inches'") #4 figure() M = sqrt(pow(U, 2) + pow(V, 2)) -Q = quiver( X, Y, U, V, M, units='x', pivot='tip', width=0.022, scale=1/0.15) +Q = quiver(X, Y, U, V, M, units='x', pivot='tip', width=0.022, scale=1/0.15) qk = quiverkey(Q, 0.9, 1.05, 1, r'$1 \frac{m}{s}$', labelpos='E', fontproperties={'weight': 'bold'}) @@ -58,9 +58,9 @@ #5 figure() -Q = quiver( X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], +Q = quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], color='r', units='x', - linewidths=(2,), edgecolors=('k'), headaxislength=5 ) + linewidths=(2,), edgecolors=('k'), headaxislength=5) qk = quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', fontproperties={'weight': 'bold'}) axis([-1, 7, -1, 7]) title("triangular head; scale with x view; black edges") @@ -71,7 +71,7 @@ M[U.shape[0]/3:2*U.shape[0]/3,U.shape[1]/3:2*U.shape[1]/3] = True U = ma.masked_array(U, mask=M) V = ma.masked_array(V, mask=M) -Q = quiver( U, V) +Q = quiver(U, V) qk = quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$', labelpos='W', fontproperties={'weight': 'bold'}) l,r,b,t = axis() diff --git a/examples/pylab_examples/scatter_hist.py b/examples/pylab_examples/scatter_hist.py index 39636738c168..d2cc8c310015 100644 --- a/examples/pylab_examples/scatter_hist.py +++ b/examples/pylab_examples/scatter_hist.py @@ -6,7 +6,7 @@ x = np.random.randn(1000) y = np.random.randn(1000) -nullfmt = NullFormatter() # no labels +nullfmt = NullFormatter() # no labels # definitions for the axes left, width = 0.1, 0.65 @@ -33,17 +33,17 @@ # now determine nice limits by hand: binwidth = 0.25 -xymax = np.max( [np.max(np.fabs(x)), np.max(np.fabs(y))] ) -lim = ( int(xymax/binwidth) + 1) * binwidth +xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) +lim = (int(xymax/binwidth) + 1) * binwidth -axScatter.set_xlim( (-lim, lim) ) -axScatter.set_ylim( (-lim, lim) ) +axScatter.set_xlim((-lim, lim)) +axScatter.set_ylim((-lim, lim)) bins = np.arange(-lim, lim + binwidth, binwidth) axHistx.hist(x, bins=bins) axHisty.hist(y, bins=bins, orientation='horizontal') -axHistx.set_xlim( axScatter.get_xlim() ) -axHisty.set_ylim( axScatter.get_ylim() ) +axHistx.set_xlim(axScatter.get_xlim()) +axHisty.set_ylim(axScatter.get_ylim()) plt.show() diff --git a/examples/pylab_examples/shared_axis_demo.py b/examples/pylab_examples/shared_axis_demo.py index c432552489eb..3fe2145cd091 100644 --- a/examples/pylab_examples/shared_axis_demo.py +++ b/examples/pylab_examples/shared_axis_demo.py @@ -37,13 +37,13 @@ s3 = sin(4*pi*t) ax1 = subplot(311) plot(t,s1) -setp( ax1.get_xticklabels(), fontsize=6) +setp(ax1.get_xticklabels(), fontsize=6) ## share x only ax2 = subplot(312, sharex=ax1) plot(t, s2) # make these tick labels invisible -setp( ax2.get_xticklabels(), visible=False) +setp(ax2.get_xticklabels(), visible=False) # share x and y ax3 = subplot(313, sharex=ax1, sharey=ax1) diff --git a/examples/pylab_examples/stock_demo.py b/examples/pylab_examples/stock_demo.py index e95b3391ec7c..bb8a9799efe0 100644 --- a/examples/pylab_examples/stock_demo.py +++ b/examples/pylab_examples/stock_demo.py @@ -14,6 +14,6 @@ ax.xaxis.set_major_locator(MultipleLocator(1)) title('INTC vs AAPL') -legend( ('INTC', 'AAPL') ) +legend(('INTC', 'AAPL')) show() diff --git a/examples/pylab_examples/text_rotation_relative_to_line.py b/examples/pylab_examples/text_rotation_relative_to_line.py index a2a08c506f49..6eb2f8a9a69c 100644 --- a/examples/pylab_examples/text_rotation_relative_to_line.py +++ b/examples/pylab_examples/text_rotation_relative_to_line.py @@ -13,7 +13,7 @@ from pylab import * # Plot diagonal line (45 degrees) -h = plot( r_[:10], r_[:10] ) +h = plot(r_[:10], r_[:10]) # set limits so that it no longer looks on screen to be 45 degrees xlim([-10,20]) diff --git a/examples/pylab_examples/to_numeric.py b/examples/pylab_examples/to_numeric.py index eaac80ed8ecd..4a3bcd4f289b 100755 --- a/examples/pylab_examples/to_numeric.py +++ b/examples/pylab_examples/to_numeric.py @@ -28,7 +28,7 @@ X = pylab.fromstring(s, pylab.uint8) X.shape = h, w, 3 -im = Image.fromstring( "RGB", (w,h), s) +im = Image.fromstring("RGB", (w,h), s) # Uncomment this line to display the image using ImageMagick's # `display` tool. diff --git a/examples/pylab_examples/usetex_demo.py b/examples/pylab_examples/usetex_demo.py index 049f1b7ec958..88b7c9496396 100644 --- a/examples/pylab_examples/usetex_demo.py +++ b/examples/pylab_examples/usetex_demo.py @@ -37,7 +37,7 @@ ## Left Y-axis labels pylab.ylabel(r'\bf{phase field} $\phi$', {'color' : 'b', - 'fontsize' : 20 }) + 'fontsize' : 20}) pylab.yticks((0, 0.5, 1), ('0', '.5', '1'), color = 'k', size = 20) ## Right Y-axis labels diff --git a/examples/shapes_and_collections/artist_reference.py b/examples/shapes_and_collections/artist_reference.py index 29c2192dfc50..0283a9267421 100644 --- a/examples/shapes_and_collections/artist_reference.py +++ b/examples/shapes_and_collections/artist_reference.py @@ -62,14 +62,14 @@ def label(xy, text): # add a path patch Path = mpath.Path path_data = [ - (Path.MOVETO, [ 0.018, -0.11 ]), + (Path.MOVETO, [0.018, -0.11]), (Path.CURVE4, [-0.031, -0.051]), (Path.CURVE4, [-0.115, 0.073]), (Path.CURVE4, [-0.03 , 0.073]), (Path.LINETO, [-0.011, 0.039]), - (Path.CURVE4, [ 0.043, 0.121]), - (Path.CURVE4, [ 0.075, -0.005]), - (Path.CURVE4, [ 0.035, -0.027]), + (Path.CURVE4, [0.043, 0.121]), + (Path.CURVE4, [0.075, -0.005]), + (Path.CURVE4, [0.035, -0.027]), (Path.CLOSEPOLY, [0.018, -0.11]) ] codes, verts = zip(*path_data) diff --git a/examples/text_labels_and_annotations/unicode_demo.py b/examples/text_labels_and_annotations/unicode_demo.py index 295b3c4aa5fd..5fc39bea0f4c 100644 --- a/examples/text_labels_and_annotations/unicode_demo.py +++ b/examples/text_labels_and_annotations/unicode_demo.py @@ -10,7 +10,7 @@ plt.title('Développés et fabriqués') plt.xlabel("réactivité nous permettent d'être sélectionnés et adoptés") plt.ylabel('André was here!') -plt.text( 0.2, 0.8, 'Institut für Festkörperphysik', rotation=45) -plt.text( 0.4, 0.2, 'AVA (check kerning)') +plt.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45) +plt.text(0.4, 0.2, 'AVA (check kerning)') plt.show() diff --git a/examples/units/annotate_with_units.py b/examples/units/annotate_with_units.py index af42e5878fc5..4fb82b2e6fbd 100644 --- a/examples/units/annotate_with_units.py +++ b/examples/units/annotate_with_units.py @@ -3,7 +3,7 @@ fig, ax = plt.subplots() -ax.annotate( "Note 01", [0.5*cm, 0.5*cm] ) +ax.annotate("Note 01", [0.5*cm, 0.5*cm]) # xy and text both unitized ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', diff --git a/examples/units/artist_tests.py b/examples/units/artist_tests.py index 83d0798c5f7f..71a260120456 100644 --- a/examples/units/artist_tests.py +++ b/examples/units/artist_tests.py @@ -37,7 +37,7 @@ if 0: # test a patch # Not supported at present. - rect = patches.Rectangle( (1*cm, 1*cm), width=5*cm, height=2*cm, alpha=0.2, axes=ax) + rect = patches.Rectangle((1*cm, 1*cm), width=5*cm, height=2*cm, alpha=0.2, axes=ax) ax.add_patch(rect) diff --git a/examples/units/bar_unit_demo.py b/examples/units/bar_unit_demo.py index f7f7715cde2a..57f4a34d8c8a 100644 --- a/examples/units/bar_unit_demo.py +++ b/examples/units/bar_unit_demo.py @@ -6,7 +6,7 @@ N = 5 menMeans = (150*cm, 160*cm, 146*cm, 172*cm, 155*cm) -menStd = ( 20*cm, 30*cm, 32*cm, 10*cm, 20*cm) +menStd = (20*cm, 30*cm, 32*cm, 10*cm, 20*cm) fig, ax = plt.subplots() @@ -16,14 +16,14 @@ womenMeans = (145*cm, 149*cm, 172*cm, 165*cm, 200*cm) -womenStd = (30*cm, 25*cm, 20*cm, 31*cm, 22*cm) +womenStd = (30*cm, 25*cm, 20*cm, 31*cm, 22*cm) p2 = ax.bar(ind+width, womenMeans, width, color='y', bottom=0*cm, yerr=womenStd) ax.set_title('Scores by group and gender') ax.set_xticks(ind+width) -ax.set_xticklabels( ('G1', 'G2', 'G3', 'G4', 'G5') ) +ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5')) -ax.legend( (p1[0], p2[0]), ('Men', 'Women') ) +ax.legend((p1[0], p2[0]), ('Men', 'Women')) ax.yaxis.set_units(inch) ax.autoscale_view() diff --git a/examples/units/evans_test.py b/examples/units/evans_test.py index 2d67e6c0dd2e..22acd55c9430 100644 --- a/examples/units/evans_test.py +++ b/examples/units/evans_test.py @@ -11,11 +11,11 @@ class Foo: - def __init__( self, val, unit=1.0 ): + def __init__(self, val, unit=1.0): self.unit = unit self._val = val * unit - def value( self, unit ): + def value(self, unit): if unit is None: unit = self.unit return self._val / unit @@ -26,7 +26,7 @@ def axisinfo(unit, axis): 'return the Foo AxisInfo' if unit==1.0 or unit==2.0: return units.AxisInfo( - majloc = ticker.IndexLocator( 8, 0 ), + majloc = ticker.IndexLocator(8, 0), majfmt = ticker.FormatStrFormatter("VAL: %s"), label='foo', ) @@ -61,11 +61,11 @@ def default_units(x, axis): # create some Foos x = [] -for val in range( 0, 50, 2 ): - x.append( Foo( val, 1.0 ) ) +for val in range(0, 50, 2): + x.append(Foo(val, 1.0)) # and some arbitrary y data -y = [i for i in range( len(x) ) ] +y = [i for i in range(len(x))] # plot specifying units @@ -73,7 +73,7 @@ def default_units(x, axis): fig.suptitle("Custom units") fig.subplots_adjust(bottom=0.2) ax = fig.add_subplot(1,2,2) -ax.plot( x, y, 'o', xunits=2.0 ) +ax.plot(x, y, 'o', xunits=2.0) for label in ax.get_xticklabels(): label.set_rotation(30) label.set_ha('right') @@ -82,7 +82,7 @@ def default_units(x, axis): # plot without specifying units; will use the None branch for axisinfo ax = fig.add_subplot(1,2,1) -ax.plot( x, y ) # uses default units +ax.plot(x, y) # uses default units ax.set_title('default units') for label in ax.get_xticklabels(): label.set_rotation(30) diff --git a/examples/user_interfaces/embedding_in_gtk3.py b/examples/user_interfaces/embedding_in_gtk3.py index 53f0dd39f07b..14f2f23faa23 100755 --- a/examples/user_interfaces/embedding_in_gtk3.py +++ b/examples/user_interfaces/embedding_in_gtk3.py @@ -11,7 +11,7 @@ from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas win = Gtk.Window() -win.connect("delete-event", Gtk.main_quit ) +win.connect("delete-event", Gtk.main_quit) win.set_default_size(400,300) win.set_title("Embedding in GTK") diff --git a/examples/user_interfaces/embedding_in_gtk3_panzoom.py b/examples/user_interfaces/embedding_in_gtk3_panzoom.py index e189b1263d8f..5f1ed6e32f8f 100644 --- a/examples/user_interfaces/embedding_in_gtk3_panzoom.py +++ b/examples/user_interfaces/embedding_in_gtk3_panzoom.py @@ -11,7 +11,7 @@ from matplotlib.backends.backend_gtk3 import NavigationToolbar2GTK3 as NavigationToolbar win = Gtk.Window() -win.connect("delete-event", Gtk.main_quit ) +win.connect("delete-event", Gtk.main_quit) win.set_default_size(400,300) win.set_title("Embedding in GTK") diff --git a/examples/user_interfaces/embedding_in_tk.py b/examples/user_interfaces/embedding_in_tk.py index 00d814cbacab..43b24f3d6bcb 100755 --- a/examples/user_interfaces/embedding_in_tk.py +++ b/examples/user_interfaces/embedding_in_tk.py @@ -34,7 +34,7 @@ canvas.show() canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) -toolbar = NavigationToolbar2TkAgg( canvas, root ) +toolbar = NavigationToolbar2TkAgg(canvas, root) toolbar.update() canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) diff --git a/examples/user_interfaces/embedding_in_wx3.py b/examples/user_interfaces/embedding_in_wx3.py index 3ed6c063c912..fcfe75b527cc 100755 --- a/examples/user_interfaces/embedding_in_wx3.py +++ b/examples/user_interfaces/embedding_in_wx3.py @@ -69,7 +69,7 @@ def init_plot_data(self): y = np.arange(100.0)*2*np.pi/50.0 self.x, self.y = np.meshgrid(x, y) z = np.sin(self.x) + np.cos(self.y) - self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest') + self.im = a.imshow(z, cmap=cm.jet)#, interpolation='nearest') zmax = np.amax(z) - ERR_TOL ymax_i, xmax_i = np.nonzero(z >= zmax) diff --git a/examples/user_interfaces/histogram_demo_canvasagg.py b/examples/user_interfaces/histogram_demo_canvasagg.py index d3444e8c9dd6..8db16bdc83f0 100644 --- a/examples/user_interfaces/histogram_demo_canvasagg.py +++ b/examples/user_interfaces/histogram_demo_canvasagg.py @@ -27,7 +27,7 @@ n, bins, patches = ax.hist(x, 50, normed=1) # add a 'best fit' line -y = normpdf( bins, mu, sigma) +y = normpdf(bins, mu, sigma) line, = ax.plot(bins, y, 'r--') line.set_linewidth(1) @@ -35,8 +35,8 @@ ax.set_ylabel('Probability') ax.set_title(r'$\mathrm{Histogram of IQ: }\mu=100, \sigma=15$') -ax.set_xlim( (40, 160)) -ax.set_ylim( (0, 0.03)) +ax.set_xlim((40, 160)) +ax.set_ylim((0, 0.03)) canvas.draw() @@ -55,5 +55,5 @@ if 0: # pass off to PIL from PIL import Image - im = Image.fromstring( "RGB", (w,h), s) + im = Image.fromstring("RGB", (w,h), s) im.show() diff --git a/examples/user_interfaces/interactive2.py b/examples/user_interfaces/interactive2.py index 4410f2386dff..6206b1373fa9 100755 --- a/examples/user_interfaces/interactive2.py +++ b/examples/user_interfaces/interactive2.py @@ -122,7 +122,7 @@ class OutputStream: def __init__(self,view,old_out,style): self.view = view self.buffer = view.get_buffer() - self.mark = self.buffer.create_mark("End",self.buffer.get_end_iter(), False ) + self.mark = self.buffer.create_mark("End",self.buffer.get_end_iter(), False) self.out = old_out self.style = style self.tee = 1 @@ -133,7 +133,7 @@ def write(self,text): end = self.buffer.get_end_iter() - if not self.view == None: + if not self.view == None: self.view.scroll_to_mark(self.mark, 0, True, 1, 1) self.buffer.insert_with_tags(end,text,self.style) @@ -161,32 +161,32 @@ def __init__(self): self.ps1 = ">>> " self.ps2 = "... " - self.text.add_events( gtk.gdk.KEY_PRESS_MASK ) - self.text.connect( "key_press_event", self.key_pressed ) + self.text.add_events(gtk.gdk.KEY_PRESS_MASK) + self.text.connect("key_press_event", self.key_pressed) self.current_history = -1 - self.mark = self.text.get_buffer().create_mark("End",self.text.get_buffer().get_end_iter(), False ) + self.mark = self.text.get_buffer().create_mark("End",self.text.get_buffer().get_end_iter(), False) #setup colors self.style_banner = gtk.TextTag("banner") - self.style_banner.set_property( "foreground", "saddle brown" ) + self.style_banner.set_property("foreground", "saddle brown") self.style_ps1 = gtk.TextTag("ps1") - self.style_ps1.set_property( "foreground", "DarkOrchid4" ) - self.style_ps1.set_property( "editable", False ) - self.style_ps1.set_property("font", "courier" ) + self.style_ps1.set_property("foreground", "DarkOrchid4") + self.style_ps1.set_property("editable", False) + self.style_ps1.set_property("font", "courier") self.style_ps2 = gtk.TextTag("ps2") - self.style_ps2.set_property( "foreground", "DarkOliveGreen" ) - self.style_ps2.set_property( "editable", False ) - self.style_ps2.set_property("font", "courier" ) + self.style_ps2.set_property("foreground", "DarkOliveGreen") + self.style_ps2.set_property("editable", False) + self.style_ps2.set_property("font", "courier") self.style_out = gtk.TextTag("stdout") - self.style_out.set_property( "foreground", "midnight blue" ) + self.style_out.set_property("foreground", "midnight blue") self.style_err = gtk.TextTag("stderr") - self.style_err.set_property( "style", pango.STYLE_ITALIC ) - self.style_err.set_property( "foreground", "red" ) + self.style_err.set_property("style", pango.STYLE_ITALIC) + self.style_err.set_property("foreground", "red") self.text.get_buffer().get_tag_table().add(self.style_banner) self.text.get_buffer().get_tag_table().add(self.style_ps1) @@ -260,12 +260,12 @@ def key_pressed(self,widget,event): if self.current_history > 0: self.current_history = 0 return self.show_history() - elif event.keyval == gtk.gdk.keyval_from_name( 'Home'): + elif event.keyval == gtk.gdk.keyval_from_name('Home'): l = self.text.get_buffer().get_line_count() - 1 start = self.text.get_buffer().get_iter_at_line_offset(l,4) self.text.get_buffer().place_cursor(start) return True - elif event.keyval == gtk.gdk.keyval_from_name( 'space') and event.state & gtk.gdk.CONTROL_MASK: + elif event.keyval == gtk.gdk.keyval_from_name('space') and event.state & gtk.gdk.CONTROL_MASK: return self.complete_line() return False @@ -273,7 +273,7 @@ def show_history(self): if self.current_history == 0: return True else: - self.replace_line( self.history[self.current_history] ) + self.replace_line(self.history[self.current_history]) return True def current_line(self): @@ -359,8 +359,8 @@ def key_event(widget,event): w.connect("destroy", destroy) - w.add_events( gtk.gdk.KEY_PRESS_MASK ) - w.connect( 'key_press_event', key_event) + w.add_events(gtk.gdk.KEY_PRESS_MASK) + w.connect('key_press_event', key_event) w.show_all() console.execute_line('import matplotlib') diff --git a/examples/user_interfaces/mpl_with_glade.py b/examples/user_interfaces/mpl_with_glade.py index 8a134d27217a..046b4cd83cba 100755 --- a/examples/user_interfaces/mpl_with_glade.py +++ b/examples/user_interfaces/mpl_with_glade.py @@ -17,9 +17,9 @@ def simple_msg(msg, parent=None, title=None): dialog = gtk.MessageDialog( - parent = None, - type = gtk.MESSAGE_INFO, - buttons = gtk.BUTTONS_OK, + parent = None, + type = gtk.MESSAGE_INFO, + buttons = gtk.BUTTONS_OK, message_format = msg) if parent is not None: dialog.set_transient_for(parent) @@ -58,8 +58,8 @@ def __init__(self): self.canvas.show() self.canvas.set_size_request(600, 400) self.canvas.set_events( - gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.KEY_PRESS_MASK | + gtk.gdk.BUTTON_PRESS_MASK | + gtk.gdk.KEY_PRESS_MASK | gtk.gdk.KEY_RELEASE_MASK ) self.canvas.set_flags(gtk.HAS_FOCUS|gtk.CAN_FOCUS) @@ -78,7 +78,7 @@ def onselect(xmin, xmax): print(xmin, xmax) span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False, - rectprops=dict(alpha=0.5, facecolor='red') ) + rectprops=dict(alpha=0.5, facecolor='red')) self['vboxMain'].pack_start(self.canvas, True, True) self['vboxMain'].show() diff --git a/examples/user_interfaces/mpl_with_glade_316.py b/examples/user_interfaces/mpl_with_glade_316.py index 17000170622e..60584e2ad8ab 100644 --- a/examples/user_interfaces/mpl_with_glade_316.py +++ b/examples/user_interfaces/mpl_with_glade_316.py @@ -15,7 +15,7 @@ def on_window1_destroy(self, widget): def main(): builder = Gtk.Builder() - builder.add_objects_from_file("mpl_with_glade_316.glade", ("window1", "") ) + builder.add_objects_from_file("mpl_with_glade_316.glade", ("window1", "")) builder.connect_signals(Window1Signals()) window = builder.get_object("window1") sw = builder.get_object("scrolledwindow1") diff --git a/examples/user_interfaces/wxcursor_demo.py b/examples/user_interfaces/wxcursor_demo.py index 412ffadb808c..06a5b44f0529 100644 --- a/examples/user_interfaces/wxcursor_demo.py +++ b/examples/user_interfaces/wxcursor_demo.py @@ -53,8 +53,8 @@ def ChangeCursor(self, event): def UpdateStatusBar(self, event): if event.inaxes: x, y = event.xdata, event.ydata - self.statusBar.SetStatusText(( "x= " + str(x) + - " y=" +str(y) ), + self.statusBar.SetStatusText(("x= " + str(x) + + " y=" +str(y)), 0) diff --git a/examples/widgets/cursor.py b/examples/widgets/cursor.py index 0e5d30e141e0..6adcd52407da 100644 --- a/examples/widgets/cursor.py +++ b/examples/widgets/cursor.py @@ -14,6 +14,6 @@ ax.set_ylim(-2, 2) # set useblit = True on gtkagg for enhanced performance -cursor = Cursor(ax, useblit=True, color='red', linewidth=2 ) +cursor = Cursor(ax, useblit=True, color='red', linewidth=2) plt.show() diff --git a/examples/widgets/slider_demo.py b/examples/widgets/slider_demo.py index 041947e8eda4..72835d12710d 100644 --- a/examples/widgets/slider_demo.py +++ b/examples/widgets/slider_demo.py @@ -13,7 +13,7 @@ axcolor = 'lightgoldenrodyellow' axfreq = plt.axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor) -axamp = plt.axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor) +axamp = plt.axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor) sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0) samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0) diff --git a/examples/widgets/span_selector.py b/examples/widgets/span_selector.py index 9ce64904e37f..979e282b19ed 100644 --- a/examples/widgets/span_selector.py +++ b/examples/widgets/span_selector.py @@ -34,7 +34,7 @@ def onselect(xmin, xmax): # set useblit True on gtkagg for enhanced performance span = SpanSelector(ax, onselect, 'horizontal', useblit=True, - rectprops=dict(alpha=0.5, facecolor='red') ) + rectprops=dict(alpha=0.5, facecolor='red')) plt.show()