Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/api/collections_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
yo = rs.randn(npts)
xyo = list(zip(xo, yo))

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

fig, axes = plt.subplots(2, 2)
((ax1, ax2), (ax3, ax4)) = axes # unpack the axes
Expand Down
2 changes: 1 addition & 1 deletion examples/api/filled_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
hist_func = partial(np.histogram, bins=edges)

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

Expand Down
2 changes: 1 addition & 1 deletion examples/pie_and_polar_charts/polar_bar_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Use custom colors and opacity
for r, bar in zip(radii, bars):
bar.set_facecolor(plt.cm.jet(r / 10.))
bar.set_facecolor(plt.cm.viridis(r / 10.))
bar.set_alpha(0.5)

plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/anchored_artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, transform, size, label, loc,
sep in points.
"""
self.size_bar = AuxTransformBox(transform)
self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none"))
self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none", lw=1.0))

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

Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/axes_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
line.set_linewidth(3)

for line in gridlines:
line.set_linestyle('-')
line.set_linestyle('-.')

for label in ticklabels:
label.set_color('r')
Expand Down
6 changes: 3 additions & 3 deletions examples/pylab_examples/axhspan_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

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

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

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/bar_stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars: can also be len(x) sequence

p1 = plt.bar(ind, menMeans, width, yerr=menStd)
p1 = plt.bar(ind, menMeans, width, color='#d62728', yerr=menStd)
p2 = plt.bar(ind, womenMeans, width,
bottom=menMeans, yerr=womenStd)

Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/cohere_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2

plt.subplot(211)
plt.plot(t, s1, 'b-', t, s2, 'g-')
plt.plot(t, s1, t, s2)
plt.xlim(0, 5)
plt.xlabel('time')
plt.ylabel('s1 and s2')
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/color_by_yvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
slower = np.ma.masked_where(s > lower, s)
smiddle = np.ma.masked_where(np.logical_or(s < lower, s > upper), s)

plt.plot(t, slower, 'r', t, smiddle, 'b', t, supper, 'g')
plt.plot(t, smiddle, t, slower, t, supper)
plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/csd_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2

plt.subplot(211)
plt.plot(t, s1, 'b-', t, s2, 'g-')
plt.plot(t, s1, t, s2)
plt.xlim(0, 5)
plt.xlabel('time')
plt.ylabel('s1 and s2')
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/figimage_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Z.shape = 100, 100
Z[:, 50:] = 1.

im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower')
im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower')
im1 = plt.figimage(Z, xo=50, yo=0, origin='lower')
im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, origin='lower')

plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/hist_colormapped.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
norm = colors.Normalize(fracs.min(), fracs.max())

for thisfrac, thispatch in zip(fracs, patches):
color = cm.jet(norm(thisfrac))
color = cm.viridis(norm(thisfrac))
thispatch.set_facecolor(color)


Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/image_origin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
lim = -2, 11, -2, 6
plt.subplot(211, facecolor='g')
plt.title('blue should be up')
plt.imshow(x, origin='upper', interpolation=interp, cmap='jet')
plt.imshow(x, origin='upper', interpolation=interp)
#plt.axis(lim)

plt.subplot(212, facecolor='y')
plt.title('blue should be down')
plt.imshow(x, origin='lower', interpolation=interp, cmap='jet')
plt.imshow(x, origin='lower', interpolation=interp)
#plt.axis(lim)
plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/interp_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
yi = stineman_interp(xi, x, y, yp)

fig, ax = plt.subplots()
ax.plot(x, y, 'ro', xi, yi, '-b.')
ax.plot(x, y, 'o', xi, yi, '.')
plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/layer_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def func3(x, y):

Z2 = func3(X, Y)

im2 = plt.imshow(Z2, cmap=plt.cm.jet, alpha=.9, interpolation='bilinear',
im2 = plt.imshow(Z2, cmap=plt.cm.viridis, alpha=.9, interpolation='bilinear',
extent=extent)

plt.show()
4 changes: 2 additions & 2 deletions examples/pylab_examples/leftventricle_bulleye.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):
data = np.array(data).ravel()

if cmap is None:
cmap = plt.cm.jet
cmap = plt.cm.viridis

if norm is None:
norm = mpl.colors.Normalize(vmin=data.min(), vmax=data.max())
Expand Down Expand Up @@ -142,7 +142,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):

# Set the colormap and norm to correspond to the data for which
# the colorbar will be used.
cmap = mpl.cm.jet
cmap = mpl.cm.viridis
norm = mpl.colors.Normalize(vmin=1, vmax=17)

# ColorbarBase derives from ScalarMappable and puts a colorbar
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/legend_demo5.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_artists(self, legend, orig_handle,
x = np.linspace(0, 5, 100)

plt.figure()
colors = ['red', 'orange', 'yellow', 'green', 'blue']
colors = plt.rcParams['axes.prop_cycle'].by_key()['color'][:5]
styles = ['solid', 'dashed', 'dashed', 'dashed', 'solid']
lines = []
for i, color, style in zip(range(5), colors, styles):
Expand Down
3 changes: 2 additions & 1 deletion examples/pylab_examples/line_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
# where onoffseq is an even length tuple of on and off ink in points.
# If linestyle is omitted, 'solid' is used
# See matplotlib.collections.LineCollection for more information
colors = [colorConverter.to_rgba(i) for i in 'bgrcmyk']
colors = [colorConverter.to_rgba(c)
for c in plt.rcParams['axes.prop_cycle'].by_key()['color']]

line_segments = LineCollection(segs, linewidths=(0.5, 1, 1.5, 2),
colors=colors, linestyle='solid')
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/masked_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ym1 = np.ma.masked_where(y1 > 0.5, y1)
ym2 = np.ma.masked_where(y2 < -0.5, y2)

lines = plt.plot(x, y, 'r', x, ym1, 'g', x, ym2, 'bo')
lines = plt.plot(x, y, x, ym1, x, ym2, 'o')
plt.setp(lines[0], linewidth=4)
plt.setp(lines[1], linewidth=2)
plt.setp(lines[2], markersize=10)
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/multiline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
plt.xticks([0.2, 0.4, 0.6, 0.8, 1.],
["Jan\n2009", "Feb\n2009", "Mar\n2009", "Apr\n2009", "May\n2009"])

plt.axhline(0.7)
plt.axhline(0.4)
plt.title("test line spacing for multiline text")

plt.subplots_adjust(bottom=0.25, top=0.75)
Expand Down
6 changes: 3 additions & 3 deletions examples/pylab_examples/quadmesh_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

ax = fig.add_subplot(122)
# You can control the color of the masked region:
#cmap = cm.jet
#cmap.set_bad('r', 1.0)
#ax.pcolormesh(Qx,Qz,Zm, cmap=cmap)
# cmap = cm.RdBu
# cmap.set_bad('y', 1.0)
# ax.pcolormesh(Qx, Qz, Zm, cmap=cmap)
# Or use the default, which is transparent:
col = ax.pcolormesh(Qx, Qz, Zm, shading='gouraud')
ax.set_title('With masked values')
Expand Down
1 change: 0 additions & 1 deletion examples/pylab_examples/stem_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

x = np.linspace(0.1, 2*np.pi, 10)
markerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.')
plt.setp(markerline, 'markerfacecolor', 'b')
plt.setp(baseline, 'color', 'r', 'linewidth', 2)

plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/stock_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
d1, p1, d2, p2 = get_two_stock_data()

fig, ax = plt.subplots()
lines = plt.plot(d1, p1, 'bs', d2, p2, 'go')
lines = plt.plot(d1, p1, 's', d2, p2, 'o')
plt.xlabel('Days')
plt.ylabel('Normalized price')
plt.xlim(0, 3)
Expand Down
12 changes: 11 additions & 1 deletion examples/pylab_examples/subplots_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@
plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False)

# Four polar axes
plt.subplots(2, 2, subplot_kw=dict(projection='polar'))
f, axarr = plt.subplots(2, 2, subplot_kw=dict(projection='polar'))
axarr[0, 0].plot(x, y)
axarr[0, 0].set_title('Axis [0,0]')
axarr[0, 1].scatter(x, y)
axarr[0, 1].set_title('Axis [0,1]')
axarr[1, 0].plot(x, y ** 2)
axarr[1, 0].set_title('Axis [1,0]')
axarr[1, 1].scatter(x, y ** 2)
axarr[1, 1].set_title('Axis [1,1]')
# Fine-tune figure; make subplots farther from each other.
f.subplots_adjust(hspace=0.3)

plt.show()
4 changes: 2 additions & 2 deletions examples/pylab_examples/vline_hline_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def f(t):
vax = fig.add_subplot(121)
hax = fig.add_subplot(122)

vax.plot(t, s + nse, 'b^')
vax.plot(t, s + nse, '^')
vax.vlines(t, [0], s)
vax.set_xlabel('time (s)')
vax.set_title('Vertical lines demo')

hax.plot(s + nse, t, 'b^')
hax.plot(s + nse, t, '^')
hax.hlines(t, [0], s, lw=2)
hax.set_xlabel('time (s)')
hax.set_title('Horizontal lines demo')
Expand Down
2 changes: 1 addition & 1 deletion examples/specialty_plots/advanced_hillshading.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def shade_other_data():
z2 = np.cos(x**2 + y**2) # Data to color

norm = Normalize(z2.min(), z2.max())
cmap = plt.cm.jet
cmap = plt.cm.RdBu

ls = LightSource(315, 45)
rgb = ls.shade_rgb(cmap(norm(z2)), z1)
Expand Down
2 changes: 1 addition & 1 deletion examples/style_sheets/plot_dark_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

L = 6
x = np.linspace(0, L)
ncolors = len(plt.rcParams['axes.color_cycle'])
ncolors = len(plt.rcParams['axes.prop_cycle'])
shift = np.linspace(0, L, ncolors, endpoint=False)
for s in shift:
plt.plot(x, np.sin(x + s), 'o-')
Expand Down
9 changes: 5 additions & 4 deletions examples/style_sheets/plot_ggplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# sinusoidal lines with colors from default color cycle
L = 2*np.pi
x = np.linspace(0, L)
ncolors = len(plt.rcParams['axes.color_cycle'])
ncolors = len(plt.rcParams['axes.prop_cycle'])
shift = np.linspace(0, L, ncolors, endpoint=False)
for s in shift:
ax2.plot(x, np.sin(x + s), '-')
Expand All @@ -36,14 +36,15 @@
y1, y2 = np.random.randint(1, 25, size=(2, 5))
width = 0.25
ax3.bar(x, y1, width)
ax3.bar(x + width, y2, width, color=plt.rcParams['axes.color_cycle'][2])
ax3.bar(x + width, y2, width,
color=list(plt.rcParams['axes.prop_cycle'])[2]['color'])
ax3.set_xticks(x + width)
ax3.set_xticklabels(['a', 'b', 'c', 'd', 'e'])

# circles with colors from default color cycle
for i, color in enumerate(plt.rcParams['axes.color_cycle']):
for i, color in enumerate(plt.rcParams['axes.prop_cycle']):
xy = np.random.normal(size=2)
ax4.add_patch(plt.Circle(xy, radius=0.3, color=color))
ax4.add_patch(plt.Circle(xy, radius=0.3, color=color['color']))
ax4.axis('equal')
ax4.margins(0)

Expand Down
2 changes: 1 addition & 1 deletion examples/style_sheets/plot_grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def color_cycle_example(ax):
L = 6
x = np.linspace(0, L)
ncolors = len(plt.rcParams['axes.color_cycle'])
ncolors = len(plt.rcParams['axes.prop_cycle'])
shift = np.linspace(0, L, ncolors, endpoint=False)
for s in shift:
ax.plot(x, np.sin(x + s), 'o-')
Expand Down
2 changes: 1 addition & 1 deletion examples/user_interfaces/embedding_in_wx3.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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.RdBu) # , interpolation='nearest')

zmax = np.amax(z) - ERR_TOL
ymax_i, xmax_i = np.nonzero(z >= zmax)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy