Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any tips for added interactivity? #26

Open
kaihendry opened this issue Aug 21, 2020 · 6 comments
Open

Any tips for added interactivity? #26

kaihendry opened this issue Aug 21, 2020 · 6 comments

Comments

@kaihendry
Copy link

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

@has2k1
Copy link
Owner

has2k1 commented Aug 22, 2020

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

@kaihendry
Copy link
Author

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.

@has2k1
Copy link
Owner

has2k1 commented Aug 22, 2020

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.

@kaihendry
Copy link
Author

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 added a commit to kaihendry/covid19-sg that referenced this issue Aug 24, 2020
@has2k1
Copy link
Owner

has2k1 commented Aug 24, 2020

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

@kaihendry
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants