3 To draw bars side by side to show differences for the same value you basically
4 need to replace the bar axis by a nestedbar axis and adjust the data to that
5 nesting. ... The latter is done by providing a tuple of two values to the
6 nested bar axis instead of a single value. The first element of the tuple is
7 used to select a subaxis (in the present case: one out of twelve) of the
8 nestedbar axis. The second element of the tuple then selects a sub-axis of
9 that particular bar axis (here: one out of two).
11 ! You can replace `0` and `1` in the values provided to the xname parameter of
12 the data by other unique hashable objects. Note, however, that this does not
13 affect the order of the bars of the subaxis. Instead, the order is defined by
14 the order that data is added to the bar axis. Consequently, when you swap `0`
15 and `1` in the xname parameter nothing will change in the output. However, this
16 value becomes relevant if you turn on naming of the sub-axis by using
18 graph.axis.bar(defaultsubaxis=graph.axis.bar(dist=0))
20 instead of the `graph.axis.nestedbar` instance in the graph constructor.
22 !! You can also use the same values (i.e. objects with the same hash value) for
23 the subselection of the nested bar axis. Then the bars will overpaint each
24 other and by proper ordering of the data you can fake stacked bars by that. For
25 an description of how to do this properly, we refer to the [stacked.html Stack
26 bars on top of each other].
28 !! Let's suppose you change the values provided to the xname parameter of the
29 data from `"$1, 0"` and `"$1, 1"` to `"0, $1"` and `"1, $1"`, respectively. The
30 answer is, that all red bars will be shown on one subaxis and all blue bars
31 will be shown on another subaxis.
33 !! A nested bar axis is totally equivalent to a regular bar axis except for its
34 default value for the `defaultsubaxis` parameter in the constructor. While this
35 `defaultsubaxis` parameter is a special instance of a linear axis for the bar
36 axis, for a nestedbar axis its a special instance of another bar axis. The
37 nesting of bar axes is not limited to a single level: You can nest bar axes
38 into each other to any level you want. Providing explicit subaxes for certain
39 values, the nesting levels can even vary for the differen subaxes. (This is
42 ! In PyX versions prior to PyX 0.9 the creation of nested data for the bar axes
43 was hidden inside the graph styles (with the limitation as we use it here in
44 this example: adding precisely a single nesting level when passing multiple
45 data to a single set of styles). In previous versions we didn't had the
46 possibility to simply generate tuples for data columns. The automatism was
47 removed completely, which makes ''all'' the bended sections above possible.
48 This is a quite incompatible but absolutely necessary change.