Gnuplot 中的动态彩色条形图?

Dynamically colored bar charts in Gnuplot?

没有像 Different coloured bars in gnuplot bar chart? 那样明确选择颜色的情况下,GNU plot 有没有办法根据键(比如哈希?)选择一些不同的颜色?

# 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

奖金:而不是 1x10^6(我觉得很奇怪),可以简单地说 716k、227k、906k。 IE。 Y 轴的刻度为 1000 秒。

Different coloured bars in gnuplot bar chart? 中提供的解决方案也可以在不定义线型的情况下使用。 Gnuplot 将使用默认值。

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:([=10=]+1):xtic(1) with boxes lc variable

您还可以使用其他预定义的颜色序列之一添加以下行:

set colors {default|classic|podo}