有没有好的命令行UNIX制图/图表/绘图工具?我正在寻找能在ASCII图形上绘制xy点的工具。
只是为了澄清,我正在寻找输出ASCII图形(类似ASCII艺术风格)的工具,因此我可以在交互式shell会话中使用它而不需要X。
只是为了澄清,我正在寻找输出ASCII图形(类似ASCII艺术风格)的工具,因此我可以在交互式shell会话中使用它而不需要X。
1 ++-----------****-----------+--***-------+------****--++ 0.6 *+ **+ * +** * sin(x)*******++ 0.2 +* * * ** ** * **++ 0 ++* ** * ** * ** *++ -0.4 ++** * ** ** * * *+ -0.8 ++ ** * + * ** + * +** +* -1 ++--****------+-------***---+----------****-----------++ -10 -5 0 5 10
它在79x24上看起来更好(不要在80x24显示器上使用第80列:某些curses实现在最后一列周围的行为不总是良好的)。
我正在使用gnuplot v4,但这也适用于稍旧或更新的版本。
termplotlib (我的一个项目)最近变得越来越受欢迎,或许对某些人有所帮助。
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()
1 +---------------------------------------+
0.8 | ** ** |
0.6 | * ** data ******* |
0.4 | ** |
0.2 |* ** |
0 | ** |
| * |
-0.2 | ** ** |
-0.4 | ** * |
-0.6 | ** |
-0.8 | **** ** |
-1 +---------------------------------------+
0 1 2 3 4 5 6 7
这是我为eplot编写的补丁,增加了一个-T选项用于终端输出:
--- eplot 2008-07-09 16:50:04.000000000 -0400
+++ eplot+ 2017-02-02 13:20:23.551353793 -0500
@@ -172,7 +172,10 @@
com=com+"set terminal postscript color;\n"
@o["DoPDF"]=true
- # ---- Specify a custom output file
+ when /^-T$|^--terminal$/
+ com=com+"set terminal dumb;\n"
+
+ # ---- Specify a custom output file
when /^-o$|^--output$/
@o["OutputFileSpecified"]=checkOptArg(xargv,i)
i=i+1
i=i+1
使用此命令,您可以运行 eplot -T
以获取 ASCII 图形结果而不是 gnuplot 窗口。
-d
选项。 - Max