@@ -15,36 +15,36 @@ when the input *x* has multiple datasets.
15
15
uses different edgecolors, and ax4 uses different facecolors. Edgecolors have
16
16
ax1 and ax3 as well to accentuate the differences between the histograms.
17
17
18
- import matplotlib.pyplot as plt
19
- import numpy as np
20
- np.random.seed(19680801)
18
+ import matplotlib.pyplot as plt
19
+ import numpy as np
20
+ np.random.seed(19680801)
21
21
22
- fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(9, 9))
22
+ fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(9, 9))
23
23
24
- data1 = np.random.poisson(5, 1000)
25
- data2 = np.random.poisson(7, 1000)
26
- data3 = np.random.poisson(10, 1000)
24
+ data1 = np.random.poisson(5, 1000)
25
+ data2 = np.random.poisson(7, 1000)
26
+ data3 = np.random.poisson(10, 1000)
27
27
28
- labels = ["Data 1", "Data 2", "Data 3"]
28
+ labels = ["Data 1", "Data 2", "Data 3"]
29
29
30
- ax1.hist([data1, data2, data3], bins=range(17), histtype="step", stacked=True,
30
+ ax1.hist([data1, data2, data3], bins=range(17), histtype="step", stacked=True,
31
31
edgecolor=["red", "green", "blue"], linewidth=[1, 2, 3])
32
- ax1.set_title("Different linewidths")
33
- ax1.legend(labels)
32
+ ax1.set_title("Different linewidths")
33
+ ax1.legend(labels)
34
34
35
- ax2.hist([data1, data2, data3], bins=range(17), histtype="barstacked",
35
+ ax2.hist([data1, data2, data3], bins=range(17), histtype="barstacked",
36
36
hatch=["/", ".", "*"])
37
- ax2.set_title("Different hatch patterns")
38
- ax2.legend(labels)
37
+ ax2.set_title("Different hatch patterns")
38
+ ax2.legend(labels)
39
39
40
- ax3.hist([data1, data2, data3], bins=range(17), histtype="bar", fill=False,
40
+ ax3.hist([data1, data2, data3], bins=range(17), histtype="bar", fill=False,
41
41
edgecolor=["red", "green", "blue"], linestyle=["--", "-.", ":"])
42
- ax3.set_title("Different linestyles")
43
- ax3.legend(labels)
42
+ ax3.set_title("Different linestyles")
43
+ ax3.legend(labels)
44
44
45
- ax4.hist([data1, data2, data3], bins=range(17), histtype="barstacked",
45
+ ax4.hist([data1, data2, data3], bins=range(17), histtype="barstacked",
46
46
facecolor=["red", "green", "blue"])
47
- ax4.set_title("Different facecolors")
48
- ax4.legend(labels)
47
+ ax4.set_title("Different facecolors")
48
+ ax4.legend(labels)
49
49
50
- plt.show()
50
+ plt.show()
0 commit comments