
Show HN: Flexible command line tool to create graphs from CSV data - miccah
https://github.com/mcastorina/graph-cli
======
Cieplak
Definitely seems like a nice API on top of matplotlib.

I’ve started using gnuplot a lot after hearing Brendan Gregg mention it a few
times. It fills a great niche for making decent graphs without having to write
code.

[http://gnuplot.sourceforge.net/demo/](http://gnuplot.sourceforge.net/demo/)

~~~
alias_neo
I hadn't used gnuplot, but when my UPS was dying, I decided I needed a
realtime graph of it recharging/discharging to see what was going on.

I called the apcupsd api from the command line and output some stats to a file
that I'd formatted into columns using awk/grep, I then found that I could
configure gnuplot to draw a graph from this file, and then update itself
automatically as the file changed.

All in all, it took me 10 minutes to put together having not used gnuplot
before and did exactly what I needed. I could watch the graph update every few
seconds/minutes and keep an eye on what was happening, and because I had
written the data to a file first, I could always go back and re-plot it later
if I had found anything interesting to re-plot for.

End result; UPS is dead, get a new one :D

~~~
akhilcacharya
I did the same thing during an internship where tensorboard wasn’t available
on our training clusters - instead I just dumped all of the training metrics I
needed into a tsv and made a gnuplot ascii graph. Worked brilliantly and took
no time to set up.

------
geraldbauer
Awesome. FYI: Find more more CSV tools at the Awesome CSV pages
[https://github.com/secretGeek/awesomecsv](https://github.com/secretGeek/awesomecsv)
and [https://github.com/csvspecs/awesome-
csv](https://github.com/csvspecs/awesome-csv) Cheers. Prost.

------
ggm
SVG emitter?

~~~
miccah
Hm, I hadn't thought of this!

It uses matplotlib to generate the graphs, which can save svg files though.
This sounds like a good feature to add.

~~~
ggm
plotly (Python and R) and ggplot (R) can do SVG. Its increadibly useful for
generating rescaleable web views.

------
enriquto
what are the advantages with respect to gnuplot?

~~~
Sean1708
How do you use gnuplot to plot a CSV file non-interactively? The only way I
could find was

    
    
      gnuplot -e "set datafile separator \",\"; set term png; set output 'foo.png'; plot 'foo.csv'"
    

and if that is the best way then that's one particularly obvious advantage of
graph over gnuplot.

~~~
enriquto
All this verbosity can be solved by a particular .gnuplotrc, but I see what
you mean.

Personally, I would rather do

    
    
        <foo.csv tr ',' ' '|gnuplot -e 'set term png;plot "-"'>foo.png

~~~
jxy
For quick plotting I use this gist for gnuplot,
[https://gist.github.com/jxy/88f2972d3994dfea06fd2d3833b7ac8a](https://gist.github.com/jxy/88f2972d3994dfea06fd2d3833b7ac8a)
which generates an ascii art plot.

But I don't really use scripts for other gnuplot terminals, because custom
tailoring for individual data set is always required to make any figure
presentable. I usually go through ConTeXt to generate PDF file for its TeX
features.

------
budadre75
can I plot certain columns, or based on title in the first row?

~~~
miccah
Columns can be chosen using the -x or -y flags. By default the x column is the
first and the y columns are everything else.

You can specify either the column name or number (1 indexed).

------
inciampati
2D plots, not graphs...

~~~
gmiller123456
I think you're using a domain specific definition of a graph. These certainly
meet the English definition of a graph[1].

[1]
[https://www.google.com/search?q=define+graph](https://www.google.com/search?q=define+graph)

------
sAbakumoff
maybe you can put some examples on the front page of the repo.

