|
3 | 3 | Grouped bar chart
|
4 | 4 | =================
|
5 | 5 |
|
6 |
| -This example serves to develop and discuss the API. It's geared towards illustating |
| 6 | +This example serves to showcase and discuss the API. It's geared towards illustating |
7 | 7 | API usage and design decisions only through the development phase. It's not intended
|
8 | 8 | to go into the final PR in this form.
|
9 | 9 |
|
| 10 | +Input data formats |
| 11 | +================== |
| 12 | +
|
10 | 13 | Case 1: multiple separate datasets
|
11 | 14 | ----------------------------------
|
12 | 15 |
|
|
36 | 39 | # note also that this is a straight-forward generalization of the single-dataset case:
|
37 | 40 | # bar(x, data1, label="data1")
|
38 | 41 | axs[1].grouped_bar(x, [data1, data2, data3], labels=["data1", "data2", "data3"])
|
| 42 | +axs[1].legend() |
39 | 43 |
|
40 | 44 |
|
41 | 45 | # %%
|
|
58 | 62 |
|
59 | 63 | # explicitly extract values and labels from a dict and feed to grouped_bar():
|
60 | 64 | axs[0].grouped_bar(x, datasets.values(), labels=datasets.keys())
|
| 65 | +axs[0].legend() |
61 | 66 | # accepting a dict as input
|
62 | 67 | axs[1].grouped_bar(x, datasets)
|
| 68 | +axs[1].legend() |
63 | 69 |
|
64 | 70 | # %%
|
65 | 71 | # Case 2: 2D array data
|
|
122 | 128 |
|
123 | 129 | # %%
|
124 | 130 | # Bar width and spacing
|
125 |
| -# --------------------- |
| 131 | +# ===================== |
126 | 132 | # The center positions of the bar groups are given by x. We can still choose
|
127 | 133 | # two of the following properties: bar width, spacing between groups, and
|
128 | 134 | # spacing between bars.
|
|
147 | 153 |
|
148 | 154 | # %%
|
149 | 155 | # Styling
|
150 |
| -# ------- |
| 156 | +# ======= |
151 | 157 | # The bars can be styled through additional keyword arguments. Currently,
|
152 | 158 | # the only per-dataset setting is ``colors``. Additionally, all
|
153 | 159 | # `.Rectangle` parameters are passed through and applied to all datasets.
|
|
166 | 172 |
|
167 | 173 | # %%
|
168 | 174 | # Horizontal grouped bars
|
169 |
| -# ----------------------- |
| 175 | +# ======================= |
170 | 176 | # Use ``orientation="horizontal"`` to create horizontal grouped bar charts.
|
171 | 177 |
|
172 | 178 | x = ['A', 'B', 'C']
|
|
0 commit comments