|
27 | 27 | fig, ((ax0, ax1), (ax2, ax3)) = plt.subplots(nrows=2, ncols=2) |
28 | 28 |
|
29 | 29 | colors = ['red', 'tan', 'lime'] |
30 | | -ax0.hist(x, n_bins, density=True, histtype='bar', color=colors, label=colors) |
| 30 | +ax0.hist(x, n_bins, density=True, histtype='bar', color=colors, |
| 31 | + label=colors, hatch=['o', '*', '.'], |
| 32 | + edgecolor=['black', 'red', 'blue'], linewidth=[1, 2, 3]) |
31 | 33 | ax0.legend(prop={'size': 10}) |
32 | 34 | ax0.set_title('bars with legend') |
33 | 35 |
|
34 | | -ax1.hist(x, n_bins, density=True, histtype='bar', stacked=True) |
| 36 | +ax1.hist( |
| 37 | + x, n_bins, density=True, histtype="bar", stacked=True, |
| 38 | + edgecolor=["black", "yellow", "blue"]) |
35 | 39 | ax1.set_title('stacked bar') |
36 | 40 |
|
37 | | -ax2.hist(x, n_bins, histtype='step', stacked=True, fill=False) |
| 41 | +ax2.hist(x, n_bins, histtype='step', stacked=True, fill=False, |
| 42 | + linewidth=[1, 2, 3]) |
38 | 43 | ax2.set_title('stack step (unfilled)') |
39 | 44 |
|
40 | 45 | # Make a multiple-histogram of data-sets with different length. |
41 | 46 | x_multi = [np.random.randn(n) for n in [10000, 5000, 2000]] |
42 | | -ax3.hist(x_multi, n_bins, histtype='bar') |
| 47 | +ax3.hist(x_multi, n_bins, histtype='bar', hatch=['\\', '/', '-']) |
43 | 48 | ax3.set_title('different sample sizes') |
44 | 49 |
|
45 | 50 | fig.tight_layout() |
|
0 commit comments