Graphing
A module for making and displaying graphs on the screen, created for use with the Window API.
Usage
Currently supported graph types:
- Line Graphs
- Bar Graphs
- Scatter Plots
- Pie Charts
- Histograms
- Box Plot
- Area Graph
Graph Options
The GraphOptions class is used to specify the options for a graph. To create a GraphOptions object, use the following code:
from tailwindall.graphing import GraphOptionsfrom tailwindall.util import ImageScale
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_label | str | The label for the x axis | No Default | |
y_label | str | The label for the y axis | No Default | |
title | str | The title of the graph | No Default | |
image | ImageScale | The size of the graph | No Default | ImageScale |
Line Graphs
To create a line graph, use the following code:
from tailwindall.graphing import LineGraph, GraphOptionsfrom tailwindall.window import Windowfrom tailwindall.util import ImageScale, WindowProperties, PlaceData, CenterAnchor
win = Window(None, "Line Graph", WindowProperties())
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))
linegraph = LineGraph([], [], opts, win)
win.add_widget(linegraph.display(), PlaceData(0, 0, CenterAnchor.get_anchor()))
win.main_loop()Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_data | List[float] | The x data to be graphed | No Default | |
y_data | List[float] | The y data to be graphed | No Default | |
options | GraphOptions | The options for the graph | No Default | GraphOptions |
window | Window | The window to display the graph on | No Default | Window |
Bar Graphs
To create a bar graph, use the following code:
from tailwindall.graphing import BarGraph, GraphOptionsfrom tailwindall.window import Windowfrom tailwindall.util import ImageScale, WindowProperties, PlaceData, CenterAnchor
win = Window(None, "Bar Graph", WindowProperties())
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))
bargraph = BarGraph([], [], opts, win)
win.add_widget(bargraph.display(), PlaceData(0, 0, CenterAnchor.get_anchor()))
win.main_loop()Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_data | List[float] | The x data to be graphed | No Default | |
y_data | List[float] | The y data to be graphed | No Default | |
options | GraphOptions | The options for the graph | No Default | GraphOptions |
window | Window | The window to display the graph on | No Default | Window |
Scatter Plots
To create a scatter plot, use the following code:
from tailwindall.graphing import ScatterPlot, GraphOptionsfrom tailwindall.window import Windowfrom tailwindall.util import ImageScale, WindowProperties, PlaceData, CenterAnchor
win = Window(None, "Scatter Plot", WindowProperties())
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))
scatterplot = ScatterPlot([], [], opts, win)
win.add_widget(scatterplot.display(), PlaceData(0, 0, CenterAnchor.get_anchor()))
win.main_loop()Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_data | List[float] | The x data to be graphed | No Default | |
y_data | List[float] | The y data to be graphed | No Default | |
options | GraphOptions | The options for the graph | No Default | GraphOptions |
window | Window | The window to display the graph on | No Default | Window |
Pie Charts
To create a pie chart, use the following code:
from tailwindall.graphing import PieGraph, GraphOptionsfrom tailwindall.window import Windowfrom tailwindall.util import ImageScale, WindowProperties, PlaceData, CenterAnchor
win = Window(None, "Pie Chart", WindowProperties())
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))
piechart = PieGraph([], [], opts, win)
win.add_widget(piechart.display(), PlaceData(0, 0, CenterAnchor.get_anchor()))
win.main_loop()Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_data | List[float] | The x data to be graphed | No Default | |
y_data | List[float] | The y data to be graphed | No Default | |
options | GraphOptions | The options for the graph | No Default | GraphOptions |
window | Window | The window to display the graph on | No Default | Window |
Histograms
To create a histogram, use the following code:
from tailwindall.graphing import HistogramGraph, GraphOptionsfrom tailwindall.window import Windowfrom tailwindall.util import ImageScale, WindowProperties, PlaceData, CenterAnchor
win = Window(None, "Histogram", WindowProperties())
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))
histogram = HistogramGraph([], [], opts, win)
win.add_widget(histogram.display(), PlaceData(0, 0, CenterAnchor.get_anchor()))
win.main_loop()Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_data | List[float] | The x data to be graphed | No Default | |
y_data | List[float] | The y data to be graphed | No Default | |
options | GraphOptions | The options for the graph | No Default | GraphOptions |
window | Window | The window to display the graph on | No Default | Window |
Box Plots
To create a box plot, use the following code:
from tailwindall.graphing import BoxPlotGraph, GraphOptionsfrom tailwindall.window import Windowfrom tailwindall.util import ImageScale, WindowProperties, PlaceData, CenterAnchor
win = Window(None, "Box Plot", WindowProperties())
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))
boxplot = BoxPlotGraph([], [], opts, win)
win.add_widget(boxplot.display(), PlaceData(0, 0, CenterAnchor.get_anchor()))
win.main_loop()Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_data | List[float] | The x data to be graphed | No Default | |
y_data | List[float] | The y data to be graphed | No Default | |
options | GraphOptions | The options for the graph | No Default | GraphOptions |
window | Window | The window to display the graph on | No Default | Window |
Area Graphs
To create an area graph, use the following code:
from tailwindall.graphing import AreaGraph, GraphOptionsfrom tailwindall.window import Windowfrom tailwindall.util import ImageScale, WindowProperties, PlaceData, CenterAnchor
win = Window(None, "Area Graph", WindowProperties())
opts = GraphOptions("X Label", "Y Label", "Title", ImageScale(1, 1))
areagraph = AreaGraph([], [], opts, win)
win.add_widget(areagraph.display(), PlaceData(0, 0, CenterAnchor.get_anchor()))
win.main_loop()Arguments
| Argument | Type | Description | Default | See Also |
|---|---|---|---|---|
x_data | List[float] | The x data to be graphed | No Default | |
y_data | List[float] | The y data to be graphed | No Default | |
options | GraphOptions | The options for the graph | No Default | GraphOptions |
window | Window | The window to display the graph on | No Default | Window |