|
28 | 28 | ############################################################################### |
29 | 29 | # Demonstrate how to toggle the display of different elements: |
30 | 30 |
|
31 | | -fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) |
32 | | -axes[0, 0].boxplot(data, labels=labels) |
33 | | -axes[0, 0].set_title('Default', fontsize=fs) |
| 31 | +fig, axs = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) |
| 32 | +axs[0, 0].boxplot(data, labels=labels) |
| 33 | +axs[0, 0].set_title('Default', fontsize=fs) |
34 | 34 |
|
35 | | -axes[0, 1].boxplot(data, labels=labels, showmeans=True) |
36 | | -axes[0, 1].set_title('showmeans=True', fontsize=fs) |
| 35 | +axs[0, 1].boxplot(data, labels=labels, showmeans=True) |
| 36 | +axs[0, 1].set_title('showmeans=True', fontsize=fs) |
37 | 37 |
|
38 | | -axes[0, 2].boxplot(data, labels=labels, showmeans=True, meanline=True) |
39 | | -axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) |
| 38 | +axs[0, 2].boxplot(data, labels=labels, showmeans=True, meanline=True) |
| 39 | +axs[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) |
40 | 40 |
|
41 | | -axes[1, 0].boxplot(data, labels=labels, showbox=False, showcaps=False) |
| 41 | +axs[1, 0].boxplot(data, labels=labels, showbox=False, showcaps=False) |
42 | 42 | tufte_title = 'Tufte Style \n(showbox=False,\nshowcaps=False)' |
43 | | -axes[1, 0].set_title(tufte_title, fontsize=fs) |
| 43 | +axs[1, 0].set_title(tufte_title, fontsize=fs) |
44 | 44 |
|
45 | | -axes[1, 1].boxplot(data, labels=labels, notch=True, bootstrap=10000) |
46 | | -axes[1, 1].set_title('notch=True,\nbootstrap=10000', fontsize=fs) |
| 45 | +axs[1, 1].boxplot(data, labels=labels, notch=True, bootstrap=10000) |
| 46 | +axs[1, 1].set_title('notch=True,\nbootstrap=10000', fontsize=fs) |
47 | 47 |
|
48 | | -axes[1, 2].boxplot(data, labels=labels, showfliers=False) |
49 | | -axes[1, 2].set_title('showfliers=False', fontsize=fs) |
| 48 | +axs[1, 2].boxplot(data, labels=labels, showfliers=False) |
| 49 | +axs[1, 2].set_title('showfliers=False', fontsize=fs) |
50 | 50 |
|
51 | | -for ax in axes.flat: |
| 51 | +for ax in axs.flat: |
52 | 52 | ax.set_yscale('log') |
53 | 53 | ax.set_yticklabels([]) |
54 | 54 |
|
|
67 | 67 | markerfacecolor='firebrick') |
68 | 68 | meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') |
69 | 69 |
|
70 | | -fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) |
71 | | -axes[0, 0].boxplot(data, boxprops=boxprops) |
72 | | -axes[0, 0].set_title('Custom boxprops', fontsize=fs) |
| 70 | +fig, axs = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) |
| 71 | +axs[0, 0].boxplot(data, boxprops=boxprops) |
| 72 | +axs[0, 0].set_title('Custom boxprops', fontsize=fs) |
73 | 73 |
|
74 | | -axes[0, 1].boxplot(data, flierprops=flierprops, medianprops=medianprops) |
75 | | -axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) |
| 74 | +axs[0, 1].boxplot(data, flierprops=flierprops, medianprops=medianprops) |
| 75 | +axs[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) |
76 | 76 |
|
77 | | -axes[0, 2].boxplot(data, whis='range') |
78 | | -axes[0, 2].set_title('whis="range"', fontsize=fs) |
| 77 | +axs[0, 2].boxplot(data, whis='range') |
| 78 | +axs[0, 2].set_title('whis="range"', fontsize=fs) |
79 | 79 |
|
80 | | -axes[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False, |
81 | | - showmeans=True) |
82 | | -axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) |
| 80 | +axs[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False, |
| 81 | + showmeans=True) |
| 82 | +axs[1, 0].set_title('Custom mean\nas point', fontsize=fs) |
83 | 83 |
|
84 | | -axes[1, 1].boxplot(data, meanprops=meanlineprops, meanline=True, |
85 | | - showmeans=True) |
86 | | -axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) |
| 84 | +axs[1, 1].boxplot(data, meanprops=meanlineprops, meanline=True, |
| 85 | + showmeans=True) |
| 86 | +axs[1, 1].set_title('Custom mean\nas line', fontsize=fs) |
87 | 87 |
|
88 | | -axes[1, 2].boxplot(data, whis=[15, 85]) |
89 | | -axes[1, 2].set_title('whis=[15, 85]\n#percentiles', fontsize=fs) |
| 88 | +axs[1, 2].boxplot(data, whis=[15, 85]) |
| 89 | +axs[1, 2].set_title('whis=[15, 85]\n#percentiles', fontsize=fs) |
90 | 90 |
|
91 | | -for ax in axes.flat: |
| 91 | +for ax in axs.flat: |
92 | 92 | ax.set_yscale('log') |
93 | 93 | ax.set_yticklabels([]) |
94 | 94 |
|
|
0 commit comments