Reference 〉 Function

BarChart.addBar(reporterstr|func(int), labelstr, colorstr|Color, positionintNone)

Registers a data reporter as a bar on the current plot. To display error bars, use the std or percentiles arguments when creating the agent reporter.


  • reporter str|func(int), required

    A reference to a previously registered reporter, or a function that takes the model time (int) as its only argument and returns a numeric. See data.addReporter().

  • label str, required

    The name of the bar, to be displayed below the axes (or to the left, for a horizontal chart).

  • color str|Color, required

    The color of the series line. Can take a hex string, a color name string (see the Matplotlib documentation for valid values), an RGB tuple with ranges from 0.0 to 1.0, or a Color object.

  • position int, optional

    The position in which to insert the bar among existing bars. By default the bar is appended to the end. NOTE: Position is calculated as of the function call. If two bars are called with position 3 for example, the second will push the first to position 4.

    Default value: None

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.