gnuplot中的群集条形图 [英] Clustered bar plot in gnuplot

查看:89
本文介绍了gnuplot中的群集条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a simple result table which I want to plot as a clustered histogram plot in gnuplot. The data set has the category of content type of a webpage and the corresponding percentage share in two columns. I have this for two browsers. For example,

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轴上绘制带有图例的相应份额.我该怎么做?

Now I want to plot these two data together with the Content Type in the x-axis and the corresponding share on the y-axis with legends. How do I do this?

推荐答案

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

If you turn your data into a table, this becomes relatively easy.

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

创建情节.这是我之前制作的:

To create your plot. Here's one I made earlier:

这篇关于gnuplot中的群集条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