如何用gnuplot绘制柱状图并使用accent调色板?求更简洁实现方式
Gnuplot柱状图优化提问整理
现有data.txt数据
表格形式
| cola | colb |
|---|---|
| name a | 60 |
| name b | 55 |
| name c | 10 |
纯文本形式
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
疑问与需求
- 是否存在更简洁的实现方式?比如借助调色板简化代码,示例写法如下:
load "accent.pal" # 加载accent调色板 plot 'data.txt' w boxes lc accent
注:accent.pal来自开源gnuplot调色板集合。
- 想了解两种图例设置的效果差异:
- 设置
set key autotitle columnhead后的效果 - 未设置该参数时的效果
内容的提问来源于stack exchange,提问作者Andy Adam
相关产品推荐
相关产品推荐

