gnuplot - How can I plot several charts from a set of sample data? -
i've got dataset i'd generate set of plots from, , i'm having trouble getting gnuplot it.
i've got dataset following columns:
- time (timestamp in iso-8601 format
yyyy-mm-ddthh:mm:ss.sssz
) - client (hostname of client; 2 distinct clients in dataset)
- server (hostname of server; 8 distinct servers in dataset)
- two related stats, a1 , a2
- two other related stats, b1 , b2
a given timestamp has single sample in it. have around 7000 rows in dataset. example rows like:
time | client | server | stat a1 | stat a2 | stat b1 | stat b2 --------------------+----------+----------+---------+---------+---------+-------- 2015-04-01t03:47:12 | client-x | server-1 | 12.2 | 20.0 | 2.3 | 7.0 2015-04-01t03:49:09 | client-y | server-6 | 15.0 | 25.2 | 10.0 | 15.2
i'd generate 4 plots, line charts, 1 every combination of related stats , client.
- client-x , stats a1 , a2
- client-x , stats b1 , b2
- client-y , stats a1 , a2
- client-y , stats b1 , b2
at point, @ at complete loss how approach gnuplot. i'm open other options generating plot, needs scriptable new/updated datasets.
in order line plots, must data filtering outside of gnuplot, e.g. awk
:
first setup time format with
set xdata time set timefmt '%y-%m-%dt%h:%m:%s'
then extract possible client name, unless know possible client names:
clients = system("awk '!/^#/ { print $2 }' test.dat | sort | uniq")
and plot data using multiplot
set style data lines set multiplot layout 2,2 [client in clients] { set title sprintf("client '%s'", client) plot sprintf('< grep ''\b%s\b'' test.dat', client) using 1:4 title "a1", '' using 1:5 title "a2" plot sprintf('< grep ''\b%s\b'' test.dat', client) using 1:6 title "b1", '' using 1:7 title "b2" } unset multiplot
the question quite similar how use 1 of column of data legend in gnuplot?.
Comments
Post a Comment