|
1 | 1 | """Box plots with custom fill colors. |
2 | 2 |
|
3 | | -This plot illustrates how to create two types of boxplots |
| 3 | +This plot illustrates how to create two types of box plots |
4 | 4 | (rectangular and notched), and how to fill them with custom |
5 | 5 | colors by accessing the properties of the artists of the |
6 | | -boxplots. Additionally, the ``labels`` parameter is used to |
| 6 | +box plots. Additionally, the ``labels`` parameter is used to |
7 | 7 | provide x-tick labels for each sample. |
8 | 8 | """ |
9 | 9 |
|
|
19 | 19 |
|
20 | 20 | # rectangular box plot |
21 | 21 | bplot1 = axes[0].boxplot(all_data, |
22 | | - vert=True, # vertical box aligmnent |
| 22 | + vert=True, # vertical box alignment |
23 | 23 | patch_artist=True, # fill with color |
24 | 24 | labels=labels) # will be used to label x-ticks |
| 25 | +axes[0].set_title('Rectangular box plot') |
25 | 26 |
|
26 | 27 | # notch shape box plot |
27 | 28 | bplot2 = axes[1].boxplot(all_data, |
28 | 29 | notch=True, # notch shape |
29 | | - vert=True, # vertical box aligmnent |
| 30 | + vert=True, # vertical box alignment |
30 | 31 | patch_artist=True, # fill with color |
31 | 32 | labels=labels) # will be used to label x-ticks |
| 33 | +axes[1].set_title('Notched box plot') |
32 | 34 |
|
33 | 35 | # fill with colors |
34 | 36 | colors = ['pink', 'lightblue', 'lightgreen'] |
|
39 | 41 | # adding horizontal grid lines |
40 | 42 | for ax in axes: |
41 | 43 | ax.yaxis.grid(True) |
42 | | - ax.set_xlabel('Three Separate Samples') |
| 44 | + ax.set_xlabel('Three separate samples') |
43 | 45 | ax.set_ylabel('Observed values') |
44 | 46 |
|
45 | 47 | plt.show() |
0 commit comments