Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39d276f

Browse files
committed
FIX: made style smaller, fixed formatting, changed cycle order
1 parent 20fbf36 commit 39d276f

24 files changed

+97
-85
lines changed
Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
# from the Matplotlib cheatsheet as used in our gallery:
22

3-
4-
axes.facecolor: white
5-
axes.edgecolor: black
6-
axes.linewidth: 1.0
73
axes.grid: True
8-
axes.axisbelow: True # grid/ticks are below elements (e.g., lines, text)
9-
10-
xtick.color: 555555
11-
xtick.direction: out
12-
13-
ytick.color: 555555
14-
ytick.direction: out
15-
16-
grid.color: b0b0b0
17-
grid.linewidth: 0.7
18-
grid.linestyle: - # solid line
4+
axes.axisbelow: True
195

20-
figure.facecolor: white
216
figure.figsize: 2, 2
227
# make it so the axes labels don't show up. Obviously
238
# not good style for any quantitative analysis:
@@ -26,3 +11,6 @@ figure.subplot.right: 0.99
2611
figure.subplot.bottom: 0.01
2712
figure.subplot.top: 0.99
2813

14+
# colors:
15+
image.cmap : Oranges
16+
axes.prop_cycle : cycler('color', ['ff7f0e', '1f77b4', '2ca02c'])

plot_types/A_basic/a_plot.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
ax.plot(X, Y, color="C1", linewidth=2.0)
19-
20-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
21-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
18+
ax.plot(X, Y, linewidth=2.0)
2219

20+
ax.set_xlim(0, 8)
21+
ax.set_xticks(np.arange(1, 8))
22+
ax.set_ylim(0, 8)
23+
ax.set_yticks(np.arange(1, 8))
2324
plt.show()

plot_types/A_basic/b_scatter.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
fig, ax = plt.subplots()
1717

1818
ax.scatter(X, Y, 20, zorder=10,
19-
edgecolor="none", facecolor="C1", linewidth=0.25)
19+
edgecolor="none", linewidth=0.25)
2020

21-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
22-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
21+
ax.set_xlim(0, 8)
22+
ax.set_xticks(np.arange(1, 8))
23+
ax.set_ylim(0, 8)
24+
ax.set_yticks(np.arange(1, 8))
2325

2426
plt.show()

plot_types/A_basic/c_bar.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
ax.bar(X, Y, bottom=0, width=1, edgecolor="white",
19-
facecolor="C1", linewidth=0.7)
18+
ax.bar(X, Y, bottom=0, width=1, edgecolor="white", linewidth=0.7)
2019

21-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
22-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
20+
ax.set_xlim(0, 8)
21+
ax.set_xticks(np.arange(1, 8))
22+
ax.set_ylim(0, 8)
23+
ax.set_yticks(np.arange(1, 8))
2324

2425
plt.show()

plot_types/A_basic/d_stem.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
ax.stem(X, Y, bottom=0, linefmt="C1-", markerfmt="C1d")
18+
ax.stem(X, Y, bottom=0, linefmt="-", markerfmt="d")
1919

20-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
21-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
20+
ax.set_xlim(0, 8)
21+
ax.set_xticks(np.arange(1, 8))
22+
ax.set_ylim(0, 8)
23+
ax.set_yticks(np.arange(1, 8))
2224
plt.show()

plot_types/A_basic/e_step.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
ax.step(X, Y, color="C1", linewidth=2.5)
18+
ax.step(X, Y, linewidth=2.5)
1919

20-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
21-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
20+
ax.set_xlim(0, 8)
21+
ax.set_xticks(np.arange(1, 8))
22+
ax.set_ylim(0, 8)
23+
ax.set_yticks(np.arange(1, 8))
2224
plt.show()

plot_types/A_basic/f_pie.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,25 @@
77
import matplotlib.pyplot as plt
88
import numpy as np
99

10-
# make data
11-
X = [1, 2, 3, 4]
12-
colors = np.zeros((len(X), 4))
13-
colors[:] = mpl.colors.to_rgba("C1")
14-
colors[:, 3] = np.linspace(0.25, 0.75, len(X))
1510

1611
# plot
1712
with plt.style.context('cheatsheet_gallery'):
1813
fig, ax = plt.subplots()
14+
15+
# make data
16+
X = [1, 2, 3, 4]
17+
colors = np.zeros((len(X), 4))
18+
colors[:] = mpl.colors.to_rgba("C0")
19+
colors[:, 3] = np.linspace(0.25, 0.75, len(X))
1920

2021
ax.pie(X, colors=["white"]*len(X), radius=3, center=(4, 4),
2122
wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True)
2223
ax.pie(X, colors=colors, radius=3, center=(4, 4),
2324
wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True)
2425

25-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
26-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
26+
ax.set_xlim(0, 8)
27+
ax.set_xticks(np.arange(1, 8))
28+
ax.set_ylim(0, 8)
29+
ax.set_yticks(np.arange(1, 8))
2730

