gnuplot堆积的填充曲线无法显示正确的总和 [英] gnuplot stacked filledcurves can't show the corrects sum

查看:226
本文介绍了gnuplot堆积的填充曲线无法显示正确的总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在研究Gnulot堆积的填充曲线.我有使图表堆积的问题. 这是我的数据:

Currently I working on Gnulot stacked filledcurves. I have problem to make my graphs stacked. This is my data:

     prog   reli    perf    avail   sec cons    topo    scale   qos
2011 138    90.3    21.0    63.5    45.5    48.5    6.8 4.0 5.5
2012 191.3  77.8    90.8    30.8    29.0    22.1    2.0 1.0 1.0
2013 85.0   57.5    48.0    20.0    27.5    8.5 0   2.5 1.0
2014 2.0    0.5 1.0 2.0 1.0 1.5 0   0   0

我已经在t1.plt上绘制了

I have plotted on t1.plt

set term pos eps font 20
set output 't1.eps'
set pointsize 0.8
set border 11
set xtics out
set tics front
set key below
set multiplot
a=0
plot for [i=1:9] "t1" using (column(i)):xtic(1) t column(i) with filledcurves

我当前的输出:

我期望创建这样的图形

my expectation to create graphs like this link:

推荐答案

这里是仅使用gnuplot进行此操作的方法.您可以使用sum命令对列值求和,以获得堆叠图:

Here is how you can do this with gnuplot only. You can use the sum command for the summation of the column values in order to get a stacked graph:

set terminal postscript eps color font 20
set output 't1.eps'
set xtics 1 out
set tics front
set key invert
set style fill solid noborder
plot for [i=10:2:-1] "t1" using 1:(sum [col=2:i] column(col)) with filledcurves x1 title columnheader(i-1)

请注意,列标题的索引为1..9,而值从2..10开始.因此,您必须明确使用title columnheader(i-1).如果您还要给第一列提供标题,例如year,您可以使用set key autotitle columnheader.

Note, that the indices for the column headers are 1..9, whereas the values go from 2..10. So you must explicitely use title columnheader(i-1). If you would give the first column also a header, e.g. year, you could use set key autotitle columnheader.

不幸的是,set keyinvert选项仅适用于列.因此,如果使用set key below invert,则不会获得数据文件的原始顺序.

Unfortunately, the invert option of set key works only on the columns. So if you use set key below invert, you don't get the original order of your data file.

4.6.4的结果:

这篇关于gnuplot堆积的填充曲线无法显示正确的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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