Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bd99dfb

Browse filesBrowse files
authored
Merge pull request #13391 from dstansby/ex-remove-colours
Remove colour specification from some examples
2 parents c29f81e + cfe1f40 commit bd99dfb
Copy full SHA for bd99dfb

File tree

Expand file treeCollapse file tree

20 files changed

+52
-53
lines changed
Filter options
Expand file treeCollapse file tree

20 files changed

+52
-53
lines changed

‎examples/event_handling/legend_picking.py

Copy file name to clipboardExpand all lines: examples/event_handling/legend_picking.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
fig, ax = plt.subplots()
1616
ax.set_title('Click on legend line to toggle line on/off')
17-
line1, = ax.plot(t, y1, lw=2, color='red', label='1 HZ')
18-
line2, = ax.plot(t, y2, lw=2, color='blue', label='2 HZ')
17+
line1, = ax.plot(t, y1, lw=2, label='1 HZ')
18+
line2, = ax.plot(t, y2, lw=2, label='2 HZ')
1919
leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
2020
leg.get_frame().set_alpha(0.4)
2121

‎examples/misc/bbox_intersect.py

Copy file name to clipboardExpand all lines: examples/misc/bbox_intersect.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919

2020
left, bottom, width, height = (-1, -1, 2, 2)
21-
rect = plt.Rectangle((left, bottom), width, height, facecolor="#aaaaaa")
21+
rect = plt.Rectangle((left, bottom), width, height,
22+
facecolor="black", alpha=0.1)
2223

2324
fig, ax = plt.subplots()
2425
ax.add_patch(rect)

‎examples/misc/demo_ribbon_box.py

Copy file name to clipboardExpand all lines: examples/misc/demo_ribbon_box.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
===============
3-
Demo Ribbon Box
4-
===============
2+
==========
3+
Ribbon Box
4+
==========
55
66
"""
77

‎examples/mplot3d/hist3d.py

Copy file name to clipboardExpand all lines: examples/mplot3d/hist3d.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
dx = dy = 0.5 * np.ones_like(zpos)
3232
dz = hist.ravel()
3333

34-
ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b', zsort='average')
34+
ax.bar3d(xpos, ypos, zpos, dx, dy, dz, zsort='average')
3535

3636
plt.show()

‎examples/mplot3d/scatter3d.py

Copy file name to clipboardExpand all lines: examples/mplot3d/scatter3d.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def randrange(n, vmin, vmax):
3030

3131
# For each set of style and range settings, plot n random points in the box
3232
# defined by x in [23, 32], y in [0, 100], z in [zlow, zhigh].
33-
for c, m, zlow, zhigh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]:
33+
for m, zlow, zhigh in [('o', -50, -25), ('^', -30, -5)]:
3434
xs = randrange(n, 23, 32)
3535
ys = randrange(n, 0, 100)
3636
zs = randrange(n, zlow, zhigh)
37-
ax.scatter(xs, ys, zs, c=c, marker=m)
37+
ax.scatter(xs, ys, zs, marker=m)
3838

3939
ax.set_xlabel('X Label')
4040
ax.set_ylabel('Y Label')

‎examples/mplot3d/surface3d_2.py

Copy file name to clipboardExpand all lines: examples/mplot3d/surface3d_2.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
2525

2626
# Plot the surface
27-
ax.plot_surface(x, y, z, color='b')
27+
ax.plot_surface(x, y, z)
2828

2929
plt.show()

‎examples/pyplots/fig_axes_labels_simple.py

Copy file name to clipboardExpand all lines: examples/pyplots/fig_axes_labels_simple.py
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
======================
3-
Fig Axes Labels Simple
4-
======================
2+
==================
3+
Simple axes labels
4+
==================
55
66
Label the axes of a plot.
77
"""
@@ -15,15 +15,14 @@
1515
ax1.set_title('a sine wave')
1616

1717
t = np.arange(0.0, 1.0, 0.01)
18-
s = np.sin(2*np.pi*t)
19-
line, = ax1.plot(t, s, color='blue', lw=2)
18+
s = np.sin(2 * np.pi * t)
19+
line, = ax1.plot(t, s, lw=2)
2020

2121
# Fixing random state for reproducibility
2222
np.random.seed(19680801)
2323

2424
ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
25-
n, bins, patches = ax2.hist(np.random.randn(1000), 50,
26-
facecolor='yellow', edgecolor='yellow')
25+
n, bins, patches = ax2.hist(np.random.randn(1000), 50)
2726
ax2.set_xlabel('time (s)')
2827

2928
plt.show()

‎examples/pyplots/fig_x.py

Copy file name to clipboardExpand all lines: examples/pyplots/fig_x.py
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
"""
2-
=====
3-
Fig X
4-
=====
2+
=======================
3+
Adding lines to figures
4+
=======================
55
6-
Add lines to a figure (without axes).
6+
Adding lines to a figure without any axes.
77
"""
88
import matplotlib.pyplot as plt
99
import matplotlib.lines as lines
1010

1111

