Skip to content

Commit 918e80e

Browse files
committed
Merge pull request #5997 from QuLogic/example-defaults
Use new defaults more often in examples
2 parents cd0921c + 2164154 commit 918e80e

30 files changed

+53
-42
lines changed

examples/api/collections_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
yo = rs.randn(npts)
3939
xyo = list(zip(xo, yo))
4040

41-
# Make a list of colors cycling through the rgbcmyk series.
41+
# Make a list of colors cycling through the default series.
4242
colors = [colorConverter.to_rgba(c)
43-
for c in ('r', 'g', 'b', 'c', 'y', 'm', 'k')]
43+
for c in plt.rcParams['axes.prop_cycle'].by_key()['color']]
4444

4545
fig, axes = plt.subplots(2, 2)
4646
((ax1, ax2), (ax3, ax4)) = axes # unpack the axes

examples/api/filled_step.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
172172
hist_func = partial(np.histogram, bins=edges)
173173

174174
# set up style cycles
175-
color_cycle = cycler('facecolor', 'rgbm')
175+
color_cycle = cycler(facecolor=plt.rcParams['axes.prop_cycle'][:4])
176176
label_cycle = cycler('label', ['set {n}'.format(n=n) for n in range(4)])
177177
hatch_cycle = cycler('hatch', ['/', '*', '+', '|'])
178178

examples/pie_and_polar_charts/polar_bar_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# Use custom colors and opacity
1717
for r, bar in zip(radii, bars):
18-
bar.set_facecolor(plt.cm.jet(r / 10.))
18+
bar.set_facecolor(plt.cm.viridis(r / 10.))
1919
bar.set_alpha(0.5)
2020

2121
plt.show()

examples/pylab_examples/anchored_artists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, transform, size, label, loc,
2727
sep in points.
2828
"""
2929
self.size_bar = AuxTransformBox(transform)
30-
self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none"))
30+
self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none", lw=1.0))
3131

3232
self.txt_label = TextArea(label, minimumdescent=False)
3333

examples/pylab_examples/axes_props.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
line.set_linewidth(3)
2020

2121
for line in gridlines:
22-
line.set_linestyle('-')
22+
line.set_linestyle('-.')
2323

2424
for label in ticklabels:
2525
label.set_color('r')

examples/pylab_examples/axhspan_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
plt.plot(t, s)
88
# draw a thick red hline at y=0 that spans the xrange
9-
l = plt.axhline(linewidth=4, color='r')
9+
l = plt.axhline(linewidth=8, color='#d62728')
1010

1111
# draw a default hline at y=1 that spans the xrange
1212
l = plt.axhline(y=1)
@@ -16,15 +16,15 @@
1616

1717
# draw a thick blue vline at x=0 that spans the upper quadrant of
1818
# the yrange
19-
l = plt.axvline(x=0, ymin=0.75, linewidth=4, color='b')
19+
l = plt.axvline(x=0, ymin=0.75, linewidth=8, color='#1f77b4')
2020

2121
# draw a default hline at y=.5 that spans the middle half of
2222
# the axes
2323
l = plt.axhline(y=.5, xmin=0.25, xmax=0.75)
2424

2525
p = plt.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5)
2626

27-
p = plt.axvspan(1.25, 1.55, facecolor='g', alpha=0.5)
27+
p = plt.axvspan(1.25, 1.55, facecolor='#2ca02c', alpha=0.5)
2828

2929
plt.axis([-1, 2, -1, 2])
3030

examples/pylab_examples/bar_stacked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ind = np.arange(N) # the x locations for the groups
1313
width = 0.35 # the width of the bars: can also be len(x) sequence
1414

15-
p1 = plt.bar(ind, menMeans, width, yerr=menStd)
15+
p1 = plt.bar(ind, menMeans, width, color='#d62728', yerr=menStd)
1616
p2 = plt.bar(ind, womenMeans, width,
1717
bottom=menMeans, yerr=womenStd)
1818

examples/pylab_examples/cohere_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2
2323

2424
plt.subplot(211)
25-
plt.plot(t, s1, 'b-', t, s2, 'g-')
25+
plt.plot(t, s1, t, s2)
2626
plt.xlim(0, 5)
2727
plt.xlabel('time')
2828
plt.ylabel('s1 and s2')

examples/pylab_examples/color_by_yvalue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
slower = np.ma.masked_where(s > lower, s)
1414
smiddle = np.ma.masked_where(np.logical_or(s < lower, s > upper), s)
1515

16-
plt.plot(t, slower, 'r', t, smiddle, 'b', t, supper, 'g')
16+
plt.plot(t, smiddle, t, slower, t, supper)
1717
plt.show()

examples/pylab_examples/csd_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2
2323

2424
plt.subplot(211)
25-
plt.plot(t, s1, 'b-', t, s2, 'g-')
25+
plt.plot(t, s1, t, s2)
2626
plt.xlim(0, 5)
2727
plt.xlabel('time')
2828
plt.ylabel('s1 and s2')

0 commit comments

Comments
 (0)