gnuplot_kernel icon indicating copy to clipboard operation
gnuplot_kernel copied to clipboard

Any tips for added interactivity?

Open kaihendry opened this issue 5 years ago • 6 comments

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

kaihendry avatar Aug 21 '20 08:08 kaihendry

If you cannot do it with normal gnuplot on the command line, then it is definitely not possible.

has2k1 avatar Aug 22 '20 11:08 has2k1

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.

kaihendry avatar Aug 22 '20 13:08 kaihendry

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.

has2k1 avatar Aug 22 '20 21:08 has2k1

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:

image

kaihendry avatar Aug 24 '20 03:08 kaihendry

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

has2k1 avatar Aug 24 '20 10:08 has2k1

I know the save to file works, but the idea is to iterate within a notebook and see the hypertext labels!

kaihendry avatar Aug 25 '20 01:08 kaihendry