4 ms·
Basic Scripting with Awk and Gnuplot
- FlyMoreRockets 6y agoI note with interest the article links to: https://ferd.ca/awk-in-20-minutes.html https://ferd.ca/awk-in-20-minutes.html Very succinct quickstart guide.
- EarthIsHome 6y agoI want to use gnuplot more, but I generally find myself spending too much time messing with the plot styles to get something I sort of like. Can anyone point to some pretty styles they've come across? Here is one I used a while ago: Pretty Plots with Gnuplot [0] [0]: https://edg.uchicago.edu/tutorials/pretty_plots_with_gnuplot/ https://edg.uchicago.edu/tutorials/pretty_plots_with_gnuplot...
- tyingq 6y agoXkcd style perhaps? https://github.com/rfonseca/xkcd-gnuplot https://github.com/rfonseca/xkcd-gnuplot
- andrepd 6y agoSome problems: the colours are not that great, and also not colourblind-safe. And most grating of all: why are the tics light gray and not black! It's very hard to read.
- hatmatrix 6y agoJust curious but why go for gnuplot (and awk) rather than python or R? At some point you run up to some limit where you want a bit more capability. I don't know that the learning curve is that much less for awk + gnuplot?
- leephillips 6y agoGnuplot (and awk) have several advantages. It’s faster, especially for large datasets; it’s language-independent and can be used through pipes with any language, so the plotting solution you develop can go with you as you change your simulation language; it’s designed to be automated, plot over the network, etc.
- yiyus 6y agoThere is no need to initialize variables with -v. You could just do: awk '/Time/{printf("%d %s ", ++j, $3)} ...
- tragomaskhalos 6y agoOr use a begin block: 'BEGIN { j = 1 } /Time/ … ' I find it best to restrict the use -v to injecting environment variables into my awk scripts.
- deleted 6y ago[deleted]
- dan-robertson 6y agoBeware when piping awk | gnuplot or especially awk | awk: when printing numbers, awk by default prints them with something like %.6g, which can lose important amounts of precision. There are two ways this can happen. Firstly when numbers are implicitly converted to strings, eg for concatenation; and secondly when they are printed directly. These conversations are controlled by two different variables which may be set to printf directives to get higher precision.