Skip to content

Instantly share code, notes, and snippets.

@redbug312
Last active October 14, 2020 14:52
Show Gist options
  • Select an option

  • Save redbug312/18836babd6167de76a46ace8c27a3ea0 to your computer and use it in GitHub Desktop.

Select an option

Save redbug312/18836babd6167de76a46ace8c27a3ea0 to your computer and use it in GitHub Desktop.
Bubble chart in Gnuplot. Visualize GABA oolong tea with GC/MS analysis, as the final report for Introduction of Analysis in Tea Quality (2019)
#Peak RT Area% Name Quality Odor Odor-encode
12 5.88 0.90 Furfural 90 Medium bready 2 #de795f
24 8.80 1.65 Benzaldehyde 97 High fruity 3 #de5f83
25 9.09 0.30 Benzaldehyde 94 High fruity 3 #de5f83
27 9.47 0.45 Methyl_heptenone 97 Medium citric 2 #f0c674
29 9.69 0.83 (E,E)-2,4-heptadienal 94 High fatty 3 #b8baac
34 10.50 0.36 Dipentene 92 Medium citric 2 #f0c674
35 10.61 2.57 Benzyl_alcohol 98 Medium floral 2 #b283bd
43 12.17 2.64 Linalool 97 Medium floral 2 #b283bd
45 12.48 3.06 Phenethyl_alcohol 97 Medium floral 2 #b283bd
48 12.88 0.77 1,5,8-para-menthatriene 91 High roasted 3 #b88865
53 13.53 0.69 (E)-2-nonenal 92 High fatty 3 #b8baac
60 14.35 2.25 Methyl_salicylate 97 Medium minty 2 #77b865
66 14.95 0.73 Beta-cyclocitral 96 High tropical 3 #b8baac
73 15.63 3.92 Geraniol 95 Medium floral 2 #b283bd
87 17.14 0.79 Decane 90 none none 0 #000000
92 17.55 0.56 Decane 90 none none 0 #000000
93 17.61 0.58 Butyl_octanol 90 none none 0 #000000
103 18.61 1.29 Tetradecane 94 none none 0 #000000
108 19.23 0.59 Alpha-ionone 95 Medium floral 2 #b283bd
123 20.82 0.45 Butylated-hydroxytoluene 99 Low phenoric 1 #b8baac
130 21.73 0.88 (E)-nerolidol 90 Low floral 1 #b283bd
134 22.19 0.15 Cyclotetradecane 97 none none 0 #000000
138 23.33 0.06 1-hexadecene 94 none none 0 #000000
140 23.84 0.02 Cyclododecane 94 none none 0 #000000
#!/usr/bin/env gnuplot
# set title 'Histogram of disconnction time'
set key off
set terminal pngcairo font 'Liberation' truecolor size 1200, 400
set output 'gaba.png'
set style data points
set border lw 1 lc rgb '#555555'
set tics tc rgb '#555555'
set xlabel 'RT (min)' tc rgb '#555555'
set ylabel 'Area (%)' tc rgb '#555555'
# http://gnuplot-surprising.blogspot.com/2012/08/converting-from-hex-string-color-to-its.html
red(colorstring)= colorstring[2:3]
green(colorstring)=colorstring[4:5]
blue(colorstring)=colorstring[6:7]
hex2dec(hex)=gprintf("%0.f",int('0X'.hex))
rgb(r,g,b) = 65536*int(r)+256*int(g)+int(b)
hex(color)=rgb(hex2dec(red(color)),\
hex2dec(green(color)),\
hex2dec(blue(color)))
set arrow from 0,2 to 25,2 nohead dt 2
set arrow from 10.55,0 to 10.55,5 nohead dt 2
set arrow from 16.38,0 to 16.38,5 nohead dt 2
set arrow from 0.4,4.7 to 1.4,4.7 lw 5 lt rgb "#de795f" nohead
set arrow from 0.4,4.4 to 1.4,4.4 lw 5 lt rgb "#de5f83" nohead
set arrow from 0.4,4.1 to 1.4,4.1 lw 5 lt rgb "#f0c674" nohead
set arrow from 0.4,3.8 to 1.4,3.8 lw 5 lt rgb "#b283bd" nohead
set arrow from 0.4,3.5 to 1.4,3.5 lw 5 lt rgb "#b88865" nohead
set arrow from 0.4,3.2 to 1.4,3.2 lw 5 lt rgb "#77b865" nohead
set arrow from 0.4,2.9 to 1.4,2.9 lw 5 lt rgb "#b8baac" nohead
set label 1 'Bready' at 1.5,4.7 tc rgb '#555555'
set label 2 'Fruity' at 1.5,4.4 tc rgb '#555555'
set label 3 'Citric' at 1.5,4.1 tc rgb '#555555'
set label 4 'Floral' at 1.5,3.8 tc rgb '#555555'
set label 5 'Roasted' at 1.5,3.5 tc rgb '#555555'
set label 6 'Minty' at 1.5,3.2 tc rgb '#555555'
set label 7 'Others' at 1.5,2.9 tc rgb '#555555'
plot [0:25][0:5] 'gaba.dat' using ($8>0?$2:1/0):3:($8*3):(hex(stringcolumn(9))) pt 6 lw 5 ps var lc rgb var
@redbug312
Copy link
Copy Markdown
Author

Result (using gnuplot 5.2 patchlevel 8)
preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment