Hacker News new | past | comments | ask | show | jobs | submit login
Gnuplotting – Create scientific plots using gnuplot (gnuplotting.org)
162 points by type0 on Sept 23, 2016 | hide | past | favorite | 50 comments



I've been using GNUplot in a recent project of mine and it has really been a nice experience.

The project is a toolkit for Orbital mechanics written in C. There's a test framework that generates a physical scenario, say two satellites colliding in orbit, and then goes on to solve some difficult problem, like find when and where a collision occurs.

I've been dumping the initial situation, some auxiliary variables and the steps taken by the algorithm to simple text files and then plotting it out with GNUplot.

Sure there are a lot of alternatives, but I really didn't want to embed anything in my C program or start writing a separate plotting tool in another language.

GNUplot isn't great in interactive 3d plots but it works. For 2d plots, doing some derivatives and displaying the algorithm steps, it has worked great.

Not a pretty tool, but it does the job and I don't really know of a better tool for my use.

For ad-hoc plots, I have some key bindings in my $EDITOR for executing GNUplot. For more complex cases, I run it with a Makefile.


Look at this: https://github.com/dkogan/feedgnuplot

It is magical


Thanks!

I've been looking for something like this for some other projects with real time data.


Minor nitpick, but it's "gnuplot" (a pun on the Newplot), the program is not affiliated with GNU in any way. It's not even licensed under the GPL.


Wow I didn't know this. And apparently you cant even redistribute modified source, only patchsets (like Minix) meaning it can't easily be forked. Bit scandalous that something that brands itself "gnu" isn't even free software by GNU standards.


They picked the name in the mid-1980s, around the same time as the GNU project was founded. Well, the GNU project came first - the GNU manifesto dates to 1985, whereas I believe the first release of gnuplot was 1986 - and the gnuplot authors were apparently aware of the GNU project at the time, but I don't know if they foresaw that GNU would be as successful as it has been. I think the gnuplot authors' naming choice is more defensible in its historical context than if someone made the same naming decision today; and, now they've been using their current name for around 30 years, they obviously don't want to change it.


How widely used is Gnuplot these days? In my community (statistics), I haven't heard of anyone using it at all, just people using Matplotlib, ggplot2, or R base graphics.

I used Gnuplot five or ten years ago when I barely knew of anything else, but I don't have a sense of what its advantages are these days.


I use gnuplot heavily. It was good 20 years ago, and it's good today. The problem with people rewriting the wheel, is that every new wheel misses lots of features from the tool they're trying to replace, and does many things differently for no good reason. The efforts of the matlotlib, ggplot2 (and so on) would have been much more usefully spent contributing to gnuplot. Instead we have a large number of half-assed tools instead of 1 truly great one.


I guess I have to disagree.

> It was good 20 years ago, and it's good today.

I wasn't using such things 20 years ago, but 10 years ago gnuplot was a crufty relic and a right pain in the bum to use for anything beyond the most basic of plots. Together with LaTeX, it was one of the things that made getting into CS research much more difficult than necessary. We need fewer barriers to entry in this field, not more.

Also, a fun fact: gnuplot is not GNU. It has this weird custom license that disallows distribution of modified versions and is incompatible with the GPL. http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright...

I used to wonder how something so old could be so bad, and how newer projects like matplotlib managed to race ahead of it. I think the license explains a lot.

Edit: I should add - if gnuplot works for you, more power to you! Use what works. But I've been much happier since I discovered matplotlib in about 2006.


> Together with LaTeX, it was one of the things that made getting into CS research much more difficult than necessary

I'm sad you feel this way because I've really enjoyed working with GNUplot and Latex. Sure it has some warts but it generally works well.

I might have a test or benchmark that produces results, a GNUplot script to plot it and a Latex document it's embedded to. The whole process from source code to PDF is automated, change the benchmarks, run make and you have a report.

Sure there are more user friendly alternatives, or apps that work better in interactive mode, but imagine doing the workflow above using, say, Excel and Word. Or Matplotlib and Google Docs.


My experience is very different for LaTeX. The learning curve was huge, but it's totally paid off. I can't imagine writing papers in anything else.

10 years ago I was running experiments using Python code that wrote gnuplot scripts and LaTeX tables. Now I cut out the middle man, and the Python scripts make the graphs themselves.


Or R and knitr. Oh, wait...


Then you're tied to R, I can see the appeal of language agnostic tools.


This another demonstration how people can differ. A specific reason I liked gnuplot was the ease with which I could integrate it in my code, latex and xfig workflow. In fact that was perhaps the only thing that I liked about it.


I switched to matplotlib a few years after you, but I agree. Once I did, I never wanted to go back. I find matplotlib a pleasure to use, whereas I felt like I was always fighting gnuplot.


You can distribute the modifications in patches; i.e. what all the distros already do anyway.

As for matplotlib, there's no reason at all for it to be making plots. It just needed to provide a plotting interface to numpy, and the backend is almost irrelevant. They could EASILY have reused existing tools for the backend, and contributed upstream to fix whatever deficiencies they thought existed.


No.

The whole point of matplotlib is interactivity and embedability in GUI toolkits.

There was nothing else that meet those criteria in Python at the time, and the other options were GUI toolkit specific.

Try finding something else that you can seamlessly embed in Tk, Gtk, Qt, Wx, etc with full interactivity that still creates publication quality static plots.


Nope. For reference the whole point of mpl was a numpy backed plotting library which was easy to switch to from matlab - hence the gross plt.xxx api for matlab compatibility. That it was relatively toolkit agnostic was a choice to help it's adoption, but as matlab interactivity was basically only hover showing values, so was mpls initially.


