Sometimes it might be useful to digitize scanned graphs to get the data and redraw a plot. I'm aware that there are dedicated tools with a lot of features, e.g. see miscellaneous links on the gnuplot home page: http://gnuplot.info/links.html
However, is there maybe a way using gnuplot only? Maybe with a few lines of code you can implement a simple version of a digitizer? Which should already be sufficient for some cases having a limited number of datapoints.
(edit: part of original question now put as answer)
In case this might be useful to someone... this gnuplot version is just for fun, sharing and for demonstration of gnuplot capabilities. Improvements are welcome, e.g.
How it works:
show datafile binary filetype
.The following key bindings are implemented:
Script: (works with gnuplot>=5.2.0)
### a simple gnuplot digitizer
reset session
IMAGE = 'Superconductivity.png'
DATAFILE = 'Superconductivity.dat'
AxisXStart = 4.00
AxisXEnd = 4.40
AxisYStart = 0.00
AxisYEnd = 0.15
DataHeader = "# x-value y-value
set print $Data
print DataHeader
set print
AxesHeader = "# axes mouse coordinates
set print $Axes
print AxesHeader
set print
set margins 0,0,0,0
set key noautotitle
fx(point) = (word(point,1)-word($Axes[3],1))/(word($Axes[4],1)-word($Axes[3],1))*(AxisXEnd - AxisXStart) + AxisXStart
fy(point) = (word(point,2)-word($Axes[3],2))/(word($Axes[2],2)-word($Axes[3],2))*(AxisYEnd - AxisYStart) + AxisYStart
# get point
bind Button1 'if (|$Axes|<4) { set print $Axes append } else { set print $Data append }; \
print MOUSE_X, MOUSE_Y; set print; replot'
# reset axis points
bind 0 'set print $Axes; print AxesHeader; set print; replot'
# remove all data points
bind x 'set print $Data; print DataHeader; set print; replot'
# remove last data point
bind c 'if (|$Data|>2) {array A[|$Data|]; do for [i=2:|$Data|-1] { A[i]=$Data[i] }; \
set print $Data; do for [i=1:|A|-1] { print A[i] }; } \
else {set print $Data; print DataHeader; }; set print; replot'
# save data to file
bind s 'set print DATAFILE; print $Data[1]; \
do for [i=2:|$Data|] { print sprintf("%g %g", fx($Data[i]), fy($Data[i])) }; \
set print; pause -1 sprintf("Data saved to: %s",DATAFILE)'
plot IMAGE binary filetype=auto origin=(0,0) dx=1 dy=1 with rgbimage, \
$Axes u 1:2 w l lw 2 lc "blue" noautoscale, \
$Data u 1:2 w p pt 7 lc "red" noautoscale
### end of script
Input: Superconductivity.png
Procedure: (Screen capture from wxt terminal)
Result: Superconductivity.dat
# Temperature Resistance
4.3696 0.130726
4.3328 0.126117
4.232 0.113966
4.20241 0.00157884
4.19248 0.000406976
4.18307 0.000751641