我试图使用gnuplot绘制图形.我有6个文本文件.每个文本文件包含两列.第一列表示以秒为单位的时间(它是一个浮点数).Second是一个序列号.我想绘制所有六个文件的单个图表中的时间与序列号的关系图.我正在使用此文件来执行此操作.
set terminal png
set output 'akamai.png'
set xdata time
set timefmt "%S"
set xlabel "time"
set autoscale
set ylabel "highest seq number"
set format y "%s"
set title "seq number over time"
set key reverse Left outside
set grid
set style data linespoints
plot "print_1012720" using 1:2 title "Flow 1", \
plot "print_1058167" using 1:2 title "Flow 2", \
plot "print_193548" using 1:2 title "Flow 3", \
plot "print_401125" using 1:2 title "Flow 4", \
plot "print_401275" using 1:2 …
Run Code Online (Sandbox Code Playgroud) 这个问题与gnuplot内部的循环结构有关吗?而答案也由DarioP.
gnuplot 4.6引入了do命令.我如何使用它来循环一个例如文件和颜色的数组?什么是正确的语法?
colors = "red green #0000FF"
files = "file1 file2 file3"
do for [i=1:3] {
plot files(i).".dat" lc colors(i)
}
Run Code Online (Sandbox Code Playgroud) 我有多个文件命名为以下示例:blast_ sample1 _454LargeContigs.fna.fas_vs_ NC_016593 _filter.txt
更改的部分是"sample#"(样本)和"NC_#"(参考),它们以粗体显示.每个参考文献有35个样本.我编写了以下命令,使用35个样本的数据生成参考NC_016593的绘图:
filename(n) = sprintf("blast_sample%d_454LargeContigs.fna.fas_vs_NC_016593_filter.txt", n)
plot for [i=01:35] filename(i) using 9:3:($10-$9):($3-$3) with vectors nohead
Run Code Online (Sandbox Code Playgroud)
对于每个参考我想做一个情节,因此为此我想用通配符写一个通用命令.有没有办法直接在gnuplot中做到这一点?是否可以使用通配符仅修改"NC_#"部分(如shell脚本中的*,类似于NC_*)?
谢谢.