Gnuplot 5.4预览显示圆角虚线,保存为SVG/PDF后丢失问题求助
Gnuplot圆角虚线保存SVG/PDF丢失问题的解决方法
核心原因
wxt终端的round参数是其自身独有的渲染特性,SVG和PDF终端并不识别该参数,需要针对这两类终端使用专门的rounded选项来启用圆角虚线。
具体解决方案
针对不同终端分别配置参数:
- 预览用wxt终端:保留原设置即可
set terminal wxt round enhanced - SVG终端:使用
rounded替代round,并确保开启enhancedset terminal svg enhanced rounded set output "your_plot.svg" replot - PDF终端:使用
pdfcairo终端(Gnuplot推荐的PDF输出终端),同样添加rounded选项set terminal pdfcairo enhanced rounded set output "your_plot.pdf" replot
完整示例脚本
# 1. 启动预览窗口 set terminal wxt round enhanced title "Preview" set output plot sin(x) with lines dashtype 2 linewidth 2 title "Rounded Dashed Line" # 2. 保存为SVG set terminal svg enhanced rounded size 800,600 set output "rounded_dash.svg" replot # 3. 保存为PDF set terminal pdfcairo enhanced rounded size 6,4 set output "rounded_dash.pdf" replot
注意事项
- Gnuplot 5.4版本的SVG和pdfcairo终端原生支持
rounded选项,无需额外配置 - 切换终端后务必执行
replot命令,确保所有绘图参数生效 - 若虚线样式仍有差异,可明确指定
dashtype编号或自定义虚线模式(如dashtype [10,5])
内容的提问来源于stack exchange,提问作者Ghaith Nadhreen
相关产品推荐
相关产品推荐

