A Pillow extension for drawing graphs and charts.
To install this module, run the following command:
pip install piligraphs
Creating a line chart:
import random
from piligraphs import LineChart, Node
# define nodes
nodes = [
Node(weight=random.randint(1, 7)) for _ in range(10)
]
# create a line chart
chart = LineChart(
size=(1200, 300),
thickness=8,
fill=(243, 14, 95, 156),
outline=(194, 43, 132, 256),
pwidth=15,
onlysrc=True,
npoints=len(nodes) * 8,
interp='cubic'
)
# add nodes
chart.add_nodes(*nodes)
# draw the graph
image = chart.draw()
image.show()
You can find more examples here.