1212
fig = plt.figure()
13-
1413
l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
15-
1614
l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
17-
1815
fig.lines.extend([l1, l2])
1916

2017
plt.show()

‎examples/pyplots/whats_new_1_subplot3d.py

Copy file name to clipboardExpand all lines: examples/pyplots/whats_new_1_subplot3d.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
X, Y = np.meshgrid(X, Y)
2222
R = np.sqrt(X**2 + Y**2)
2323
Z = np.sin(R)
24-
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet,
25-
linewidth=0, antialiased=False)
24+
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.viridis,
25+
linewidth=0, antialiased=False)
2626
ax.set_zlim3d(-1.01, 1.01)
2727

2828
#ax.w_zaxis.set_major_locator(LinearLocator(10))

‎examples/shapes_and_collections/artist_reference.py

Copy file name to clipboardExpand all lines: examples/shapes_and_collections/artist_reference.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
================================
3-
Reference for matplotlib artists
3+
Reference for Matplotlib artists
44
================================
55
6-
This example displays several of matplotlib's graphics primitives (artists)
6+
This example displays several of Matplotlib's graphics primitives (artists)
77
drawn using matplotlib API. A full list of artists and the documentation is
88
available at :ref:`the artist API <artist-api>`.
99

‎examples/statistics/barchart_demo.py

Copy file name to clipboardExpand all lines: examples/statistics/barchart_demo.py
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828

2929
fig, ax = plt.subplots()
3030
rects1 = ax.bar(ind - width/2, men_means, width, yerr=men_std,
31-
color='SkyBlue', label='Men')
31+
label='Men')
3232
rects2 = ax.bar(ind + width/2, women_means, width, yerr=women_std,
33-
color='IndianRed', label='Women')
33+
label='Women')
3434

3535
# Add some text for labels, title and custom x-axis tick labels, etc.
3636
ax.set_ylabel('Scores')
@@ -53,7 +53,7 @@ def autolabel(rects, xpos='center'):
5353

5454
for rect in rects:
5555
height = rect.get_height()
56-
ax.text(rect.get_x() + rect.get_width()*offset[xpos], 1.01*height,
56+
ax.text(rect.get_x() + rect.get_width() * offset[xpos], 1.01 * height,
5757
'{}'.format(height), ha=ha[xpos], va='bottom')
5858

5959

@@ -130,7 +130,7 @@ def plot_student_results(student, scores, cohort_size):
130130

131131
rects = ax1.barh(pos, [scores[k].percentile for k in testNames],
132132
align='center',
133-
height=0.5, color='m',
133+
height=0.5,
134134
tick_label=testNames)
135135

136136
ax1.set_title(student.name)
@@ -186,13 +186,13 @@ def plot_student_results(student, scores, cohort_size):
186186
align = 'left'
187187
else:
188188
# Shift the text to the left side of the right edge
189-
xloc = 0.98*width
189+
xloc = 0.98 * width
190190
# White on magenta
191191
clr = 'white'
192192
align = 'right'
193193

194194
# Center the text vertically in the bar
195-
yloc = rect.get_y() + rect.get_height()/2.0
195+
yloc = rect.get_y() + rect.get_height() / 2
196196
label = ax1.text(xloc, yloc, rankStr, horizontalalignment=align,
197197
verticalalignment='center', color=clr, weight='bold',
198198
clip_on=True)
@@ -208,12 +208,13 @@ def plot_student_results(student, scores, cohort_size):
208208
'perc_labels': rect_labels,
209209
'cohort_label': cohort_label}
210210

211+
211212
student = Student('Johnny Doe', 2, 'boy')
212213
scores = dict(zip(testNames,
213214
(Score(v, p) for v, p in
214215
zip(['7', '48', '12:52', '17', '14'],
215216
np.round(np.random.uniform(0, 1,
216-
len(testNames))*100, 0)))))
217+
len(testNames)) * 100, 0)))))
217218
cohort_size = 62 # The number of other 2nd grade boys
218219

219220
arts = plot_student_results(student, scores, cohort_size)

‎examples/statistics/histogram_multihist.py

Copy file name to clipboardExpand all lines: examples/statistics/histogram_multihist.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
=============================================================
3-
Demo of the histogram (hist) function with multiple data sets
4-
=============================================================
2+
=====================================================
3+
The histogram (hist) function with multiple data sets
4+
=====================================================
55
66
Plot histogram with multiple sample sets and demonstrate:
77

‎examples/subplots_axes_and_figures/axes_margins.py

Copy file name to clipboardExpand all lines: examples/subplots_axes_and_figures/axes_margins.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ def f(t):
2323

2424
ax1 = plt.subplot(212)
2525
ax1.margins(0.05) # Default margin is 0.05, value 0 means fit
26-
ax1.plot(t1, f(t1), 'k')
26+
ax1.plot(t1, f(t1))
2727

2828
ax2 = plt.subplot(221)
2929
ax2.margins(2, 2) # Values >0.0 zoom out
30-
ax2.plot(t1, f(t1), 'r')
30+
ax2.plot(t1, f(t1))
3131
ax2.set_title('Zoomed out')
3232

