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

如何在Gnuplot中用颜色名实现实心与透明boxxyerror绘图?

Gnuplot boxxyerror 颜色名实现透明填充方案

Gnuplot本身不支持直接给颜色名添加alpha透明度,但可以通过两种间接方式用颜色名实现需求:

  • 方法1:颜色名转RGB后手动加alpha通道
    先通过show colornames命令查看目标颜色名对应的RGB十六进制值(比如blue对应#0000ff),再在RGB值末尾添加两位十六进制alpha值(00全透明,ff完全不透明),用rgbcolor调用。
    示例代码:

    set style fill solid
    plot 'data1.dat' using 1:2:3:4 with boxxyerror fillcolor blue title "实心组", \
         'data2.dat' using 1:2:3:4 with boxxyerror fillcolor rgbcolor "#0000ff80" title "半透明组"
    
  • 方法2:用@透明度语法(Gnuplot 5.0+)
    5.0及以上版本支持在颜色名后直接加@[0-1]来指定透明度(0为全透明,1为完全不透明),无需手动转RGB。
    示例代码:

    set style fill solid
    plot 'data1.dat' using 1:2:3:4 with boxxyerror fillcolor blue title "实心组", \
         'data2.dat' using 1:2:3:4 with boxxyerror fillcolor "blue@0.5" title "半透明组"
    

内容的提问来源于stack exchange,提问作者Francesco Potortì

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 10:40:54