Chart()
Source¶
Base class of every chart, which says what a Plot draws and how its series look.
A chart is immutable and checks its settings when it is created.
Only its subclasses are created: calling ndp.Chart() raises RefusedOperationError.
Every chart, each passed to its own creation method of Plot:
| Chart | What it draws | Example |
|---|---|---|
LineChart |
Each series as a line, with Plot.line |
ndp.LineChart(x="month", y=["sales"]) |
BarChart |
Each value as a bar, with Plot.bar |
ndp.BarChart(x="city", y=["sales"]) |
ScatterChart |
Each row as a point, with Plot.scatter |
ndp.ScatterChart(x="price", y="stock") |
HistogramChart |
The values per bin, with Plot.histogram |
ndp.HistogramChart(columns=["price"]) |
BoxChart |
The spread of each column as a box, with Plot.box |
ndp.BoxChart(columns=["price"]) |
PieChart |
Each row as a slice of a pie, with Plot.pie |
ndp.PieChart(labels="city", values="sales") |
HeatmapChart |
Each value as a colored cell, with Plot.heatmap |
ndp.HeatmapChart() |
MissingChart |
The missing values per column, with Plot.missing_by_column |
ndp.MissingChart() |
Added in version 0.1.0
Raises:
-
RefusedOperationErrorWhen the created object is a Chart and not one of its subclasses.
Examples:
import numdaplot as ndp
prices = ndp.Array.from_list([12.0, 15.5, 14.0, 17.0])
bar_plot = ndp.Plot.bar(prices, ndp.BarChart(orientation=ndp.Orientation.HORIZONTAL))
bar_plot.show()