# Plot

Plot is a tool to generate graphs from CSVs or JSON, similar to GNUPlot.
It aims to be smaller and easier to use than GNUPlot.

Click here to download the zip file containing binaries for the following platforms:

- plot.exe - Windows 64-bit
- plot.mac - MacOS
- plot.linux - Linux 64-bit
- plot.rpi - Raspbian 32-bit
- plot.android - Android 64-bit

### Example 1: Line Graph from CSV

If test.csv is like:

t,score,positive,negative
0.0,886,1019,771
0.1,933,1017,856
0.2,932,1013,858
0.3,943,1013,879
0.4,961,977,947
0.5,960,972,949
0.6,960,972,950
0.7,960,972,950
0.8,776,571,1055
0.9,767,554,1064
1.0,162,24,1102

And we type:

$ plot test.csv

We get:

### Example 2: Bar Graph from JSON

If motion.json is like:

[
[ "hour", "motion" ],
[ "1p", 22 ],
[ "2p", 11 ],
[ "3p", 11 ],
[ "4p", 19 ],
[ "5p", 17 ],
[ "6p", 24 ],
[ "7p", 3 ],
[ "8p", 0 ],
[ "9p", 0 ],
[ "10p", 2 ],
[ "11p", 0 ],
[ "12a", 0 ],
[ "1a", 1 ],
[ "2a", 0 ],
[ "3a", 0 ],
[ "4a", 6 ],
[ "5a", 0 ],
[ "6a", 0 ],
[ "7a", 0 ],
[ "8a", 1 ],
[ "9a", 5 ],
[ "10a", 11 ],
[ "11a", 13 ],
[ "12p", 7 ],
[ "1p", 6 ],
[ "2p", 0 ]
]

And we type:

$ plot motion.json bar

We get:

### Example 3: Scatter Plot with Linear Regression

If etfs.csv is like:

Date,QQQ,SPY
"Jun 16, 2017",138.72,242.77
"Jun 15, 2017",138.35,242.68
"Jun 14, 2017",140.92,244.86
"Jun 13, 2017",140.01,243.98
"Jun 12, 2017",138.84,243.13
"Jun 9, 2017",143.73,244.09
"Jun 8, 2017",143.74,243.77
"Jun 7, 2017",143.23,243.6
"Jun 6, 2017",143.28,243.34
...

And we type:

$ plot etfs.csv linreg QQQ SPY

We get:

Linear regression: 127.488 + 0.81729*x = y ± 1.67399

### Usage

USAGE:
plot [input .csv or .json] [type] [col1] [col2] ... [-o output]
WHERE:
-input is .csv or .json table where first row is headers
-type is [line|scatter|linreg|bar]
-col1 is the x-axis
-col2+ is the y-axis
-[output] is where to save the file. If not specified, the default
is [input].png

### How is this better than GNUPlot?

In general, it's easier to use and requires less typing.