命令行Unix基于ASCII的图表/绘图工具

时间:2021-11-11 14:56:31

Is there a good command-line UNIX charting / graphing / plotting tool out there? I'm looking for something that will plot xy points on an ASCII graph.

那里有一个很好的命令行UNIX图表/图形/绘图工具吗?我正在寻找能在ASCII图上绘制xy点的东西。

Just to clarify, I'm looking for something that will output a graph in ASCII (like ascii-art style), so I can use it over an interactive shell session without needing X.

只是为了澄清,我正在寻找能够输出ASCII图形的东西(如ascii-art样式),所以我可以在交互式shell会话中使用它而不需要X.

11 个解决方案

#1


108  

Try gnuplot. It has very powerful graphing possibilities.

试试gnuplot。它具有非常强大的图形可能性。

It can output to your terminal in the following way:

它可以通过以下方式输出到您的终端:

gnuplot> set terminal dumb
Terminal type set to 'dumb'
Options are 'feed 79 24'
gnuplot> plot sin(x)

   1 ++----------------**---------------+----**-----------+--------**-----++
     +                *+ *              +   *  *          +  sin(x) ****** +
 0.8 ++              *    *                *    *                *    *   ++
     |               *    *                *    *                *    *    |
 0.6 ++              *     *              *      *              *      *  ++
     *              *       *             *       *             *      *   |
 0.4 +*             *       *             *       *             *      *  ++
     |*            *        *            *        *            *        *  |
 0.2 +*            *        *            *        *            *        * ++
     | *          *          *          *          *          *          * |
   0 ++*          *          *          *          *          *          *++
     |  *         *           *         *           *         *           *|
-0.2 ++ *         *           *         *           *         *           *+
     |   *       *            *        *            *        *            *|
-0.4 ++  *       *            *        *            *        *            *+
     |   *      *              *      *              *      *              *
-0.6 ++  *      *              *      *              *      *             ++
     |    *     *               *     *               *    *               |
-0.8 ++    *   *                 *   *                *    *              ++
     +     *  *        +         *  *   +              *  *                +
  -1 ++-----**---------+----------**----+---------------**+---------------++
    -10               -5                0                 5                10

#2


57  

While gnuplot is powerful, it's also really irritating when you just want to pipe in a bunch of points and get a graph.

虽然gnuplot功能强大,但当你想要在一堆点中输入并获得图表时,它也会非常恼人。

Thankfully, someone created eplot (easy plot), which handles all the nonsense for you.

值得庆幸的是,有人创建了eplot(简单的情节),它可以为你处理所有废话。

It doesn't seem to have an option to force terminal graphs; I patched it like so:

它似乎没有强制终端图的选项;我修补它是这样的:

--- eplot.orig  2012-10-12 17:07:35.000000000 -0700
+++ eplot       2012-10-12 17:09:06.000000000 -0700
@@ -377,6 +377,7 @@
                # ---- print the options
                com="echo '\n"+getStyleString+@oc["MiscOptions"]
                com=com+"set multiplot;\n" if doMultiPlot
+               com=com+"set terminal dumb;\n"
                com=com+"plot "+@oc["Range"]+comString+"\n'| gnuplot -persist"
                printAndRun(com)
                # ---- convert to PDF

An example of use:

使用示例:

[$]> git shortlog -s -n | awk '{print $1}' | eplot 2> /dev/null


  3500 ++-------+-------+--------+--------+-------+--------+-------+-------++
       +        +       +        "/tmp/eplot20121012-19078-fw3txm-0" ****** +       *                                                                    |  3000 +*                                                                  ++       |*                                                                   |       | *                                                                  |  2500 ++*                                                                 ++       | *                                                                  |
       |  *                                                                 |
  2000 ++ *                                                                ++
       |  **                                                                |
  1500 ++   ****                                                           ++
       |        *                                                           |
       |         **                                                         |
  1000 ++          *                                                       ++
       |            *                                                       |
       |            *                                                       |
   500 ++            ***                                                   ++
       |                **************                                      |
       +        +       +        +    **********  +        +       +        +
     0 ++-------+-------+--------+--------+-----***************************++
       0        5       10       15       20      25       30      35       40

