我一直在互联网上寻找答案。
似乎有很多版本的如何在 gnuplot 中绘制颜色线。我有一个包含 4 列的数据文件。我想用不同的颜色绘制每一列。这是我根据 gnuplot 帮助文件使用的代码片段,但是在使用这些代码时出现语法错误。
set style line 1 lt 1 lc 1 lw 3 # red
set style line 2 lt 1 lc 2 lw 3 #green
set style line 3 lt 1 lc 3 lw 3 #blue
set style line 4 lt 1 lc 4 lw 3 #magenta
我将终端设置为后记。
例如,我已经尝试了这种线型样式的所有组合,包括线型和 lc rgb 'red',但它们都不起作用!
谁能告诉我出了什么问题?
让我澄清一下,这是 python 脚本中的 gnuplot 脚本。代码如下所示:
plot = open('plot.pg','w')
plot_script = """#!/usr/bin/gnuplot
reset
set terminal postscript
#cd publienhanced color
set output "roamingresult.ps"
set xlabel "time (seconds)"
set xrange [0:900]
set xtics (0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900)
set ylabel "AP1 AP2 AP3 AP4"
set yrange [0:5]
set nokey
set grid
set noclip one
set ytics 1
#set style data boxes"""
set style line 1 lt 1 lc 1 lw 3
set style line 2 lt 1 lc 2 lw 3
set style line 3 lt 1 lc 3 lw 3
set style line 4 lt 1 lc 4 lw 3