#
#
#   GNUPLOT - data plot from Lumiera
#

set term wxt size 600,600


set datafile separator ",;"

####---------Data--------------------------------
$RunData << _End_of_Data_
"load size","result time","concurrency","avg jobtime","avg impeded"
157,46.554495,7.48728108853936,2220.16936305732,5.00084713375796
121,50.292037,5.33252293996364,2216.39207438017,98.5650165289256
41,17.16609,6.07957181862614,2545.42626829268,19.3487317073171
136,47.647478,6.35526132149114,2226.56010294118,17.3729779411765
49,20.584294,5.44682436035941,2288.14355102041,38.9046530612245
189,56.006029,7.37320239219245,2184.88776190476,0.771513227513227
187,59.645147,6.96034609488011,2220.05810695187,2.20291978609626
157,55.209898,6.03719403719964,2123.01189171975,37.0743630573248
61,27.400035,4.93882274237971,2218.42485245902,7.64193442622951
144,46.944119,6.66945282325993,2174.24713194444,11.4371458333333
176,54.16028,7.11431672805236,2189.28060227273,5.80461363636364
77,26.727591,6.39997349555371,2221.50485714286,4.55142857142857
47,23.835568,5.08421993551821,2578.41,32.0726595744681
161,53.806824,6.90029627097113,2306.10575776397,3.0222298136646
48,24.075089,4.98632615646821,2500.96345833333,153.631833333333
123,46.065361,6.04074328213775,2262.34975609756,30.5994390243902
48,19.493791,6.84829938927733,2781.23577083333,22.5110833333333
74,34.211108,4.9586167744114,2292.42937837838,54.5361486486486
125,38.459702,7.04485364967206,2167.543776,3.341488
87,41.065671,4.75102269727919,2242.57396551724,151.366091954023
123,43.067274,6.74489662382625,2361.66106504065,10.4976260162602
197,57.968187,7.62476801284125,2243.62425380711,3.16879187817259
186,54.641177,7.24991421762383,2129.80562365591,3.05421505376344
94,34.292914,6.61717834769014,2414.06731914894,5.99422340425532
83,30.439659,6.41262587731354,2351.78487951807,70.7724096385542
109,40.008459,6.38738712730725,2344.49097247706,7.56521100917431
59,29.033358,4.97959316314703,2450.41205084746,104.970728813559
40,19.635726,4.44165670268571,2180.37885,19.92975
62,22.712011,6.9283870107319,2538.02583870968,8.72167741935484
51,27.127065,4.54867118871872,2419.45292156863,67.0625490196078
136,48.226757,6.67485178404179,2366.95922794118,3.46152941176471
81,29.423654,6.26774414217894,2276.78932098765,12.4343703703704
99,30.381306,7.3978615336681,2270.26964646465,4.01015151515151
125,43.996299,6.55915273691544,2308.62756,4.578288
68,26.404795,5.94296914632361,2307.68944117647,1.91704411764706
56,24.513297,6.05979424146821,2652.59885714286,22.1650535714286
156,55.991977,6.11697006162151,2195.52081410256,19.6662179487179
181,56.97651,7.54696488079035,2375.68906077348,0.618259668508287
33,15.986522,5.1415193373518,2490.75793939394,12.9112121212121
198,59.500354,7.14364250673199,2146.71342424243,2.43373737373737
163,51.103658,7.15751062282078,2244.01825153374,6.80783435582822
121,39.859696,6.88613310046319,2268.42290909091,15.1302314049587
181,55.874614,7.49570459672437,2313.92044751381,7.49208839779005
68,25.322434,6.57913011047833,2449.99394117647,9.17791176470588
179,57.311142,6.88257079225537,2203.62006703911,3.28875977653631
32,16.349611,4.86687469200338,2486.609625,7.32503125
161,51.394423,7.13552826539175,2277.80346583851,6.49071428571429
176,60.008068,6.6547853032029,2268.98186931818,1.71989772727273
188,58.826985,7.35173932507335,2300.42903723404,2.80307446808511
55,22.664287,5.5486769118305,2286.48738181818,24.2084545454545
59,26.815392,4.83147003780515,2195.89428813559,13.0098813559322
97,37.460556,6.19002019083753,2390.53193814433,7.96409278350515
84,26.563322,6.43358820105407,2034.49375,11.4647380952381
69,27.823527,6.03438586344571,2433.30286956522,30.3107391304348
97,39.035368,5.51833693485354,2220.72487628866,16.4026701030928
115,41.256006,6.50182913973786,2332.51740869565,13.6992086956522
90,29.937511,6.80177340060101,2262.53517777778,9.98628888888889
33,22.91761,4.0258742076508,2795.86106060606,41.6706060606061
166,58.566848,7.22227735390506,2548.10855421687,5.82302409638554
159,55.436672,7.54835627578798,2631.79717610063,2.16196226415094
34,16.062211,4.7875236478963,2261.71220588235,13.4043529411765
185,63.36048,7.42693573344141,2543.64439459459,3.23899459459459
84,34.441246,5.62509698400575,2306.37320238095,50.2789761904762
185,54.992998,7.36138984457621,2188.24268648649,3.21179459459459
187,60.002963,6.69152031708834,2147.11789304813,3.68767914438503
87,34.14314,5.78903486908351,2271.90606896552,28.3448045977011
183,56.644245,7.29961391488226,2259.45966666667,3.22210382513661
150,46.269744,7.13931710968619,2202.22916666667,2.64142666666667
200,60.218589,7.20858394739206,2170.45377,5.500815
104,37.635813,6.88045049006913,2489.91680769231,7.87939423076923