2831
plt.show()

plot_types/A_basic/g_fill_between.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
with plt.style.context('cheatsheet_gallery'):
1717
fig, ax = plt.subplots()
1818

19-
ax.fill_between(X, Y1, Y2, color="C1", alpha=.5, linewidth=0)
20-
ax.plot(X, (Y1+Y2)/2, color="C1", linewidth=2.5)
19+
ax.fill_between(X, Y1, Y2, alpha=.5, linewidth=0)
20+
ax.plot(X, (Y1+Y2)/2, linewidth=2.5)
2121

22-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
23-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
22+
ax.set_xlim(0, 8)
23+
ax.set_xticks(np.arange(1, 8))
24+
ax.set_ylim(0, 8)
25+
ax.set_yticks(np.arange(1, 8))
2426

2527
plt.show()

plot_types/B_arrays/a_imshow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
ax.imshow(Z, extent=[0, 8, 0, 8], interpolation="nearest",
2121
cmap=plt.get_cmap('Oranges'), vmin=0, vmax=1.6)
2222

23-
ax.set_xlim(0, 8), ax.set_xticks([])
24-
ax.set_ylim(0, 8), ax.set_yticks([])
23+
ax.set_xticks([])
24+
ax.set_yticks([])
2525
plt.show()

plot_types/B_arrays/b_pcolormesh.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@
1010
import matplotlib.pyplot as plt
1111
import numpy as np
1212

13-
# make data:
14-
np.random.seed(3)
15-
Z = np.random.uniform(0.1, 1.0, (8, 8))
16-
x = np.array([0, 0.5, 1.5, 3, 5.2, 6.3, 7.2, 7.5, 8])
17-
y = 1.2**np.arange(0, 9)
13+
# make data
14+
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
15+
Z = (1 - X/2. + X**5 + Y**3) * np.exp(-X**2 - Y**2)
16+
Z = Z - Z.min()
1817

1918
# plot
2019
with plt.style.context('cheatsheet_gallery'):
2120
fig, ax = plt.subplots()
2221

2322
# plot:
24-
ax.pcolormesh(x, y, Z, cmap=plt.get_cmap('Oranges'), vmin=0, vmax=1.1)
23+
ax.pcolormesh(X, Y, Z, vmin=0, vmax=1.1)
2524

26-
ax.set_ylim(1, np.max(y))
27-
ax.set_xlim(np.min(x), np.max(x))
25+
#ax.set_ylim(np.min(Y), np.max(Y))
26+
#ax.set_xlim(np.min(X), np.max(X))
2827
plt.show()

plot_types/B_arrays/c_contourf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
with plt.style.context('cheatsheet_gallery'):
1717
fig, ax = plt.subplots()
1818

19-
plt.contourf(X, Y, Z, levels=levs, cmap=plt.get_cmap('Oranges'))
19+
plt.contourf(X, Y, Z, levels=levs)
2020
plt.contour(X, Y, Z, levels=levs, colors="white", linewidths=0.5)
2121

2222
plt.show()

plot_types/B_arrays/d_quiver.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
plt.quiver(X, Y, U, V, color="C1", angles='xy',
18+
plt.quiver(X, Y, U, V, color="C0", angles='xy',
1919
scale_units='xy', scale=0.5, width=.05)
2020

21-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
22-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
21+
ax.set_xlim(0, 8)
22+
ax.set_xticks(np.arange(1, 8))
23+
ax.set_ylim(0, 8)
24+
ax.set_yticks(np.arange(1, 8))
2325

2426
plt.show()

plot_types/B_arrays/e_streamplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
with plt.style.context('cheatsheet_gallery'):
1919
fig, ax = plt.subplots()
2020
# contour stream function
21-
ax.contour(X, Y, Z, colors='C0', alpha=0.5, zorder=1, linewidths=3)
21+
ax.contour(X, Y, Z, colors='C1', alpha=0.5, zorder=1, linewidths=3)
2222
# plot stream plot
23-
ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V, color='C1', zorder=2)
23+
ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V, zorder=2)
2424

2525
plt.show()

plot_types/C_stats/a_hist.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
with plt.style.context('cheatsheet_gallery'):
1515
fig, ax = plt.subplots()
1616

17-
ax.hist(X, bins=8, facecolor="C1", linewidth=0.5, edgecolor="white",)
17+
ax.hist(X, bins=8, linewidth=0.5, edgecolor="white",)
1818

19-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
20-
ax.set_ylim(0, 80), ax.set_yticks(np.arange(1, 80, 10))
19+
ax.set_xlim(0, 8)
20+
ax.set_xticks(np.arange(1, 8))
21+
ax.set_ylim(0, 80)
22+
ax.set_yticks(np.arange(1, 80, 10))
2123

2224
plt.show()

