`color classes <{filename}/css/components.rst#colors>`_ and you can either
use one color for all or one for each value, separated by whitespace. Bar chart
height is calculated automatically based on amount of values, you can adjust
-the bar height using :rst:`:bar_height:`. Default value is :py:`0.4`.
+the bar height using :rst:`:bar-height:`. Default value is :py:`0.4`.
-It's possible to add an extra line of labels using :rst:`:labels_extra:`.
+It's possible to add an extra line of labels using :rst:`:labels-extra:`.
Again, there should be as many entries as primary labels and values. To omit an
extra label for a value, specify it as the :abbr:`reST <reStructuredText>`
comment :rst:`..`.
Ours default
3rd party
Full setup
- :labels_extra:
+ :labels-extra:
15 modules
60 modules
200 modules
:values: 15.09 84.98 197.13 934.27
:errors: 0.74 3.65 9.45 25.66
:colors: success info danger dim
- :bar_height: 0.6
+ :bar-height: 0.6
.. plot:: Runtime cost
:type: barh
Ours default
3rd party
Full setup
- :labels_extra:
+ :labels-extra:
15 modules
60 modules
200 modules
:values: 15.09 84.98 197.13 934.27
:errors: 0.74 3.65 9.45 25.66
:colors: success info danger dim
- :bar_height: 0.6
+ :bar-height: 0.6
`Stacked values`_
-----------------
Sdl2Application
Sdl2Application
EmscriptenApplication
- :labels_extra:
+ :labels-extra:
-s USE_SDL=2
-s USE_SDL=1
..
Sdl2Application
Sdl2Application
EmscriptenApplication
- :labels_extra:
+ :labels-extra:
-s USE_SDL=2
-s USE_SDL=1
..
'name': directives.unchanged,
'type': directives.unchanged_required,
'labels': directives.unchanged_required,
- 'labels_extra': directives.unchanged,
+ 'labels-extra': directives.unchanged,
'units': directives.unchanged_required,
'values': directives.unchanged_required,
'errors': directives.unchanged,
'colors': directives.unchanged,
+ 'bar-height': directives.unchanged,
+ # Legacy options with ugly underscores instead of dashes
+ 'labels_extra': directives.unchanged,
'bar_height': directives.unchanged}
has_content = False
units = self.options['units']
labels = self.options['labels'].split('\n')
- # Optional extra labels
+ # Legacy options, convert underscores to dashes
if 'labels_extra' in self.options:
- labels_extra = self.options['labels_extra'].split('\n')
+ self.options['labels-extra'] = self.options['labels_extra']
+ del self.options['labels_extra']
+ if 'bar_height' in self.options:
+ self.options['bar-height'] = self.options['bar_height']
+ del self.options['bar_height']
+
+ # Optional extra labels
+ if 'labels-extra' in self.options:
+ labels_extra = self.options['labels-extra'].split('\n')
assert len(labels_extra) == len(labels)
else:
labels_extra = None
color_sets = [style_mapping['default']]*len(value_sets)
# Bar height
- bar_height = float(self.options.get('bar_height', '0.4'))
+ bar_height = float(self.options.get('bar-height', '0.4'))
# Increase hashsalt for every plot to ensure (hopefully) unique SVG IDs
mpl.rcParams['svg.hashsalt'] = int(mpl.rcParams['svg.hashsalt']) + 1