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

Lines changed: 97 additions & 85 deletions
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()

0 commit comments

Comments
 (0)