Live data from Hacker News

Basic Scripting with Awk and Gnuplot

cyberchris.xyz

1–10 of 11 posts

Re: Basic Scripting with Awk and Gnuplot

#3
I 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...

Re: Basic Scripting with Awk and Gnuplot

#6

I 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...

Xkcd style perhaps? https://github.com/rfonseca/xkcd-gnuplot

Re: Basic Scripting with Awk and Gnuplot

#7

I 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...

Some 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.

Re: Basic Scripting with Awk and Gnuplot

#8
Beware 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.

Re: Basic Scripting with Awk and Gnuplot

#9
post #4

There is no need to initialize variables with -v. You could just do: awk '/Time/{printf("%d %s ", ++j, $3)} ...

Or 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.

Re: Basic Scripting with Awk and Gnuplot

#10

I 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...

Just 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?
Post reply on HN