fill
|width|
|baseline|
Examples
The mark draws discrete bars from a baseline to provided values:
so.Plot(flights["month"], flights["passengers"]).add(so.Bar())
The bars are oriented depending on the x/y variable types and the orient parameter:
so.Plot(flights["passengers"], flights["month"]).add(so.Bar())
A common usecase will be drawing histograms on a variable with a nominal
scale:
so.Plot(penguins, x="species").add(so.Bar(), so.Hist())
When mapping additional variables, the bars will overlap by default:
so.Plot(penguins, x="species", color="sex").add(so.Bar(), so.Hist())
Apply a move transform, such as a Dodge or Stack to resolve them:
so.Plot(penguins, x="species", color="sex").add(so.Bar(), so.Hist(), so.Dodge())
A number of properties can be mapped or set:
(
so.Plot(
penguins, x="species",
color="sex", alpha="sex", edgestyle="sex",
)
.add(so.Bar(edgewidth=2), so.Hist(), so.Dodge("fill"))
)
Combine with Range to plot an estimate with errorbars:
(
so.Plot(penguins, "body_mass_g", "species", color="sex")
.add(so.Bar(alpha=.5), so.Agg(), so.Dodge())
.add(so.Range(), so.Est(errorbar="sd"), so.Dodge())
)