• Stars
    star
    275
  • Rank 149,796 (Top 3 %)
  • Language
    C
  • License
    ISC License
  • Created over 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a plot device

guff: a plot device

guff reads a stream of points from a file / stdin and plots them.

guff is short for MacGuffin.

guff is distributed under the ISC License.

Plots them?

It can plot to stdout:

$ wc -l *.c | grep -v total | sort -nr | awk '{print($1)}' | ./guff -d 72x30
    x: [0 - 15]    y: [0 - 302] -- 0: #
+                                                                       
#                                                                       
|                                                                       
|                                                                       
|                                                                       
+                                                                       
|    #                                                                  
|                                                                       
|        #                                                              
|                                                                       
+             #                                                         
|                  #                                                    
|                      #                                                
|                           #                                           
|                                                                       
+                                #                                      
|                                                                       
|                                    #                                  
|                                                                       
|                                                                       
+                                                                       
|                                                                       
|                                         #    #                        
|                                                  #                    
|                                                       #               
+                                                                       
|                                                            #          
|                                                                       
|                                                                #    # 
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-


$ ./guff -d 40x20 -m count test_sin
    x: [0 - 720]    y: [-1 - 1]
+                                       
|                          ijjh         
|                        9j1  2j8       
|                       ba      ba      
|                      98        98     
+                     6a          b5    
|                    1d            e    
|                    e              e   
|                   94              58  
|                  2a                a2 
6----+----+----+---d+----+----+----+--8-
49                94                    
|a3              49                     
| e              e                      
| 2c            d1                      
+  78          96                       
|   b6        7a                        
|    d7      8c                         
|     cg    hb                          
|      3jjjj2                           

Or to SVG:

$  wc -l *.c | grep -v total | sort -nr | awk '{print($1)}' | ./guff -s -m line -r > example.svg

cat <<EOF | ./guff -s -x -m count
1 1
1 2
-2 -3
3 -4
-2 -3
2 4
3 -4
1 2
3 5
-2 -3

Input format

guff reads a stream of lines of floating point numbers, separated by a single character:

1 2.0 3

and

1,2,3

both read as 1.0, 2.0, 3.0.

If multiple separators appear, then the value is treated as missing for that column's row:

1,,3

reads as 1.0, [missing value], 3.0.

Any line beginning with "/" or "#" is ignored, and anything else that strtod(3) considers an ill-formatted number (e.g. "-") will lead to the rest of the line being skipped.

Blank lines

Blank lines make guff plot and reset. For example, guff can be used to convert an infinite stream of data periodically broken up by blank lines into an infinite stream of SVG plots, also broken up by blank lines. (The included script, discretion, splits these into timestamped SVG files and updates a symlink to the newest.)

Why write another plotter?

Not everything has graphic libraries installed (or a graphic environment at all), and sometimes it's helpful to get a rough feel for data's distribution from a text-mode command line. SVG images can also be generated pretty easily.

Installation

guff depends on on nothing besides a standard POSIX environment.

To build it, type make.

To run the tests, type make test.

Usage

Usage: guff [-A] [-c] [-d WxH] [-f] [-h] [-l xyc]
            [-m MODE] [-r] [-s] [-S] [-x] [FILE]

Common options:

-d WxH: set width and height (e.g. "-d 72x40", "-d 640x480")
-f: flip x & y axes in plot
-h: print help message
-l LOG: any of 'x', 'y', 'c' -- set X, Y, and/or count to log scale
-m MODE: dot, count, line (SVG only), default dot
-s: render to SVG
-x: treat first column as X for all following Y columns (def: use row count)

SVG only:

-c: use colorblind-safe default colors
-r: draw linear regression lines

Other options (mostly for internal testing):

-A: don't draw axes
-S: disable stream mode

For more details, see the man page.

More Repositories

1

greatest

A C testing library in 1 file. No dependencies, no dynamic allocation. ISC licensed.
C
1,467
star
2

theft

property-based testing for C: generate input to find obscure bugs, then reduce to minimal failing input
C
609
star
3

autoclave

repeatedly run programs until they break, and be ready to attach a debugger
C
188
star
4

ff

fuzzy-completion for finding files
C
157
star
5

tamale

