graph - Plotting median values of different data files (with gnuplot) -
i have 4 different data files (for seasons) , managed make boxplots median , stuff.
but i'd show development on seasons simple line. want gnuplot plot median values (and maybe quartils or standard deviations) of 4 seasons , connect them via linespoints.
the values in 4 separate data files in 1 column - each column there 1 median (and quartils...). want ignore first few entries.
i have tried command stats error here:
stats 'variante 1\habitate\Äschen\vergleich\fru\wua_vergleich.dat' u 2 every ::5 label "ist_fru" stats 'variante 1\habitate\Äschen\vergleich\som\wua_vergleich.dat' u 2 every ::5 label "ist_som" stats 'variante 1\habitate\Äschen\vergleich\her\wua_vergleich.dat' u 2 every ::5 label "ist_her" stats 'variante 1\habitate\Äschen\vergleich\win\wua_vergleich.dat' u 2 every ::5 label "ist_win" i defined special xtics here:
set xtics ("fru" 1, "som" 2, "her" 3, "win" 4) scale 0.0 out font ",9" and later wanted plot data:
plot \ (1):median_ist_fru notitle linestyle 1, \ (2):median_ist_som notitle linestyle 1, \ (3):median_ist_her notitle linestyle 1, \ (4):median_ist_win notitle linestyle 1 i guess not understanding commands stats or plot properly, , solution might pretty simple experienced user - have tried many different things , nothing worked.
thanks in advance!
you use wrong syntax stats command (would have been helpful if had provided error message). must use name, rest convenience:
tmpl = 'variante 1\habitate\Äschen\vergleich\%s\wua_vergleich.dat' stats sprintf(tmpl, "fru") u 2 every ::5 name "ist_fru_" stats sprintf(tmpl, "som") u 2 every ::5 name "ist_som_" stats sprintf(tmpl, "her") u 2 every ::5 name "ist_her_" stats sprintf(tmpl, "win") u 2 every ::5 name "ist_win_" the plotting part bit tricky:
reset # these test values ist_fru_median = 1 ist_som_median = 0.5 ist_her_median = 1.5 ist_win_median = 1.2 set xtics ("fru" 1, "som" 2, "her" 3, "win" 4) scale 0.0 quartil="fru som win" set samples 4 set xrange[0.8:4.2] plot '+' using ($0+1):(value('ist_'.word(quartil, int($0+1)).'_median')) linespoints title '' rough explanation of script: gnuplot can connect points lines when appear in same data file.
to simulate that, use special file name +, generates number of samples in specified range (the xrange must set in order use +). use 4 samples (set samples 4), number of current sample can accessed $0 (or column(0)) in using statement. sample number goes 0 3.
quartil holds 4 words, extracted later construct variable name. first word has index 1, therefore use word(quartil, $0+1).
if variable name known string, value can accessed value(string).
the result test data is: 
Comments
Post a Comment