31

I believe R can generate stem-and-leaf for ascii histograms, and scatter plots using this code from Matt Shotwell.

Can it also generate ASCII based line graphs, like this from GNUPlot?

Ming K
  • 1,117
  • 1
  • 13
  • 20

2 Answers2

35

You should look at the fairly recent txtplot package. Currently, it includes scatterplot, line plot, density plot, acf, and bar chart.

From the online help,

> txtplot(cars[,1], cars[,2])
    +----+------------+------------+-----------+------------+--+
120 +                                                     *    +
    |                                                          |
100 +                                                          +
    |                                                     * *  |
 80 +                           *         *                    +
    |                                        *       *    *    |
 60 +                           *              *               +
    |                              *    * *    *       *       |
 40 +                         *      *  * *  *                 +
    |                 *       * *    *  *    * *               |
 20 +         *       *  * *  * *  *                           +
    |            *    *  * *                                   |
    |  *      *    *                                           |
  0 +----+------------+------------+-----------+------------+--+
         5           10           15          20           25   
chl
  • 27,771
  • 5
  • 51
  • 71
  • Thanks, that is helpful. However looks like the main function txtplot() can only handle 1 data series. I'd like to be able to plot 2 sets of data. – Ming K Feb 05 '12 at 18:59
  • 1
    With the example shown above, you can play with the `pch` argument, e.g. `txtplot(cars[,1], cars[,2], pch=letters[1:2])`. This assumes that you arrange your x and y accordingly (alternating, or stacking). I can show an example, but I think it is fairly basic and you got the idea. – chl Feb 05 '12 at 19:43
8

I know there is support for basic interaction between R and GnuPlot in the TeachingDemos package. Perhaps that can achieve what you want.

Dr G
  • 3,987
  • 2
  • 19
  • 25