首页 > 解决方案 > gnuplot:如何更改超文本的字体大小?

问题描述

到目前为止,我找不到任何关于如何更改超文本字体大小的文档。

从中help hypertext没有说明字体大小。

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

并且以下使用font ",30"没有任何效果:

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

除此之外,help labels列出以下语法的可能性

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

但是这个和以下所有测试都不会产生预期的结果:标准尺寸的标签和抽动,但只有更大尺寸的超文本。

最后一个测试的结果是大的超文本和小标签/抽动,但图形的比例很丑。有什么解决办法吗?

代码:

### 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

标签: gnuplot

解决方案


这是分布式演示“hypertext.dem”在修改绘图命令后在 qt 终端上显示的屏幕截图,如图所示指定了与默认字体分开的超文本字体:

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"

在此处输入图像描述

相同的命令适用于 wxt 终端。

该命令或多或少也适用于 svg 终端,但我从未弄清楚如何调整 svg 超文本的边界框以适应更改的字体大小。


推荐阅读