python print plot to command line code example

Example: python cmd plot

# You can use termplot (terminal plot). Note that termplot requires gnuplot to be set up.
# install termplot with
# pip install termplotlib
# install gnuplot here: http://www.gnuplot.info/

# demo code
import termplotlib as tpl
import numpy

x = numpy.linspace(0, 2 * numpy.pi, 10)
y = numpy.sin(x)

fig = tpl.figure()
fig.plot(x, y, label="data", width=50, height=15)
fig.show()

# I discovered termplot through https://stackoverflow.com/questions/37288421/how-to-plot-a-chart-in-the-terminal
# where Nico Schlömer points out its existence, thank you Nico.