You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

极坐标下Gnuplot中set/show title与plot后title的用法问题

Gnuplot 6.0 极坐标标题与图例问题解决方案

问题1:使用set title时,如何在极坐标下指定标题位置?

直接在set title后添加at参数,结合屏幕坐标(范围0-1,(0,0)为左下角,(1,1)为右上角)或图形坐标精确定位,还可搭配对齐选项:

# 示例:将标题放在屏幕右上角,右对齐
set title 'Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}' at screen 0.95, 0.95 right font "STIX Two Math, 24" enhanced

也可使用graph坐标(仅针对绘图区域,不含边框/边距),比如at graph 0.9, 0.9。

问题2:使用set title时,如何显示符号而非数值?

gnuplot会自动解析双引号包裹文本中的变量名(比如你代码里的a对应数值1.0,k对应0.1),导致符号被替换成数值。解决方法是用单引号包裹标题文本,避免变量解析:

# 单引号包裹,原样保留符号
set title 'Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}' font "STIX Two Math, 24" enhanced

问题3:使用set title时,如何保留数学字体?

需确保set title明确指定enhanced模式,并匹配终端设置的数学字体:

# 显式指定字体和enhanced模式,确保Unicode数学符号正确渲染
set title 'Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}' font "STIX Two Math, 24" enhanced

enhanced模式是启用Unicode符号渲染的关键,省略后可能导致字体失效。

问题4:恢复plot行的title并注释最后两行,如何自定义其位置?

plot后的title实际是图例(legend),而非图表标题。需通过set key命令自定义图例位置:

# 示例:将图例放在屏幕右上角,关闭边框
set key at screen 0.95, 0.95 right noenhanced box 0
# 恢复plot行的title
plot 1.0 * exp(0.1 * t) lw 5 title "Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}"

常用位置参数包括top right、bottom left、outside(放在绘图区域外),也可通过at screen/x11/graph坐标精确定位。


内容的提问来源于stack exchange,提问作者chandra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 18:12:14