#3


23  

Another option I've just run across is bashplotlib. Here's an example run on (roughly) the same data as my eplot example:

我刚遇到的另一个选择是bashplotlib。这是一个示例(大致)与我的eplot示例相同的数据运行:

[$]> git shortlog -s -n | awk '{print $1}' | hist

 33|   o
 32|   o
 30|   o
 28|   o
 27|   o
 25|   o
 23|   o
 22|   o
 20|   o
 18|   o
 16|   o
 15|   o
 13|   o
 11|   o
 10|   o
  8|   o
  6|   o
  5|   o
  3|   o o     o
  1|   o o     o o       o
  0|   o o o o o o       o
    ----------------------

-----------------------
|       Summary       |
-----------------------
|   observations: 50  |
| min value: 1.000000 |
|  mean : 519.140000  |
|max value: 3207.000000|
-----------------------

Adjusting the bins helps the resolution a bit:

调整垃圾箱有助于提高分辨率:

[$]> git shortlog -s -n | awk '{print $1}' | hist --nosummary --bins=40

 18|   o
   |   o
 17|   o
 16|   o
 15|   o
 14|   o
 13|   o
 12|   o
 11|   o
 10|   o
  9|   o
  8|   o
  7|   o
  6|   o
  5|   o   o
  4|   o   o o
  3|   o o o o   o
  2|   o o o o   o
  1|   o o o o   o                     o       o
  0|   o o o o o o           o     o   o o   o o                                 o
   |   o o o o o o           o     o   o o   o o                                 o
    --------------------------------------------------------------------------------

#4


16  

Plots in a single line are really simple, and can help one see patterns of highs and lows.
See also pysparklines.
(Does anyone know of unicode slanting lines, which could be fit together to make line, not bar, plots ?)

单行中的绘图非常简单,可以帮助人们看到高点和低点的模式。另见pysparklines。 (有没有人知道unicode斜线,它们可以组合在一起制作线条,而不是条形图,情节?)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division
import numpy as np

__version__ = "2015-01-02 jan  denis"


#...............................................................................
def onelineplot( x, chars=u"▁▂▃▄▅▆▇█", sep=" " ):
    """ numbers -> v simple one-line plots like

f ▆ ▁ ▁ ▁ █ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁  osc 47  ▄ ▁ █ ▇ ▄ ▆ ▅ ▇ ▇ ▇ ▇ ▇ ▄ ▃ ▃ ▁ ▃ ▂  rosenbrock
f █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ ▁ ▁ ▁ ▁  osc 58  ▂ ▁ ▃ ▂ ▄ ▃ ▅ ▄ ▆ ▅ ▇ ▆ █ ▇ ▇ ▃ ▃ ▇  rastrigin
f █ █ █ █ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁  osc 90  █ ▇ ▇ ▁ █ ▇ █ ▇ █ ▇ █ ▇ █ ▇ █ ▇ █ ▇  ackley

Usage:
    astring = onelineplot( numbers [optional chars= sep= ])
In:
    x: a list / tuple / numpy 1d array of numbers
    chars: plot characters, default the 8 Unicode bars above
    sep: "" or " " between plot chars

How it works:
    linscale x  ->  ints 0 1 2 3 ...  ->  chars ▁ ▂ ▃ ▄ ...

See also: https://github.com/RedKrieg/pysparklines
    """

    xlin = _linscale( x, to=[-.49, len(chars) - 1 + .49 ])
        # or quartiles 0 - 25 - 50 - 75 - 100
    xints = xlin.round().astype(int)
    assert xints.ndim == 1, xints.shape  # todo: 2d
    return sep.join([ chars[j] for j in xints ])