TAble MAtching Lua Extension - An Erlang-style pattern-matching library for Lua
Lua
146
star
6

socket99

Wrapper library for the BSD sockets API with a nicer C99 interface
C
142
star
7

lunatest

xUnit-style + randomized unit testing framework for Lua (and C projects using Lua, etc.)
Lua
83
star
8

sample

filter for random sampling of input
C
69
star
9

tangram

Jumprope-based local content store
Lua
56
star
10

skiplist

skiplist library for C.
C
54
star
11

mpool

memory pool allocator
C
47
star
12

loom

a lock-less thread pool for C99
C
43
star
13

wn

"what next?" - simple command-line task-interdependency tracker
Lua
42
star
14

curlbash

locally save and checksum/review before curl | bash-ing installers
Shell
36
star
15

spooky

C library for OOK Manchester encoding, decoding, and dynamic clock recovery
C
33
star
16

parade

run multiple shell commands in parallel and coordinate their output
C
32
star
17

lua-ukanren

Lua port of of microKanren, a minimal logic programming engine.
Lua
31
star
18

glean

lightweight search engine for local text docs
C
29
star
19

oscar

mark/sweep garbage collector for C
C
28
star
20

sidereal

Redis library for Lua, with optional non-blocking mode and Lua-style lists & sets.
Lua
27
star
21

markdown_to_reveal

minimal plumbing to convert slides in markdown to reveal.js presentations via pandoc
CSS
27
star
22

skiparray

unrolled skip list library for C
C
21
star
23

lua-memcached

A Lua client for memcached, with optional non-blocking mode.
Lua
21
star
24

skel

tiny command-line skeleton/snippet thing
C
21
star
25

hashchop

C library to deterministically chunk byte streams with a rolling hash
C
20
star
26

lua-sqlite

wrapper for sqlite3
C
19
star
27

lua-bdd

Binary decision diagram library (Lua)
Lua
17
star
28

ansible_thinkpad

Example Ansible-based setup for a 6th gen. Thinkpad X1 Carbon
Shell
16
star
29

lua-mpd

A Lua client library for mpd.
Lua
15
star
30

mqtt_demo

example using mosquitto MQTT client library
C
15
star
31

bluebottle

C library for bit-banging async serial communication (UARTs)
C
12
star
32

hopscotch

An implementation of Tarjan's Strongly Connected Components algorithm
C
12
star
33

GPL_v-3

GPL, version -3
11
star
34

zwiebel

A simple work/break interval timer for Emacs
Emacs Lisp
9
star
35

lua-bcrypt

bcrypt wrapper for Lua
Lua
9
star
36

lookup

Search for a file in parent directories, up to / .
C
7
star
37

denv

setenv via files in directory (standalone envdir clone)
C
6
star
38

motorcycle-el

motorcycle animation for the emacs modeline
Emacs Lisp
5
star
39

one_weird_C_trick

weird c vararg function pointer trick
C
5
star
40

idlewait

suspend execution until system load is low (with optional timeout)
C
5
star
41

ministat

quick adaptation of PHK's FreeBSD ministat for OpenBSD
C
5
star
42

slides-completing_the_circuit

slides: "Completing the Circuit: From Arduino to General Embedded Hardware"
CSS
5
star
43

lua-ev

libev wrapper for Lua, including most watchers
C
4
star
44

lua-endhook

Lua library to run a hook after the main script is read
Lua
4
star
45

git-nethack

git-nethack, so you can hack while you hack
Shell
3
star
46

wifi

simple OpenBSD wifi network auth manager script
3
star
47

lua-xosd

XOSD wrapper for Lua
C
3
star
48

rollavg

rolling average of file stream
C
3
star
49

presentation-Configuring_a_laptop_with_Ansible

Slides for DevOps West Michigan - "Configuring a Laptop with Ansible"
CSS
3
star
50

study-grade_up

a study in sorting stable algorithms for an APL-style grade-up operation
C
2
star
51

callaloo_web

Minimal web server for publishing current callaloo MQTT events
C
2
star
52

betwixt

Python impl. of the Burrows-Wheeler Transform for my !!Con 2015 talk
Python
1
star
53

presentation-write-a-parser-today

slides for "Write a parser today!" presentation
1
star