Open kaihendry opened 4 years ago
If you cannot do it with normal gnuplot on the command line, then it is definitely not possible.
Well there is interactivity for example upon http://gnuplot.info/demo_canvas_5.2/ Example on the right has zooming and pointer co-ords capabilities. Not sure if that's reproducible in a Notebook.
I did not know about the canvas!
The canvas output is a full html document with links to system javascript, css and image files. While Jupyter Notebook can display HTML, it does not like links that point elsewhere on the filesystem. So the canvas as generated cannot be shown and we need to do some very mess manipulations of text and files.
Canvas aside, I've seen interactive SVGs produced by Gnuplot. For example: https://s.natalian.org/2020-08-24/interactive.svg from https://lwn.net/Articles/723818/ I want this same experience within a Notebook. 😬
But oddly, in the context of a Notebook, mouse behaviour is not the same: https://s.natalian.org/2020-08-24/gnotebook.png
I can't seem to even export the embedded SVG to have a closer look:
Interactive SVGs in notebook work. And if you choose to save to a file, it works as well.
%gnuplot inline svg mouse standalone
#set out "file.svg" # Uncomment to save to a file
set datafile separator comma
set xlabel '% eligible entering 1st grade' font ",16"
set ylabel '% youth literacy' font ",16"
unset key
set yr [50:110]
set xr [10:110]
set style fill solid 0.5
plot "< sort -t, -k4 -gr htxt.dat" using 2:3:1:(log($4/100000)) \
with labels hypertext point pt 7 ps var lc rgb "violet", \
"" using 2:3:(log($4/100000)) with points pt 6 lc "red" ps var notitle
Is it possible to generate graphs with interactivity, so that when you hover a mouse over a value it shows some title-esque tooltip?
https://github.com/kaihendry/covid19-sg/blob/master/gnuplot.ipynb