[PYTHON] Note: Graph drawing termplotlib on terminal
Installation
apt install -y \
python3-scipy \
python3-seaborn \
python3-gnuplot \
python3-pip
pip install termplotlib
Graph drawing
graph.py
import termplotlib as tpl
import numpy as np
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x) + x
fig = tpl.figure()
fig.plot(x, y, width=60, height=20)
fig.show()
Use csv
a.csv
1, 3
2, 1
3, 2.5
4, 8
graph.py
import pandas as pd
headers = ['x', 'y']
df = pd.read_csv('a.csv',names=headers)
#print(df)
import termplotlib as tpl
x = df['x']
y = df['y']
fig = tpl.figure()
fig.plot(x, y, width=60, height=20)
fig.show()