Gnuplot interface is a little dated, so custom visualisations are not so easy yet many disciplines today have a bunch of them. This should not have been a problem but it is because the gnuplot licence makes it unforkable and that discourages contributions. Contributions -- that would allow it to evolve, e.g into a base package (API) onto which other plotting packages could be built. I think this would be an irresistible allure since gnuplot is in my experience the fastest plotting package out there.


Good points, but the thing about matplotlib is it's Python so you have an integrated solution for scientific data analysis and visualization. Instead of having 10 different tools, you have one. Still, I find the plots on the gnuplotting site to be quite impressive -- at least as good as matplotlib. (I end up using both, gnuplot -- b/c of emacs integration -- and matplotlib.)


ggplot2 does things differently for several good reasons -- for example, by rebuilding the interface around the grammar of graphics, making construction and composition of plots much more coherent. http://vita.had.co.nz/papers/layered-grammar.pdf


Same here. I was a somewhat heavy user of gnuplot and Grace (http://plasma-gate.weizmann.ac.il/Grace/ , anybody remember that one, heh?), but what caused me to abandon them was that I needed much more than a plotting program. I made myself a python-based workflow/analysis environment, where I slurped in the results of simulations, did various munging on the data, some (somewhat custom) regression fits, generation of input data to other simulations etc. And yes, on-screen and later on publication quality plots too. matplotlib was a godsend here, really. Sure, I could have coded up some gnuplot/grace interface (say, generate input files and shelling out to the program), but, ugh, why?


I've used it for all the plots in my thesis. AFAIK, it's the only plotting library that does what gnuplot's epslatex terminal does: graphical elements are placed in an EPS file, while textual elements are placed as TeX, letting me have exactly the same fonts and sizes in the plots and in the rest of the thesis.


The possibility of making later (small) adjustments in the tex-file is one huge advantage.


I use it daily for my work. It fits much better in the unix environment than other tools,


Me too. When you start handling huge amounts of data, Gnuplot starts to warm up where other tools break. It is fast as hell.


Gnuplot dies when fed hundreds of megabytes of data. At some point you have to start making your own tools. Here's an example:

http://kmkeen.com/rtl-power/tholin_rtlsdr.png

Every pixel is a datapoint. There are only 1.5M values in that render (3-tuples of time, frequency and intensity) but the resolution of that chart is pretty low. People casually do charts a hundred times larger. Then you start running into other problems, like sharing the images. Firefox won't display images wider/taller than 32k px for example.


Hey that's a really interesting chart! Do you mind if I post it on /r/dataisbeautiful ? Is there an accompanying article?


What tool is used for this?


I really like gnuplot as a nice, lightweight alternative to matplotlib. Plus, it has great emacs, org-mode, babel integration. gnuplotting is an impressive resource and I had no idea plots could get so sophisticated with different earth projections, for example.


I was wondering the exact same thing. I'm in condensed matter and gnuplot is seen as a relic more than anything else. Most people in my field use origin, matlab or python.


>Most people in my field use origin

I'm surprised origin is still used. I used it some 20 years ago.


Matlab uses Gnuplot.


What do you mean?


My mistake, they only share some syntax.


If you're using LaTeX anyway, then you might be interested in TikZ [1]. This repo [2] contains some of the figure I created for my thesis.

[1] http://www.texample.net/tikz/examples/feature/plotting/

[2] https://github.com/jeroenjanssens/phd-thesis


gnuplot has a tikz terminal! So now you can have a paper with citation links in the figure's keys. Really neat, but too much for most publishers and their publishing software solution.


I use Tikz too for plotting on LaTeX. The result is really nice. By the way, thank you for sharing.


Beautiful use of TikZ there! Thanks for sharing!


I've used GNU Plot to create this lovely 3D animation of my running data (GPS tracks).

https://vimeo.com/96479940

Some Ruby scripting and ffmpeg was also involved. Here is the code - https://github.com/otobrglez/movement


I'd recommend my Veusz scientific plotting package if you want a free scriptable GUI plotting tool. It's much easier to use than the aged gnuplot and is more flexible for 2D plotting (3D is coming!)

http://home.gna.org/veusz/


I keep meaning to use Veusz more. I'd also to really try out kst properly https://kst-plot.kde.org


Here is a nice video on the new Matlab palette, and why it could be better: https://www.youtube.com/watch?v=xAoljeRJ3lU


Gnuplot is one of the reasons that makes me love the open source/Unix world every time I use it. Writing a plot in code, embedding it in LaTeX... all while having the fingers on the keyboard. You get connected to your machine like that.


I was a loyal Gnuplot user for many years until I got fed up with a bug where tick labels wouldn't be centered with ticks in LaTeX output without some manual hacks. I can see from one of the posts that this issue still exists.

Plus it was easier to just do everything in Python and not have to use a separate process to plot in the end.

Nevertheless, I still find it useful. Nothing else seems as easy to quickly plot an analytical function: `gnuplot -p -e "sin(x)"`


In my experience, if you send the bugs to their bug tracker they are immediately corrected and/or a workaround is suggested. The devs are very helpful.


I used to use this to analyze ab load testing results. After ipython notebooks (mathplotlib) , its been a long time, since I have looked into this.


Oh yeah, those were the days where we plotted graphs for our bachelor thesis where we were showing how many messages and clients our generic game server written in Erlang and the V8 js-engine could handle: https://jeena.net/t/GGS.pdf page 40 pp


Should be possible to create interactive svg's


maxima and wxmaxima computer algebra software are using gnuplot.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: