Graphics primitive that represents a bar chart.
EXAMPLES:
sage: from sage.plot.bar_chart import BarChart
sage: g = BarChart(range(4), [1,3,2,0], {}); g
BarChart defined by a 4 datalist
sage: type(g)
<class 'sage.plot.bar_chart.BarChart'>
Initialize a BarChart primitive.
EXAMPLES:
sage: from sage.plot.bar_chart import BarChart
sage: BarChart(range(3), [10,3,5], {'width':0.7})
BarChart defined by a 3 datalist
Return the allowed options with descriptions for this graphics primitive. This is used in displaying an error message when the user gives an option that doesn’t make sense.
EXAMPLES:
sage: from sage.plot.bar_chart import BarChart
sage: g = BarChart(range(4), [1,3,2,0], {})
sage: list(sorted(g._allowed_options().iteritems()))
[('hue', 'The color given as a hue.'),
('rgbcolor', 'The color as an RGB tuple.'),
('width', 'The width of the bars'),
('zorder', 'The layer level in which to draw')]
Render this bar chart graphics primitive on a matplotlib subplot object.
EXAMPLES:
This rendering happens implicitly when the following command is executed:
sage: bar_chart([1,2,10])
Return text representation of this bar chart graphics primitive.
EXAMPLES:
sage: from sage.plot.bar_chart import BarChart
sage: g = BarChart(range(4), [1,3,2,0], {})
sage: g._repr_()
'BarChart defined by a 4 datalist'
A bar chart of (currently) one list of numerical data. Support for more data lists in progress.
EXAMPLES:
A bar_chart with blue bars:
sage: bar_chart([1,2,3,4])
A bar_chart with thinner bars:
sage: bar_chart([x^2 for x in range(1,20)], width=0.2)
A bar_chart with negative values and red bars:
sage: bar_chart([-3,5,-6,11], rgbcolor=(1,0,0))
Extra options will get passed on to show(), as long as they are valid:
sage: bar_chart([-2,8,-7,3], rgbcolor=(1,0,0), axes=False)
sage: bar_chart([-2,8,-7,3], rgbcolor=(1,0,0)).show(axes=False) # These are equivalent