本文介绍了在Gnuplot 4.0中选择线型和颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两对数据集,需要使用Gnuplot进行绘制.

I have two pairs of datasets, which I need to plot using Gnuplot.

我希望将第一对绘制成红色,一个实线,一个虚线.第二对,我想用蓝色绘制,一个实线和一个虚线.

I want the first pair to be plotted in red, one solid and one dashed. The second pair, I want to plot in blue, one solid and one dashed.

我已经尝试过多次set style line,但是我无法获得确切的行为.我的最后一次尝试(随附)将第一对绘制为红色(实线),将第二对绘制为蓝色(虚线).

I've experimented with set style line several times, but I cannot get this exact behaviour. My last attempt (attached) plots the first pair in red (solid) and the second pair in blue (dotted).

任何帮助将不胜感激.

set style line 1 lt 1 lw 3 pt 3
set style line 2 lt 1 lw 3 pt 3
set style line 3 lt 3 lw 3 pt 3
set style line 4 lt 3 lw 3 pt 3
plot 'data1.dat' using 1:3 w l ls 1,\
     'data1.dat' using 1:4 w l ls 2,\
     'data2.dat' using 1:3 w l ls 3,\
     'data2.dat' using 1:4 w l ls 4

推荐答案

您需要使用 linecolor 而不是lc,例如:

You need to use linecolor instead of lc, like:

set style line 1 lt 1 lw 3 pt 3 linecolor rgb "red"

帮助设置样式行"为您提供了更多信息.

"help set style line" gives you more info.

这篇关于在Gnuplot 4.0中选择线型和颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 20:24