在Gnuplot中动态着色的条形图? [英] Dynamically colored bar charts in Gnuplot?
问题描述
是否没有像> gnuplot条形图中的不同颜色条一样明确选择颜色? GNU绘图是否有一种方法可以根据键(例如哈希值)来选择一些独特的颜色?
Without choosing the color explicitly like Different coloured bars in gnuplot bar chart? is there a way for GNU plot to choose some distinguished colors based on the key (like a hash?)?
# git rev-list --count master
$commits << EOD
gecko 716280
webkit 226748
blink 906439
EOD
set terminal png
set yrange [0:*] # start at zero, find max from the data
set boxwidth 0.5 # use a fixed width for boxes
unset key # turn off all titles
set style fill solid # solid color boxes
set title 'commits'
plot '$commits' using 2:xtic(1) with boxes
奖金:不是简单地说716k,227k,906k,而是1x10 ^ 6(我觉得很奇怪). IE. Y轴的比例尺为1000秒.
Bonus: Instead of 1x10^6 (which I find odd), could it simple say 716k, 227k, 906k. I.e. the scale is in the 1000s for the Y axis.
推荐答案
The solution provided in Different coloured bars in gnuplot bar chart? works also without defining the linetypes. Gnuplot will use the default ones.
set yrange [0:*] # start at zero, find max from the data
set boxwidth 0.5 # use a fixed width for boxes
unset key # turn off all titles
set style fill solid # solid color boxes
set title 'commits'
plot '$commits' using 0:2:($0+1):xtic(1) with boxes lc variable
您还可以使用其他预定义的颜色序列之一添加以下行:
You can also use one of the other predefined sequences of colors adding the following line:
set colors {default|classic|podo}
这篇关于在Gnuplot中动态着色的条形图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!