Skip to content

Charts Module

datachart.charts

Module containing the charts.

The charts module contains the methods to create the plots and figures.

FUNCTION DESCRIPTION
LineChart

Creates the line chart.

BarChart

Creates the bar chart.

Histogram

Creates the histogram.

Heatmap

Creates the heatmap.

Chart Functions

datachart.charts.LineChart

LineChart(attrs: LineChartAttrs) -> plt.Figure

Creates the line chart.

Examples:

>>> from datachart.charts import LineChart
>>> figure = LineChart({
...     "charts": {
...         "data": [
...             {"x": 1, "y": 5},
...             {"x": 2, "y": 10},
...             {"x": 3, "y": 15},
...             {"x": 4, "y": 20},
...             {"x": 5, "y": 25}
...         ],
...     },
...     "title": "Basic Line Chart",
...     "xlabel": "X",
...     "ylabel": "Y",
... })
PARAMETER DESCRIPTION
attrs

The line chart attributes.

TYPE: LineChartAttrs

RETURNS DESCRIPTION
plt.Figure

The figure containing the line chart.

datachart.charts.BarChart

BarChart(attrs: BarChartAttrs) -> plt.Figure

Creates the bar chart.

Examples:

>>> from datachart.charts import BarChart
>>> figure = BarChart({
...     "charts": {
...         "data": [
...             {"label": "cat1", "y": 5},
...             {"label": "cat2", "y": 10},
...             {"label": "cat3", "y": 15},
...             {"label": "cat4", "y": 20},
...             {"label": "cat5", "y": 25}
...         ],
...     },
...     "title": "Basic Bar Chart",
...     "xlabel": "LABEL",
...     "ylabel": "Y",
... })
PARAMETER DESCRIPTION
attrs

The bar chart attributes.

TYPE: BarChartAttrs

RETURNS DESCRIPTION
plt.Figure

The figure containing the bar chart.

datachart.charts.Histogram

Histogram(attrs: HistogramChartAttrs) -> plt.Figure

Creates the histogram.

Examples:

>>> from datachart.charts import Histogram
>>> figure = Histogram({
...     "charts": {
...         "data": [
...             {"x": 1},
...             {"x": 2},
...             {"x": 3},
...             {"x": 4},
...             {"x": 5}
...         ],
...     },
...     "title": "Basic Histogram",
...     "xlabel": "X",
...     "ylabel": "Y",
... })
PARAMETER DESCRIPTION
attrs

The histogram chart attributes.

TYPE: HistogramChartAttrs

RETURNS DESCRIPTION
plt.Figure

The figure containing the histogram.

datachart.charts.Heatmap

Heatmap(attrs: HeatmapChartAttrs) -> plt.Figure

Creates the heatmap.

Examples:

>>> from datachart.charts import Heatmap
>>> figure = Heatmap({
...     "charts": {
...         "data": [
...             [1, 2, 3],
...             [4, 5, 6],
...             [7, 8, 9]
...         ],
...     },
...     "title": "Basic Heatmap",
...     "xlabel": "X",
...     "ylabel": "Y",
... })
PARAMETER DESCRIPTION
attrs

The heatmap chart attributes.

TYPE: HeatmapChartAttrs

RETURNS DESCRIPTION
plt.Figure

The figure containing the heatmap.