def _linscale( x, from_=None, to=[0,1] ):
    """ scale x from_ -> to, default min, max -> 0, 1 """
    x = np.asanyarray(x)
    m, M = from_ if from_ is not None \
        else [np.nanmin(x), np.nanmax(x)]
    if m == M:
        return np.ones_like(x) * np.mean( to )
    return (x - m) * (to[1] - to[0]) \
        / (M - m)  + to[0]


#...............................................................................
if __name__ == "__main__":  # standalone test --
    import sys

    if len(sys.argv) > 1:  # numbers on the command line, may be $(cat myfile)
        x = map( float, sys.argv[1:] )
    else:
        np.random.seed( 0 )
        x = np.random.exponential( size=20 )

    print onelineplot( x )

#5


14  

feedgnuplot is another front end to gnuplot, which handles piping in data.

feedgnuplot是gnuplot的另一个前端,它处理数据中的管道。

    $ seq 5 | awk '{print 2*$1, $1*$1}' |
      feedgnuplot --lines --points --legend 0 "data 0" --title "Test plot" --y2 1
                  --terminal 'dumb 80,40' --exit

                                     Test plot

     10 ++------+--------+-------+-------+-------+--------+-------+------*A 25
        +       +        +       +       +       +        +       +    **#+
        |       :        :       :       :       :        : data 0+**A*** |
        |       :        :       :       :       :        :       :** #   |
      9 ++.......................................................**.##....|
        |       :        :       :       :       :        :    ** :#      |
        |       :        :       :       :       :        :  **   #       |
        |       :        :       :       :       :        :**   ##:      ++ 20
      8 ++................................................A....#..........|
        |       :        :       :       :       :      **:   #   :       |
        |       :        :       :       :       :    **  : ##    :       |
        |       :        :       :       :       :  **    :#      :       |
        |       :        :       :       :       :**      B       :       |
      7 ++......................................**......##................|
        |       :        :       :       :    ** :    ##  :       :      ++ 15
        |       :        :       :       :  **   :   #    :       :       |
        |       :        :       :       :**     : ##     :       :       |
      6 ++..............................*A.......##.......................|
        |       :        :       :    ** :     ##:        :       :       |
        |       :        :       :  **   :    #  :        :       :       |
        |       :        :       :**     :  ##   :        :       :      ++ 10
      5 ++......................**........##..............................|
        |       :        :    ** :      #B       :        :       :       |
        |       :        :  **   :    ## :       :        :       :       |
        |       :        :**     :  ##   :       :        :       :       |
      4 ++...............A.......###......................................|
        |       :      **:     ##:       :       :        :       :       |
        |       :    **  :   ##  :       :       :        :       :      ++ 5
        |       :  **    : ##    :       :       :        :       :       |
        |       :**    ##B#      :       :       :        :       :       |
      3 ++.....**..####...................................................|
        |    **####      :       :       :       :        :       :       |
        |  **## :        :       :       :       :        :       :       |
        B**     +        +       +       +       +        +       +       +
      2 A+------+--------+-------+-------+-------+--------+-------+------++ 0
        1      1.5       2      2.5      3      3.5       4      4.5      5

#6


6  

gnuplot is the definitive answer to your question.

gnuplot是你问题的最终答案。

I am personally also a big fan of the google chart API, which can be accessed from the command line with the help of wget (or curl) to download a png file (and view with xview or something similar). I like this option because I find the charts to be slightly prettier (i.e. better antialiasing).

我个人也是谷歌图表API的忠实粉丝,可以在wget(或curl)的帮助下从命令行访问以下载png文件(并使用xview或类似的东西查看)。我喜欢这个选项,因为我发现图表稍微漂亮(即更好的抗锯齿)。

#7


5  

See also: asciichart (implemented in Node.js, Python, Java, Go and Haskell)

另请参见:asciichart(在Node.js,Python,Java,Go和Haskell中实现)

命令行Unix基于ASCII的图表/绘图工具

#8


3  

