graphical.bar
Bar
Bar(
data,
value_range,
*,
length=None,
width=None,
marks=None,
color=None,
bgcolor=None,
invert_negative=None,
orientation="horizontal",
origin=None,
force_origin=None,
prefer_bg=None,
)
Bar graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
The value. |
required |
|
Tuple[float, float]
|
Lower and upper boundary. |
required |
|
int
|
The length of the graph. Defaults to 100. |
None
|
|
int
|
The width of the bars. Defaults to 1. |
None
|
|
Union[BarMark, Mark]]
|
Marks used for the bar. Defaults to "block". |
None
|
|
Union[Color, str]
|
Color of the bar. Defaults to "default". |
None
|
|
Union[Color, str]
|
Background color. Defaults to "default". |
None
|
|
Literal[reverse, swap]
|
Use positive marks and invert cell colors for negative number. If None or not supported by marks, the cell is not inverted. |
None
|
|
Orientation
|
(Literal["horizontal", "vertical"], optional): The orientation of the bar. Defaults to "horizontal". |
'horizontal'
|
|
float
|
Origin point. Defaults to 0.0. |
None
|
|
bool
|
Force origin to half cell grid. Defaults to False. |
None
|
|
OptimizationStrategy
|
Replace block characters with background, either "never", for "full" blocks only, or for all. Defaults to "full". |
None
|
segments
segments(length=None)
Returns rendered bar segments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[int]
|
Override bar graph length. |
None
|
Yields: Segment: Next segment of rendered bar.
Range
Range(
data,
value_range,
*,
length=None,
width=None,
marks=None,
color=None,
bgcolor=None,
invert_negative=None,
orientation="horizontal",
)
Bases: Bar
Bar with an offset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tuple[float, float]
|
Start and end point of range. |
required |
|
Tuple[float, float]
|
Lower and upper boundary. |
required |
|
int
|
The length of the graph. Defaults to 100. |
None
|
|
int
|
The width of the bars. Defaults to 1. |
None
|
|
Union[BarMark, Mark]]
|
Marks used for the bar. Defaults to "block". |
None
|
|
Union[Color, str]
|
Color of the bar. Defaults to "default". |
None
|
|
Union[Color, str]
|
Background color. Defaults to "default". |
None
|
|
Literal[reverse, swap]
|
Use positive marks and invert cell colors for negative number. If None or not supported by marks, the cell is not inverted. |
None
|
|
Orientation
|
(Literal["horizontal", "vertical"], optional): The orientation of the bar. Defaults to "horizontal". |
'horizontal'
|
RangeStack
RangeStack(
data,
value_range,
*,
length=None,
width=None,
marks=None,
colors=["red", "green", "blue", "yellow"],
bgcolor=None,
invert_negative=None,
orientation="horizontal",
)
Bases: Stack
Stack with an offset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Sequence[float]
|
The values in order of stacking. The first value is the stack offset. |
required |
|
Tuple[float, float]
|
Lower and upper boundary. Defaults to range of data. |
required |
|
int
|
The length of the graph. Defaults to 100. |
None
|
|
int
|
The width of the bars. Defaults to 1. |
None
|
|
Union[BarMark, Mark]]
|
Marks used for the bars. Defaults to "block". |
None
|
|
Sequence[Union[Color, str]]
|
Colors of the bars. |
['red', 'green', 'blue', 'yellow']
|
|
Union[Color, str]
|
Background color. Defaults to "default". |
None
|
|
Literal[reverse, swap]
|
Use positive marks and invert cell colors for negative number. If None or not supported by marks, the cell is not inverted. |
None
|
|
Orientation
|
(Literal["horizontal", "vertical"], optional): The orientation of the bar. Defaults to "horizontal". |
'horizontal'
|
Stack
Stack(
data,
value_range,
*,
length=None,
width=None,
marks=None,
colors=colors,
bgcolor=None,
invert_negative=None,
orientation="horizontal",
origin=None,
force_origin=None,
prefer_bg=None,
)
Stacked bar graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Sequence[float]
|
The values in order of stacking. |
required |
|
Tuple[float, float]
|
Lower and upper boundary. Defaults to range of data. |
required |
|
int
|
The length of the graph. Defaults to 100. |
None
|
|
int
|
The width of the bars. Defaults to 1. |
None
|
|
Union[BarMark, Mark]]
|
Marks used for the bars. Defaults to "block". |
None
|
|
Sequence[Union[Color, str]]
|
Colors of the bars. |
colors
|
|
Union[Color, str]
|
Background color. Defaults to "default". |
None
|
|
Literal[reverse, swap]
|
Use positive marks and invert cell colors for negative number. If None or not supported by marks, the cell is not inverted. |
None
|
|
Orientation
|
(Literal["horizontal", "vertical"], optional): The orientation of the bar. Defaults to "horizontal". |
'horizontal'
|
|
float
|
Origin point. Defaults to 0.0. |
None
|
|
bool
|
Force origin to half cell grid. Defaults to False. |
None
|
|
OptimizationStrategy
|
Replace block characters with background, either "never", for "full" blocks only, or for all. Defaults to "full". |
None
|
segments
segments(length=None)
Returns rendered bar segments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[int]
|
Override bar graph length. |
None
|
Yields: Segment: Next segment of rendered bar.