Category Plots, aka Bar Charts


In [ ]:
from beakerx import *
bars = CategoryBars(value = [[1, 2, 3], [1, 3, 5]])
CategoryPlot().add(bars)

the initWidth and initHeight properties


In [ ]:
cplot = CategoryPlot(initWidth = 400, initHeight = 200)
bars = CategoryBars(value = [[1, 2, 3], [1, 3, 5]])
cplot.add(bars)

the title, x and y axis labels


In [ ]:
cplot = CategoryPlot(title = "Hello CategoryPlot!",
                             xLabel = "Categories",
                             yLabel = "Values")
cplot.add(CategoryBars(value = [[1, 2, 3], [1, 3, 5]]))

the category labels


In [ ]:
cplot = CategoryPlot(categoryNames =  ["Helium", "Neon", "Argon"])
cplot.add(CategoryBars(value = [[1, 2, 3], [1, 3, 5]]))

the series labels


In [ ]:
bars = CategoryBars(value = [[1, 2], [3, 4], [5, 6], [7, 8]],
                            seriesNames = ["Gas", None, "", "Liquid"])
CategoryPlot().add(bars)

the legend


In [ ]:
plot = CategoryPlot(showLegend = True) 
# since no display names were provided, default names "series0" etc will be used.
plot.add(CategoryBars(value = [[1, 2, 3], [1, 3, 5]]))

the orientation


In [ ]:
plot = CategoryPlot(orientation = PlotOrientationType.HORIZONTAL)
plot.add(CategoryBars(value = [[1, 2, 3], [1, 3, 5]]))

the label angle


In [ ]:
plot = CategoryPlot(categoryNames = ["Acid", "Neutral", "Base"], 
                            categoryNamesLabelAngle = -1/4 * math.pi)
plot.add(CategoryBars(value = [[1, 2, 3], [4, 5, 6]]))

the margin


In [ ]:
plot = CategoryPlot(categoryMargin = 2)
plot.add(CategoryBars(value = [[1, 2, 3], [4, 5, 6]]))

the color (single value)


In [ ]:
bars = CategoryBars(value = [[1, 2], [3, 4], [5, 6]], 
                            color = Color.pink)
CategoryPlot().add(bars)

the color (list of values)


In [ ]:
colors = [Color.pink, [Color.red, Color.gray, Color.blue]]
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]], 
                            color = colors)
CategoryPlot().add(bars)

the base (single value)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]], 
                            base = -2)
CategoryPlot().add(bars)

the base (list of values)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 5]],
                            base = [-2, [-4, -4, -1]])
CategoryPlot().add(bars)

the width (single value)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                            width = 0.3)
CategoryPlot().add(bars)

the width (list of values)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                            width = [[0.3, 0.6, 1.7], 1.0])
CategoryPlot().add(bars)

the fill (single value)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                            fill = [False, False])
CategoryPlot().add(bars)

the fill (list of values)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                            fill = [[False, True, False], True])
CategoryPlot().add(bars)

draw outline (single value)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                            drawOutline = True)
CategoryPlot().add(bars)

draw outline (list of values)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                    drawOutline = [[False, True, False], True])
CategoryPlot().add(bars)

outline color (single value)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                    drawOutline = True,
                    outlineColor = Color.green)
CategoryPlot().add(bars)

outline color (list of values)


In [ ]:
bars = CategoryBars(value = [[1, 2, 3], [4, 5, 6]],
                    drawOutline = True,
                    outlineColor = [Color.green, Color.red])
CategoryPlot().add(bars)

In [ ]: