nschloe / termplotlib

:chart_with_upwards_trend: Plotting on the command line
GNU General Public License v3.0
667 stars 19 forks source link

Add suppport for scatter plot #36

Closed shazz closed 4 years ago

shazz commented 4 years ago

Hi, Can you set the plotting type by a parameter rather than plot_command="plot '-' w lines" ?

I'd like to use plot_command="plot '-' w points" to draw X,Y scatter plots.

Thanks !

nschloe commented 4 years ago

This should do it:

import numpy
import termplotlib as tpl

numpy.random.seed(0)
x = numpy.arange(0.0, 50.0, 2.0)
y = x ** 1.3 + numpy.random.rand(*x.shape) * 30.0

fig = tpl.figure()
fig.plot(x, y, plot_command="plot '-' w points", width=50, height=15)
fig.show()