如何在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ì
相关产品推荐
相关产品推荐