A very heavy and overpowered solution would be to install cernlib and use paw.

一个非常沉重和过于强大的解决方案是安装cernlib并使用paw。

#9


3  

You should use gnuplot and be sure to issue the command "set term dumb" after starting up. You can also give a row and column count. Here is the output from gnuplot if you issue "set term dumb 64 10" and then "plot sin(x)":

您应该使用gnuplot并确保在启动后发出命令“set term dumb”。您还可以提供行数和列数。如果你发出“set term dumb 64 10”然后“plot sin(x)”,这是gnuplot的输出:

 

    1 ++-----------****-----------+--***-------+------****--++
  0.6 *+          **+  *          +**   *      sin(x)*******++
  0.2 +*         *      *         **     **         *     **++
    0 ++*       **       *       **       *       **       *++
 -0.4 ++**     *         **     **         *      *         *+
 -0.8 ++ **   *     +      *   ** +         *  +**          +*
   -1 ++--****------+-------***---+----------****-----------++
     -10           -5             0            5             10


It looks better at 79x24 (don't use the 80th column on an 80x24 display: some curses implementations don't always behave well around the last column).

它看起来更好79x24(不要在80x24显示器上使用第80列:一些curses实现并不总是在最后一列周围表现良好)。

I'm using gnuplot v4, but this should work on slightly older or newer versions.

我正在使用gnuplot v4,但这应该适用于较旧或较新的版本。

#10


1  

Here is my patch for eplot that adds a -T option for terminal output:

这是我的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

Using this you can run it as eplot -T to get ASCII-graphics result instead of a gnuplot window.

使用此方法,您可以将其作为eplot -T运行,以获取ASCII图形结果而不是gnuplot窗口。

#11


0  

Another simpler/lighter alternative to gnuplot is ervy, a NodeJS based terminal charts tool.

gnuplot的另一个更简单/更轻的替代方案是ervy,一种基于NodeJS的终端图表工具。

Supported types: scatter (XY points), bar, pie, bullet, donut and gauge.

支持的类型:散射(XY点),条形,饼形,子弹,甜甜圈和仪表。

Usage examples with various options can be found on the projects GitHub repo

可以在项目GitHub repo上找到具有各种选项的用法示例

命令行Unix基于ASCII的图表/绘图工具

命令行Unix基于ASCII的图表/绘图工具

#1


108  

Try gnuplot. It has very powerful graphing possibilities.

试试gnuplot。它具有非常强大的图形可能性。

It can output to your terminal in the following way:

它可以通过以下方式输出到您的终端:

gnuplot> set terminal dumb
Terminal type set to 'dumb'
Options are 'feed 79 24'
gnuplot> plot sin(x)

   1 ++----------------**---------------+----**-----------+--------**-----++
     +                *+ *              +   *  *          +  sin(x) ****** +
 0.8 ++              *    *                *    *                *    *   ++
     |               *    *                *    *                *    *    |
 0.6 ++              *     *              *      *              *      *  ++
     *              *       *             *       *             *      *   |
 0.4 +*             *       *             *       *             *      *  ++
     |*            *        *            *        *            *        *  |
 0.2 +*            *        *            *        *            *        * ++
     | *          *          *          *          *          *          * |
   0 ++*          *          *          *          *          *          *++
     |  *         *           *         *           *         *           *|
-0.2 ++ *         *           *         *           *         *           *+
     |   *       *            *        *            *        *            *|
-0.4 ++  *       *            *        *            *        *            *+
     |   *      *              *      *              *      *              *
-0.6 ++  *      *              *      *              *      *             ++
     |    *     *               *     *               *    *               |
-0.8 ++    *   *                 *   *                *    *              ++
     +     *  *        +         *  *   +              *  *                +
  -1 ++-----**---------+----------**----+---------------**+---------------++
    -10               -5                0                 5                10

#2


57  

While gnuplot is powerful, it's also really irritating when you just want to pipe in a bunch of points and get a graph.

