Bar Charts

class sage.plot.bar_chart.BarChart(ind, datalist, options)

Bases: sage.plot.primitive.GraphicPrimitive

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'>
get_minmax_data()
sage.plot.bar_chart.bar_chart(*args, **kwds)

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

Previous topic

Arrows

Next topic

Bezier Paths

This Page