_End_of_Data_


#
#---common-styles-for-plots-from-Lumiera---------
set style line 1 linetype  1 linewidth 2 linecolor rgb '#240CC3'
set style line 2 linetype  3 linewidth 2 linecolor rgb '#1149D6'
set style line 3 linetype  2 linewidth 2 linecolor rgb '#0B7FCC'
set style line 4 linetype  6 linewidth 2 linecolor rgb '#37999D'
set style line 5 linetype  7 linewidth 2 linecolor rgb '#248269'
set style line 6 linetype 13 linewidth 2 linecolor rgb '#00C443'
set style line 7 linetype 12 linewidth 2 linecolor rgb '#EBE83E'
set style line 8 linetype  5 linewidth 2 linecolor rgb '#762C14'
set style line 9 linetype  4 linewidth 2 linecolor rgb '#AA0519'

set style line 10 linetype 1 linewidth 1 linecolor rgb '#303030'
set style line 11 linetype 0 linewidth 1 linecolor rgb '#A0A0A0' dashtype 3
#---(End)styles----------------------------------

#
#---axis-and-grid-setup--------------------------
unset border
set tics nomirror
set grid back linestyle 11

set arrow 10 from graph 0,0 to graph 1.04,0 size screen 0.025,15,60 filled ls 10
set arrow 11 from graph 0,0 to graph 0,1.08 size screen 0.025,15,60 filled ls 10


set xlabel 'load size ⟶ number of jobs'
set ylabel 'active time ⟶ ms' 
set key autotitle columnheader tmargin

#
stats $RunData using 1:2 nooutput

# regression line function derived from data
regLine(x) = STATS_slope * x + STATS_intercept
#
regLabel = sprintf("Model: %3.2f·p + %3.2f", STATS_slope, STATS_intercept)

set key horizontal width -4
set xtics 10

plots = STATS_columns - 1
# Adjust layout based on number of data sequences;
# additional sequences placed into secondary diagram
#
if (plots > 1) {
    set multiplot layout 2,1     # 2 rows 1 column
    set lmargin at screen 0.12   # fixed margins to align diagrams
    set rmargin at screen 0.88
}
#
#
####---------Scatter-Regression-Plot-------------
plot $RunData using 1:2 with points linestyle 1, \
     regLine(x)         with line   linestyle 9 title regLabel

if (plots > 1) {
    # switch off decorations for secondary diagram
    unset arrow 10
    unset arrow 11
    set border 2+8
    set key bmargin vertical

    unset xlabel
    set format x ""
    set ylabel 'concurrent threads ⟶' 
    if (plots <= 2) {
        ####---------------------------------
        plot $RunData using 1:3 with impulses linestyle 3

    } else {
        # more than one additional data sequence
        #
        set y2tics
        set y2label 'avg job time ⟶ µs'  offset -1.5

        ####---------------------------------------------
        plot             $RunData using 1:3 with impulses linestyle 3, \
             for [i=4:*] $RunData using 1:i with points   linestyle 5+(i-4) axes x1y2
    }
}