虽然gnuplot功能强大,但当你想要在一堆点中输入并获得图表时,它也会非常恼人。

Thankfully, someone created eplot (easy plot), which handles all the nonsense for you.

值得庆幸的是,有人创建了eplot(简单的情节),它可以为你处理所有废话。

It doesn't seem to have an option to force terminal graphs; I patched it like so:

它似乎没有强制终端图的选项;我修补它是这样的:

--- eplot.orig  2012-10-12 17:07:35.000000000 -0700
+++ eplot       2012-10-12 17:09:06.000000000 -0700
@@ -377,6 +377,7 @@
                # ---- print the options
                com="echo '\n"+getStyleString+@oc["MiscOptions"]
                com=com+"set multiplot;\n" if doMultiPlot
+               com=com+"set terminal dumb;\n"
                com=com+"plot "+@oc["Range"]+comString+"\n'| gnuplot -persist"
                printAndRun(com)
                # ---- convert to PDF

An example of use:

使用示例:

[$]> git shortlog -s -n | awk '{print $1}' | eplot 2> /dev/null


  3500 ++-------+-------+--------+--------+-------+--------+-------+-------++
       +        +       +        "/tmp/eplot20121012-19078-fw3txm-0" ****** +       *                                                                    |  3000 +*                                                                  ++       |*                                                                   |       | *                                                                  |  2500 ++*                                                                 ++       | *                                                                  |
       |  *                                                                 |
  2000 ++ *                                                                ++
       |  **                                                                |
  1500 ++   ****                                                           ++
       |        *                                                           |
       |         **                                                         |
  1000 ++          *                                                       ++
       |            *                                                       |
       |            *                                                       |
   500 ++            ***                                                   ++
       |                **************                                      |
       +        +       +        +    **********  +        +       +        +
     0 ++-------+-------+--------+--------+-----***************************++
       0        5       10       15       20      25       30      35       40

#3


23  

Another option I've just run across is bashplotlib. Here's an example run on (roughly) the same data as my eplot example:

我刚遇到的另一个选择是bashplotlib。这是一个示例(大致)与我的eplot示例相同的数据运行:

[$]> git shortlog -s -n | awk '{print $1}' | hist

 33|   o
 32|   o
 30|   o
 28|   o
 27|   o
 25|   o
 23|   o
 22|   o
 20|   o
 18|   o
 16|   o
 15|   o
 13|   o
 11|   o
 10|   o
  8|   o
  6|   o
  5|   o
  3|   o o     o
  1|   o o     o o       o
  0|   o o o o o o       o
    ----------------------

-----------------------
|       Summary       |
-----------------------
|   observations: 50  |
| min value: 1.000000 |
|  mean : 519.140000  |
|max value: 3207.000000|
-----------------------

Adjusting the bins helps the resolution a bit:

调整垃圾箱有助于提高分辨率:

[$]> git shortlog -s -n | awk '{print $1}' | hist --nosummary --bins=40

 18|   o
   |   o
 17|   o
 16|   o
 15|   o
 14|   o
 13|   o
 12|   o
 11|   o
 10|   o
  9|   o
  8|   o
  7|   o
  6|   o
  5|   o   o
  4|   o   o o
  3|   o o o o   o
  2|   o o o o   o
  1|   o o o o   o                     o       o
  0|   o o o o o o           o     o   o o   o o                                 o
   |   o o o o o o           o     o   o o   o o                                 o
    --------------------------------------------------------------------------------

#4


16  

Plots in a single line are really simple, and can help one see patterns of highs and lows.
See also pysparklines.
(Does anyone know of unicode slanting lines, which could be fit together to make line, not bar, plots ?)

单行中的绘图非常简单,可以帮助人们看到高点和低点的模式。另见pysparklines。 (有没有人知道unicode斜线,它们可以组合在一起制作线条,而不是条形图,情节?)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division
import numpy as np

__version__ = "2015-01-02 jan  denis"


