Search code examples
gnuplot

gnuplot: how to change fontsize of hypertext?


So far, I couldn't find any documentation about how to change the fontsize of hypertext.

From help hypertext which doesn't say anything about fontsize.

plot 'data' using 1:2:0 with labels hypertext point pt 7 \
title 'mouse over point to see its order in data set'

And the following use of font ",30" does not have any effect:

plot 'data' using 1:2:0 with labels font ",30" hypertext point pt 7

Besides this, help labels lists the possibilty of the following syntax

sprintf("{/=30 %d}",$1**2)

But this and all the following tests don't lead to the desired result: labels and tics in standard size, but only hypertext in larger size.

The last test results in large hypertext and small labels/tics but ugly proportions of the graph. Is there any solution to this?

Code:

### hypertext font size

# Test1: 
reset session
set title "default terminal "   # in my case wxt
plot '+' u 1:($1**2):($1**2) w labels font ",30" hypertext point pt 7 ps 3 lc rgb "red" notitle
pause -1

# Test2: 
reset session
set term wxt font ",10"
set title "explicitely set wxt terminal" font ",10"
plot '+' u 1:($1**2):($1**2) w labels font ",30" hypertext point pt 7 ps 3 lc rgb "red" notitle
pause -1

# Test3: 
reset session
set title "only labels without hypertext using {/=30 } syntax"
plot '+' u 1:($1**2):(sprintf("{/=30 %d}",$1**2)) w labels hypertext point pt 7 ps 3 lc rgb "red" notitle
pause -1

# Test4: 
reset session
set term wxt font ",30"
set title "setting terminal font to 30"
plot '+' u 1:($1**2):($1**2) w labels hypertext point pt 7 ps 3 lc rgb "red" notitle
pause -1

# Test5: 
reset session
set term wxt font ",30"
set title "setting terminal font to 30 and the labels to 10 again" font ",10"
set xlabel font ",10"
set ylabel  font ",10"
set xtics font ",10"
set ytics font ",10"
plot '+' u 1:($1**2):($1**2) w labels hypertext point pt 7 ps 3 lc rgb "red" notitle
### end of code

Solution

  • This is a screenshot of the display on the qt terminal from the distributed demo "hypertext.dem" after modifying the plot command as shown to specify a hypertext font that is separate from the default font:

    gnuplot> load 'hypertext.dem'
    gnuplot> ^C
    gnuplot> plot 'cities.dat' using 5:4:(City(1,3)):(Scale(3)) with labels hypertext \
                         point pt 7 ps var lc rgb "#ffee99" font "VladimirScript,20", \
                  'cities.dat' using 5:4:(strcol(1)) with labels font ",5"
    

    enter image description here

    The same command works for the wxt terminal.

    The command more or less works for the svg terminal also but I never figured out how to make the bounding box of the svg hypertext adjust to fit an altered font size.