piligraphs

A Pillow extension for drawing graphs and charts.


Keywords
chart, charts, draw, graph, graphs, image, imaging, pil, pillow, python, visualization
License
MIT
Install
pip install piligraphs==0.0.3

Documentation

piligraphs

pypi python CodeFactor BuyMeACoffee

A Pillow extension for drawing graphs and charts.

Installation

To install this module, run the following command:

pip install piligraphs

Example usage

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()

Result:

You can find more examples here.