A Python library that lets you display graphs in streaming, simply and easily. Especially suitable for scientific use.
It is an abstraction layer for the PyQtGraph library.
- Python 3.5+
pip install graphtiny
Display graph in streaming with random values:
import random
from time import sleep
from graphtiny.service import ChartService, DataStreamWindowService
from graphtiny.domain import Chart, DataStreamWindow
window = DataStreamWindow()
chart1 = Chart()
window.charts_list.append(chart1)
DataStreamWindowService().launch_window(window)
chart_service = ChartService()
for i in range(5, 200):
sleep(0.1)
chart_service.set_data_stream(chart1, i, random.randrange(0, i))
You can display multiple graphs per window:
window = DataStreamWindow()
window.columns_display = 2
chart1, chart2, chart3, chart4 = Chart(), Chart(), Chart(), Chart()
window.charts_list.append(chart1)
window.charts_list.append(chart2)
window.charts_list.append(chart3)
window.charts_list.append(chart4)
DataStreamWindowService().launch_window(window)
chart_service = ChartService()
for i in range(5, 200):
sleep(0.1)
chart_service.set_data_stream(chart1, i, random.randrange(0, i))
chart_service.set_data_stream(chart2, i, random.randrange(0, i))
chart_service.set_data_stream(chart3, i, random.randrange(0, i))
chart_service.set_data_stream(chart4, i, random.randrange(0, i))
You can change the colors:
from graphtiny.util import Colors
window = DataStreamWindow()
window.background_color = Colors.BLACK # black
window.coordinate_system_color = Colors.WHITE # white
chart1 = Chart()
chart1.line_color = '#01DF01' # green
MIT (Massachusetts Institute of Technology)