plot_types/C_stats/b_boxplot.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@
1313
# plot
1414
with plt.style.context('cheatsheet_gallery'):
1515
fig, ax = plt.subplots()
16-
16+
orange = '#ff7f0e'
1717
VP = ax.boxplot(D, positions=[2, 4, 6], widths=1.5, patch_artist=True,
1818
showmeans=False, showfliers=False,
1919
medianprops={"color": "white",
2020
"linewidth": 0.5},
21-
boxprops={"facecolor": "C1",
21+
boxprops={"facecolor": orange,
2222
"edgecolor": "white",
2323
"linewidth": 0.5},
24-
whiskerprops={"color": "C1",
24+
whiskerprops={"color": orange,
2525
"linewidth": 1.5},
26-
capprops={"color": "C1",
26+
capprops={"color": orange,
2727
"linewidth": 1.5})
2828

29-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
30-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
29+
ax.set_xlim(0, 8)
30+
ax.set_xticks(np.arange(1, 8))
31+
ax.set_ylim(0, 8)
32+
ax.set_yticks(np.arange(1, 8))
3133

3234
plt.show()

plot_types/C_stats/c_errorbar.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
ax.errorbar(X, Y, E, color="C1", linewidth=2, capsize=6)
2020

21-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
22-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
21+
ax.set_xlim(0, 8)
22+
ax.set_xticks(np.arange(1, 8))
23+
ax.set_ylim(0, 8)
24+
ax.set_yticks(np.arange(1, 8))
2325

2426
plt.show()

plot_types/C_stats/d_violin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
showmeans=False, showmedians=False, showextrema=False)
1919
#style:
2020
for body in VP['bodies']:
21-
body.set_facecolor('C1')
2221
body.set_alpha(0.9)
2322

24-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
25-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
23+
ax.set_xlim(0, 8)
24+
ax.set_xticks(np.arange(1, 8))
25+
ax.set_ylim(0, 8)
26+
ax.set_yticks(np.arange(1, 8))
2627

2728
plt.show()

plot_types/C_stats/e_barbs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
ax.barbs(X, Y, U, V, barbcolor="C1", flagcolor="C1",
2121
length=10, linewidth=1.5)
2222

23-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
24-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
23+
ax.set_xlim(0, 8)
24+
ax.set_xticks(np.arange(1, 8))
25+
ax.set_ylim(0, 8)
26+
ax.set_yticks(np.arange(1, 8))
2527

2628
plt.show()

plot_types/C_stats/f_eventplot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
ax.eventplot(D, colors="C1", orientation="vertical",
18+
ax.eventplot(D, colors="C0", orientation="vertical",
1919
lineoffsets=X, linewidth=0.75)
2020

21-
ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8))
22-
ax.set_ylim(0, 8), ax.set_yticks(np.arange(1, 8))
21+
ax.set_xlim(0, 8)
22+
ax.set_xticks(np.arange(1, 8))
23+
ax.set_ylim(0, 8)
24+
ax.set_yticks(np.arange(1, 8))
2325

2426
plt.show()

plot_types/C_stats/g_hist2d.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
ax.hist2d(x, y, bins=(np.arange(-3, 3, 0.1), np.arange(-3, 3, 0.1)),
19-
cmap=plt.get_cmap('Oranges'))
18+
ax.hist2d(x, y, bins=(np.arange(-3, 3, 0.1), np.arange(-3, 3, 0.1)))
2019

2120
ax.set_xlim(-2, 2)
2221
ax.set_ylim(-3, 3)

plot_types/C_stats/h_hexbin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
with plt.style.context('cheatsheet_gallery'):
1616
fig, ax = plt.subplots()
1717

18-
ax.hexbin(x, y, gridsize=20, cmap=plt.get_cmap('Oranges'))
18+
ax.hexbin(x, y, gridsize=20)
1919

2020
ax.set_xlim(-2, 2)
2121
ax.set_ylim(-3, 3)

plot_types/D_unstructured/a_tricontour.py

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

2626
ax.plot(x, y, '.k', alpha=0.5)
2727
levs = np.linspace(np.min(Z), np.max(Z), 7)
28-
ax.tricontourf(x, y, z, levels=levs, cmap=plt.get_cmap('Oranges'))
28+
ax.tricontourf(x, y, z, levels=levs)
2929

3030
ax.set_xlim(-3, 3)
3131
ax.set_ylim(-3, 3)

plot_types/D_unstructured/b_tripcolor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
fig, ax = plt.subplots()
2525

2626
ax.plot(x, y, '.k', alpha=0.5)
27-
ax.tripcolor(x, y, z, cmap=plt.get_cmap('Oranges'))
27+
ax.tripcolor(x, y, z)
2828

2929
ax.set_xlim(-3, 3)
3030
ax.set_ylim(-3, 3)

plot_types/D_unstructured/c_triplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
with plt.style.context('cheatsheet_gallery'):
2121
fig, ax = plt.subplots()
2222

23-
ax.triplot(x, y, color='C1')
23+
ax.triplot(x, y)
2424

2525
ax.set_xlim(-3, 3)
2626
ax.set_ylim(-3, 3)

0 commit comments

Comments
 (0)