【问题标题】:Clustered bar plot in gnuplotgnuplot中的聚集条形图
【发布时间】:2011-07-05 01:40:45
【问题描述】:

我有一个简单的结果表,我想在 gnuplot 中将其绘制为聚集直方图。该数据集在两列中具有网页的内容类型的类别和相应的百分比份额。我有两个浏览器。例如,

For IE,
    Content      Share
    Video         30%
    Audio         10%
    Flash         25%
    HTML          20%
    Javascript    15%

   For Chrome,
    Content      Share
    Video         20%
    Audio         5%
    Flash         35%
    HTML          30%
    Javascript    10%

现在我想将这两个数据与 x 轴中的内容类型以及 y 轴上的相应份额以及图例一起绘制。我该怎么做?

【问题讨论】:

标签: plot gnuplot bar-chart


【解决方案1】:

如果您将数据转换为表格,这将变得相对容易。

info.dat 应包含:

Broswer Video   Audio   Flash   HTML    JavaScript
IE      30%     10%     25%     20%     15%
Chrome  20%     5%      35%     30%     10%

然后使用类似的东西:

set terminal pdf enhanced
set output 'bar.pdf'

set style data histogram
set style histogram cluster gap 1

set style fill solid border rgb "black"
set auto x
set yrange [0:*]
plot 'info.dat' using 2:xtic(1) title col, \
        '' using 3:xtic(1) title col, \
        '' using 4:xtic(1) title col, \
        '' using 5:xtic(1) title col, \
        '' using 6:xtic(1) title col

创建你的情节。这是我之前做的一个:

【讨论】:

    猜你喜欢
    • 2017-06-16
    • 1970-01-01
    • 2014-03-15
    • 1970-01-01
    • 1970-01-01
    • 2020-04-12
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多