Scatter
Scatter plot.
Scatter
Bases: _AxisChart
Scatter plot with numeric or temporal x-axis.
Unlike other axis charts, Scatter does not use a labels array. Each
dataset contains {x, y} points directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Chart title. |
None
|
x_label
|
str | None
|
Label for the x-axis. |
None
|
y_label
|
str | None
|
Label for the y-axis. |
None
|
datasets
|
Any
|
List of dataset dicts, each with |
required |
options
|
Any
|
Dict of chart options. |
None
|
Options:
backgroundColor(str): Background color (default'white').dataColors(list[str]): Point/line colors.dotSize(float): Point size multiplier (default 1).fontFamily(str): Font family (default'xkcd').legendPosition(int): Legend placement (usepositionType).showLegend(bool): Show legend (default True).showLine(bool): Connect dots with lines (default False).strokeColor(str): Axis/border color (default'black').timeFormat(str): dayjs format string for temporal x-axis.unxkcdify(bool): Disable hand-drawn style (default False).xTickCount(int): Number of x-axis ticks (default 3).yTickCount(int): Number of y-axis ticks (default 3).
Example:
Scatter(
title="Scatter",
x_label="X",
y_label="Y",
datasets=[{
"label": "Series A",
"data": [{"x": 1, "y": 2}, {"x": 3, "y": 5}, {"x": 7, "y": 11}],
}],
options={"showLine": True, "dotSize": 2},
)
Source code in src/chart_xkcd/scatter.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |