Colors 每个数据集的不同颜色

Colors 每个数据集的不同颜色,colors,indexing,gnuplot,Colors,Indexing,Gnuplot,经过两天的尝试和错误,我在这里寻求帮助,因为我完全失去了gnuplot。 我只想用不同的颜色显示一些数据集,并带有命名列。 结果如下: 第一个问题:图表上的线条有不同的颜色,但标题中的颜色是相同的。 第二个问题:如果我将绘图线后的“idx”替换为列(-2)(即: 我有这个输出 在我看来,idx和列(-2)应该相等吗? 以下是gnuplot脚本的简化版本(我认为是最关键的部分): 我的数据格式由2个数据集组成,如下所示(我删除了一些数据以使其更短): 在christophe发来的消息后编辑:根

经过两天的尝试和错误,我在这里寻求帮助,因为我完全失去了gnuplot。 我只想用不同的颜色显示一些数据集,并带有命名列。 结果如下:

第一个问题:图表上的线条有不同的颜色,但标题中的颜色是相同的。 第二个问题:如果我将绘图线后的“idx”替换为列(-2)(即:

我有这个输出

在我看来,idx和列(-2)应该相等吗? 以下是gnuplot脚本的简化版本(我认为是最关键的部分):

我的数据格式由2个数据集组成,如下所示(我删除了一些数据以使其更短):

在christophe发来的消息后编辑:根据a dvice修改后,我仍然有一个问题(线型0不存在,所以我重新编制了一点索引):

标题箭头全部为黑色(而不是红色和绿色):
<> /> P> > LeCulor调色板< /C> >(也与<代码> LICOLOLR变量)的方法是,LICOLCOLL可以针对单个绘图而变化。当颜色规范对于所有点都是恒定的时,Gnuplot不考虑特殊情况。

要获得正确的键,必须使用循环索引
idx

plot for [idx=0:STATS_blocks-1] \
datafile index idx using "packetid":'mapping_dsn':(0):"mapping_length" with vectors filled head size screen 0.008,145 lc idx+1 title sprintf("dataset %d", idx)

关于
列(-2)
vs
idx
:使用
列(-2)
之外使用
语句无法正常工作。我认为这样做时应该会出错。

感谢您的宝贵意见,这些意见提供了我在其他地方从未找到过的两条信息,我认为我不会提供这些信息。但根据您的建议进行修改后,我仍然有一个问题。请参阅第一篇文章中的编辑Ups,抱歉。当然,
lc变量
也有类似于
lc调色板
的问题,线条颜色在单个绘图中可能会有所不同。由于您仍在循环,请改用
lt idx
。我马上更新答案。
stats datafile every ::2
set palette maxcolors 3
set palette defined ( 0 'green', \
                      1 'red', \
                      2 'blue' )

set key autotitle columnhead
set cbrange[0:STATS_blocks-1]

plot for [idx=0:STATS_blocks-1] \
    datafile index idx using "packetid":'mapping_dsn':(0):"mapping_length":(idx) with vectors filled head size screen 0.008,145 lc palette z title sprintf("dataset %d", idx)
packetid|time_delta|ip4src|ip4dst|ip6src|ip6dst|mptcpstream|tcpstream|subtype|tcpseq|mapping_ssn|mapping_length|mapping_dsn|ssn_to_dsn|dataack
2|0.000000000|192.168.1.1|192.168.1.2|||0|0|0|0|||||
5|0.000067000|192.168.1.1|192.168.1.2|||0|0|2|1|1|20|0||
6|0.000125000|192.168.1.1|192.168.1.2|||0|0|2|21|21|20|20||
8|0.000064000|192.168.1.1|192.168.1.2|||0|0|2|41|41|20|40||
9|0.000125000|192.168.1.1|192.168.1.2|||0|0|2|61|61|20|60||

packetid|time_delta|ip4src|ip4dst|ip6src|ip6dst|mptcpstream|tcpstream|subtype|tcpseq|mapping_ssn|mapping_length|mapping_dsn|ssn_to_dsn|dataack
2|0.000000000|192.168.1.1|192.168.1.2|||0|0|0|0|||||
5|0.000067000|192.168.1.1|192.168.1.2|||0|0|2|1|1|20|0||
6|0.000125000|192.168.1.1|192.168.1.2|||0|0|2|21|21|20|20||
8|0.000064000|192.168.1.1|192.168.1.2|||0|0|2|41|41|20|40||
9|0.000125000|192.168.1.1|192.168.1.2|||0|0|2|61|61|20|60||
set linetype 1 lw 3 pt 3 lc rgb "red"
set linetype 2 lw 3 pt 3 lc rgb "green"

... datafile index idx using "packetid":'mapping_dsn':(0):"mapping_length":(idx+1) with vectors filled head size screen 0.008,145 lc variable title sprintf("Mappings from dataset %d", idx)
plot for [idx=0:STATS_blocks-1] \
datafile index idx using "packetid":'mapping_dsn':(0):"mapping_length" with vectors filled head size screen 0.008,145 lc idx+1 title sprintf("dataset %d", idx)