#...............................................................................
def onelineplot( x, chars=u"▁▂▃▄▅▆▇█", sep=" " ):
    """ numbers -> v simple one-line plots like

f ▆ ▁ ▁ ▁ █ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁  osc 47  ▄ ▁ █ ▇ ▄ ▆ ▅ ▇ ▇ ▇ ▇ ▇ ▄ ▃ ▃ ▁ ▃ ▂  rosenbrock
f █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ █ ▅ ▁ ▁ ▁ ▁  osc 58  ▂ ▁ ▃ ▂ ▄ ▃ ▅ ▄ ▆ ▅ ▇ ▆ █ ▇ ▇ ▃ ▃ ▇  rastrigin
f █ █ █ █ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁  osc 90  █ ▇ ▇ ▁ █ ▇ █ ▇ █ ▇ █ ▇ █ ▇ █ ▇ █ ▇  ackley

Usage:
    astring = onelineplot( numbers [optional chars= sep= ])
In:
    x: a list / tuple / numpy 1d array of numbers
    chars: plot characters, default the 8 Unicode bars above
    sep: "" or " " between plot chars

How it works:
    linscale x  ->  ints 0 1 2 3 ...  ->  chars ▁ ▂ ▃ ▄ ...

See also: https://github.com/RedKrieg/pysparklines
    """

    xlin = _linscale( x, to=[-.49, len(chars) - 1 + .49 ])
        # or quartiles 0 - 25 - 50 - 75 - 100
    xints = xlin.round().astype(int)
    assert xints.ndim == 1, xints.shape  # todo: 2d
    return sep.join([ chars[j] for j in xints ])


def _linscale( x, from_=None, to=[0,1] ):
    """ scale x from_ -> to, default min, max -> 0, 1 """
    x = np.asanyarray(x)
    m, M = from_ if from_ is not None \
        else [np.nanmin(x), np.nanmax(x)]
    if m == M:
        return np.ones_like(x) * np.mean( to )
    return (x - m) * (to[1] - to[0]) \
        / (M - m)  + to[0]


#...............................................................................
if __name__ == "__main__":  # standalone test --
    import sys

    if len(sys.argv) > 1:  # numbers on the command line, may be $(cat myfile)
        x = map( float, sys.argv[1:] )
    else:
        np.random.seed( 0 )
        x = np.random.exponential( size=20 )

    print onelineplot( x )

#5


14  

feedgnuplot is another front end to gnuplot, which handles piping in data.

feedgnuplot是gnuplot的另一个前端,它处理数据中的管道。

    $ seq 5 | awk '{print 2*$1, $1*$1}' |
      feedgnuplot --lines --points --legend 0 "data 0" --title "Test plot" --y2 1
                  --terminal 'dumb 80,40' --exit

                                     Test plot

     10 ++------+--------+-------+-------+-------+--------+-------+------*A 25
        +       +        +       +       +       +        +       +    **#+
        |       :        :       :       :       :        : data 0+**A*** |
        |       :        :       :       :       :        :       :** #   |
      9 ++.......................................................**.##....|
        |       :        :       :       :       :        :    ** :#      |
        |       :        :       :       :       :        :  **   #       |
        |       :        :       :       :       :        :**   ##:      ++ 20
      8 ++................................................A....#..........|
        |       :        :       :       :       :      **:   #   :       |
        |       :        :       :       :       :    **  : ##    :       |
        |       :        :       :       :       :  **    :#      :       |
        |       :        :       :       :       :**      B       :       |
      7 ++......................................**......##................|
        |       :        :       :       :    ** :    ##  :       :      ++ 15
        |       :        :       :       :  **   :   #    :       :       |
        |       :        :       :       :**     : ##     :       :       |
      6 ++..............................*A.......##.......................|
        |       :        :       :    ** :     ##:        :       :       |
        |       :        :       :  **   :    #  :        :       :       |
        |       :        :       :**     :  ##   :        :       :      ++ 10
      5 ++......................**........##..............................|
        |       :        :    ** :      #B       :        :       :       |
        |       :        :  **   :    ## :       :        :       :       |
        |       :        :**     :  ##   :       :        :       :       |
      4 ++...............A.......###......................................|
        |       :      **:     ##:       :       :        :       :       |
        |       :    **  :   ##  :       :       :        :       :      ++ 5
        |       :  **    : ##    :       :       :        :       :       |
        |       :**    ##B#      :       :       :        :       :       |
      3 ++.....**..####...................................................|
        |    **####      :       :       :       :        :       :       |
        |  **## :        :       :       :       :        :       :       |
        B**     +        +       +       +       +        +       +       +
      2 A+------+--------+-------+-------+-------+--------+-------+------++ 0
        1      1.5       2      2.5      3      3.5       4      4.5      5

#6


6  

gnuplot is the definitive answer to your question.

gnuplot是你问题的最终答案。

I am personally also a big fan of the google chart API, which can be accessed from the command line with the help of wget (or curl) to download a png file (and view with xview or something similar). I like this option because I find the charts to be slightly prettier (i.e. better antialiasing).

我个人也是谷歌图表API的忠实粉丝,可以在wget(或curl)的帮助下从命令行访问以下载png文件(并使用xview或类似的东西查看)。我喜欢这个选项,因为我发现图表稍微漂亮(即更好的抗锯齿)。

#7


5  

See also: asciichart (implemented in Node.js, Python, Java, Go and Haskell)

另请参见:asciichart(在Node.js,Python,Java,Go和Haskell中实现)

命令行Unix基于ASCII的图表/绘图工具

#8


3  

A very heavy and overpowered solution would be to install cernlib and use paw.

一个非常沉重和过于强大的解决方案是安装cernlib并使用paw。

#9


3  

You should use gnuplot and be sure to issue the command "set term dumb" after starting up. You can also give a row and column count. Here is the output from gnuplot if you issue "set term dumb 64 10" and then "plot sin(x)":

您应该使用gnuplot并确保在启动后发出命令“set term dumb”。您还可以提供行数和列数。如果你发出“set term dumb 64 10”然后“plot sin(x)”,这是gnuplot的输出:

 

    1 ++-----------****-----------+--***-------+------****--++
  0.6 *+          **+  *          +**   *      sin(x)*******++
  0.2 +*         *      *         **     **         *     **++
    0 ++*       **       *       **       *       **       *++
 -0.4 ++**     *         **     **         *      *         *+
 -0.8 ++ **   *     +      *   ** +         *  +**          +*
   -1 ++--****------+-------***---+----------****-----------++
     -10           -5             0            5             10


It looks better at 79x24 (don't use the 80th column on an 80x24 display: some curses implementations don't always behave well around the last column).

它看起来更好79x24(不要在80x24显示器上使用第80列:一些curses实现并不总是在最后一列周围表现良好)。

I'm using gnuplot v4, but this should work on slightly older or newer versions.

我正在使用gnuplot v4,但这应该适用于较旧或较新的版本。

#10


1  

Here is my patch for eplot that adds a -T option for terminal output:

这是我的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

Using this you can run it as eplot -T to get ASCII-graphics result instead of a gnuplot window.

使用此方法,您可以将其作为eplot -T运行,以获取ASCII图形结果而不是gnuplot窗口。

#11


0  

Another simpler/lighter alternative to gnuplot is ervy, a NodeJS based terminal charts tool.

gnuplot的另一个更简单/更轻的替代方案是ervy,一种基于NodeJS的终端图表工具。

Supported types: scatter (XY points), bar, pie, bullet, donut and gauge.

支持的类型:散射(XY点),条形,饼形,子弹,甜甜圈和仪表。

Usage examples with various options can be found on the projects GitHub repo

可以在项目GitHub repo上找到具有各种选项的用法示例

命令行Unix基于ASCII的图表/绘图工具

命令行Unix基于ASCII的图表/绘图工具