如何在 SVG 中的 Gnuplot 中鼠标悬停时显示值?
How to show values upon mouse hover in Gnuplot in SVG?
注意到交互式 gnuplot 图形 https://lwn.net/Articles/723818/ 在鼠标悬停时显示国家名称后,我想知道如何简单地在图中显示点的值。
例如我想将鼠标悬停在https://s.natalian.org/2020-08-24/mouse-hover.svg中的“女儿栏”上,可以清楚地看到60。
但是现在它只显示坐标 IIUC。我该如何解决这个问题?
set term svg mouse standalone
reset
$heights << EOD
dad 181
mom 170
son 100
daughter 60
EOD
unset key
set boxwidth 0.5
set style fill solid
set yrange [0:*]
plot '$heights' using 2:xtic(1) with boxes
set output '/tmp/mouse-hover.svg'
replot
您正在寻找hypertext
,检查help hypertext
。
您必须使用 point
来锚定超文本。
调整 pointsize(此处为 ps 3
)以更改鼠标显示超文本的区域。
由于您可能不想在框的顶部显示彩色点,因此请使颜色透明,例如lc rgb 0xff123456
.
不幸的是,我(还)没有在 gnuplot 文档中找到任何关于如何使这个超文本的字体变大的内容。选项 font ",30"
没有任何作用。如果你发现了请告诉我。显然在 wxt 终端中你可以做到这一点(参见 )。
代码:
### SVG standalone with hypertext
reset session
set term svg mouse standalone enhanced
set output 'tbSVGstandalone.svg'
$heights <<EOD
dad 181
mom 170
son 100
daughter 60
EOD
unset key
set boxwidth 0.5
set style fill solid
set yrange [0:*]
plot '$heights' u 2:xtic(1) w boxes,\
'' u 0:2:2 w labels hypertext point pt 7 ps 3 lc rgb 0xff123456
set output
### end of code
结果:(Firefox中的SVG截图,貌似不能放SVG,至少我不知道怎么放)
注意到交互式 gnuplot 图形 https://lwn.net/Articles/723818/ 在鼠标悬停时显示国家名称后,我想知道如何简单地在图中显示点的值。
例如我想将鼠标悬停在https://s.natalian.org/2020-08-24/mouse-hover.svg中的“女儿栏”上,可以清楚地看到60。
但是现在它只显示坐标 IIUC。我该如何解决这个问题?
set term svg mouse standalone
reset
$heights << EOD
dad 181
mom 170
son 100
daughter 60
EOD
unset key
set boxwidth 0.5
set style fill solid
set yrange [0:*]
plot '$heights' using 2:xtic(1) with boxes
set output '/tmp/mouse-hover.svg'
replot
您正在寻找hypertext
,检查help hypertext
。
您必须使用 point
来锚定超文本。
调整 pointsize(此处为 ps 3
)以更改鼠标显示超文本的区域。
由于您可能不想在框的顶部显示彩色点,因此请使颜色透明,例如lc rgb 0xff123456
.
不幸的是,我(还)没有在 gnuplot 文档中找到任何关于如何使这个超文本的字体变大的内容。选项 font ",30"
没有任何作用。如果你发现了请告诉我。显然在 wxt 终端中你可以做到这一点(参见
代码:
### SVG standalone with hypertext
reset session
set term svg mouse standalone enhanced
set output 'tbSVGstandalone.svg'
$heights <<EOD
dad 181
mom 170
son 100
daughter 60
EOD
unset key
set boxwidth 0.5
set style fill solid
set yrange [0:*]
plot '$heights' u 2:xtic(1) w boxes,\
'' u 0:2:2 w labels hypertext point pt 7 ps 3 lc rgb 0xff123456
set output
### end of code
结果:(Firefox中的SVG截图,貌似不能放SVG,至少我不知道怎么放)