2
votes

I am using gnuplot 4.7 patch 0.

My data file "test.txt" looks like the following:

0  0  net0
1  1  net1
2  2  net2
3  3  net3
4  5  net4_outlier
5  5  net5

My gnuplot code "script.gp" looks like this:

set term canvas
set termoption enhanced
set label at 0,0 "Origin"
set title 'mouse over points'
plot 'test.txt' using 1:2:3 with labels hypertext point pt 7 ps var lc rgb "black"

Testing:

I tested that canvas is an available terminal by typing terminal and canvas is available in the list. The version of firefox I am using is "Mozilla Firefox 5.0". I have checked that this version is compatible with html 5 canvas element.

I am running the script as:

gnuplot script.gp > canvas.html

I am loading the output html file as:

firefox canvas.html&

Result:

I get a plot, with the 10 points, but the hover label is not working. If I remove hypertext and use normal label, then that is working - labels are printed.

Could someone point out what is the mistake I am making here - I have read that hypertext is supported in gnuplot 4.7 patch 0.

Any help is appreciated.

1
Hi Christoph, I see you have edited the formatting, you are the exact person I was looking for/trying to contact, for help with the above issue..I read your previous solution that you provided on a similar question - but doesnt seem to work for me while experimenting.. - user3520825
:) You'll get an answer in two minutes - Christoph

1 Answers

2
votes

The hypertext feature is connected to the mousing terminal option, i.e. use

set terminal canvas enhanced mousing

to see the labels on mouse over.

If you don't want the additional coordinate box, then you must just replace the line

<script type="text/javascript">gnuplot.init = function() {};</script>

in the html <header> with

<script src="/absolute/path/to/js/gnuplot_mouse.js"></script>

of course with the correct path to the javascript file (see the path to gnuplot_common.js).

As note: 4.7 is a development version with no patchlevel. Soon, the new stable version 5.0 will appear.