Search code examples
unixchartsgraphmatplotlib

Command-line Unix ASCII-based charting / plotting tool


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.

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.


Solution

  • Try gnuplot. It has very powerful graphing possibilities.

    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