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

如何用gnuplot绘制柱状图并使用accent调色板?求更简洁实现方式

Gnuplot柱状图优化提问整理

现有data.txt数据

表格形式

colacolb
name a60
name b55
name c10

纯文本形式

cola colb
namea 60
nameb 55
namec 10

已实现的柱状图代码

本人已编写以下代码绘制柱状图:

set linetype 1  lc rgb '#7FC97F' # 浅绿
set linetype 2  lc rgb '#BEAED4' # 浅紫
set linetype 3  lc rgb '#FDC086' # 浅橙

set boxwidth 0.8 relative
set style fill solid border 

plot 'data.txt' using 0:2:($0+1):xtic(1) w boxes lc var

疑问与需求

  1. 是否存在更简洁的实现方式?比如借助调色板简化代码,示例写法如下:
load "accent.pal" # 加载accent调色板
plot 'data.txt' w boxes lc accent

注:accent.pal来自开源gnuplot调色板集合。

  1. 想了解两种图例设置的效果差异:
  • 设置set key autotitle columnhead后的效果
  • 未设置该参数时的效果

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.28 12:03:12