Hacker News new | ask | show | jobs
Guff – A plot device (github.com)
30 points by exupero 3932 days ago
2 comments

This can already be done with gnuplot though. Does guff have any advantages?

   gnuplot> set term dumb size 89,30 aspect 1      
   Terminal type set to 'dumb'
   Options are 'feed  size 89, 30 aspect 1, 1'
   gnuplot> plot [-5:6.5] sin(x) with impulse ls -1


    1 ++-----+-------------+------------+-------------+-------------+-------------+-++
      ||||++ +             +            +       ++||||+             +             +  |
  0.8 ++||||+                                  +|||||||+               sin(x) +----+++
      |||||||+                                ++||||||||+                            |
      ||||||||+                               |||||||||||+                           |
  0.6 ++|||||||                              +||||||||||||                          ++
      |||||||||+                            +|||||||||||||+                          |
  0.4 ++||||||||+                           +||||||||||||||+                        ++
      |||||||||||                          +||||||||||||||||                         |
      |||||||||||                          |||||||||||||||||+                        |
  0.2 ++|||||||||+                        +||||||||||||||||||                       ++
      ||||||||||||+                      +|||||||||||||||||||+                      +|
    0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      |            +|||||||||||||||||||||                      ||||||||||||||||||||| |
      |             +|||||||||||||||||||+                      +|||||||||||||||||||+ |
 -0.2 ++            +||||||||||||||||||+                       +||||||||||||||||||| ++
      |              ||||||||||||||||||                         ||||||||||||||||||+  |
      |              +||||||||||||||||+                         +||||||||||||||||+   |
 -0.4 ++              +||||||||||||||+                           +||||||||||||||+   ++
      |                +|||||||||||||                             +|||||||||||||     |
 -0.6 ++                |||||||||||||                              +||||||||||||    ++
      |                 +|||||||||||+                              +|||||||||||+     |
 -0.8 ++                +||||||||||+                                +|||||||||+     ++
      |                  ++||||||++                                  +||||||++       |
      |      +             ++|||+       +             +             + ++||||      +  |
   -1 ++-----+-------------+------------+-------------+-------------+-------------+-++
            -4            -2            0             2             4             6
Guff can be used from the command line in a pipe?
Apparently so can gnuplot, however the syntax is really awful.

    awk 'BEGIN{ for(x=-5;x<6.5;x+=0.1){printf("%s\t%f\n", x, sin(x))} }' \
      | gnuplot -p -e "set term dumb size 89,30 aspect 1;plot '<cat'"
Gnuplot really isn't made for that kind of usage, so guff does fill a valuable niche. Though you could also just write a wrapper around gnuplot with an interface that works better for command line usage(this probably already exists).
You could accomplish this in gnuplot, but guff does have some nice defaults that don't require you to write a script before you do the plotting.
+1 for the name
I'm still waiting for Guffman