3333
ax3 = plt.subplot(222)
3434
ax3.margins(x=0, y=-0.25) # Values in (-0.5, 0.0) zooms in to center
35-
ax3.plot(t1, f(t1), 'g')
35+
ax3.plot(t1, f(t1))
3636
ax3.set_title('Zoomed in')
3737

3838
plt.show()

‎examples/text_labels_and_annotations/mathtext_demo.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/mathtext_demo.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
fig, ax = plt.subplots()
1313

14-
ax.plot([1, 2, 3], 'r', label=r'$\sqrt{x^2}$')
14+
ax.plot([1, 2, 3], label=r'$\sqrt{x^2}$')
1515
ax.legend()
1616

1717
ax.set_xlabel(r'$\Delta_i^j$', fontsize=20)

‎examples/text_labels_and_annotations/rainbow_text.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/rainbow_text.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
The example shows how to string together several text objects.
77
8-
HISTORY
8+
History
99
-------
1010
On the matplotlib-users list back in February 2012, Gökhan Sever asked the
1111
following question:

‎examples/text_labels_and_annotations/usetex_demo.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/usetex_demo.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
xytext=(delta / 2., 0.1), textcoords='data',
3030
arrowprops=dict(arrowstyle="<->", connectionstyle="arc3"))
3131
plt.text(0, 0.1, r'$\delta$',
32-
{'color': 'k', 'fontsize': 24, 'ha': 'center', 'va': 'center',
33-
'bbox': dict(boxstyle="round", fc="w", ec="k", pad=0.2)})
32+
{'color': 'black', 'fontsize': 24, 'ha': 'center', 'va': 'center',
33+
'bbox': dict(boxstyle="round", fc="white", ec="black", pad=0.2)})
3434

3535
# Use tex in labels
3636
plt.xticks((-1, 0, 1), ('$-1$', r'$\pm 0$', '$+1$'), color='k', size=20)

‎examples/ticks_and_spines/spines_bounds.py

Copy file name to clipboardExpand all lines: examples/ticks_and_spines/spines_bounds.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
y2 = y + 0.1 * np.random.normal(size=x.shape)
1717

1818
fig, ax = plt.subplots()
19-
ax.plot(x, y, 'k--')
20-
ax.plot(x, y2, 'ro')
19+
ax.plot(x, y)
20+
ax.plot(x, y2)
2121

2222
# set ticks and tick labels
2323
ax.set_xlim((0, 2*np.pi))

‎examples/ticks_and_spines/ticklabels_rotation.py

Copy file name to clipboardExpand all lines: examples/ticks_and_spines/ticklabels_rotation.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
y = [1, 4, 9, 6]
1313
labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs']
1414

15-
plt.plot(x, y, 'ro')
15+
plt.plot(x, y)
1616
# You can specify a rotation for the tick labels in degrees or with keywords.
1717
plt.xticks(x, labels, rotation='vertical')
1818
# Pad margins so that markers don't get clipped by the axes

‎examples/units/bar_unit_demo.py

Copy file name to clipboardExpand all lines: examples/units/bar_unit_demo.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424

2525
ind = np.arange(N) # the x locations for the groups
2626
width = 0.35 # the width of the bars
27-
p1 = ax.bar(ind, menMeans, width, color='r', bottom=0*cm, yerr=menStd)
27+
p1 = ax.bar(ind, menMeans, width, bottom=0*cm, yerr=menStd)
2828

2929

3030
womenMeans = (145*cm, 149*cm, 172*cm, 165*cm, 200*cm)
3131
womenStd = (30*cm, 25*cm, 20*cm, 31*cm, 22*cm)
32-
p2 = ax.bar(ind + width, womenMeans, width,
33-
color='y', bottom=0*cm, yerr=womenStd)
32+
p2 = ax.bar(ind + width, womenMeans, width, bottom=0*cm, yerr=womenStd)
3433

3534
ax.set_title('Scores by group and gender')
3635
ax.set_xticks(ind + width / 2)

‎examples/widgets/slider_demo.py

Copy file name to clipboardExpand all lines: examples/widgets/slider_demo.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
a0 = 5
2020
f0 = 3
2121
delta_f = 5.0
22-
s = a0*np.sin(2*np.pi*f0*t)
23-
l, = plt.plot(t, s, lw=2, color='red')
22+
s = a0 * np.sin(2 * np.pi * f0 * t)
23+
l, = plt.plot(t, s, lw=2)
2424
plt.axis([0, 1, -10, 10])
2525

2626
axcolor = 'lightgoldenrodyellow'
@@ -36,6 +36,8 @@ def update(val):
3636
freq = sfreq.val
3737
l.set_ydata(amp*np.sin(2*np.pi*freq*t))
3838
fig.canvas.draw_idle()
39+
40+
3941
sfreq.on_changed(update)
4042
samp.on_changed(update)
4143

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.