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

Gnuplot如何设置图例背景透明以显示下方网格线?

解决gnuplot图例背景遮挡网格线的问题
  • 要让图例背景透明,使下方网格线可见,只需在set key命令中添加transparent参数,同时保留nobox去掉图例边框即可。

修改后的完整代码:

set terminal png size 512,512;
set output 'key.png';
set grid;
set key Left reverse nobox transparent;  # 新增transparent参数实现背景透明
plot [0:3] sin(x) with line title "Sine wave", [0:3] cos(x) with line title "Cosine wave";
  • 说明:transparent参数会将图例的背景设置为完全透明,消除原本的白色覆盖层,网格线就能正常透过图例区域显示出来。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 00:22:00