Gnuplot线型 [英] Gnuplot line types
问题描述
如何在gnuplot上绘制不同类型的线?我得画不同的颜色.我的脚本连接了几个文件,我认为这就是为什么行没有破折号的原因.四个中只有两个是虚线. 谢谢 费利佩
How do I draw different types of lines on gnuplot? I got to draw different colors. My script joins several files and I think it is why the lines are not dash. Only two of four are dashed. Thanks Felipe
#!/usr/bin/gnuplot
set grid
set title 'Estado dos arquivos no BTRIM com peers de comportamento condicionado'
set xlabel 'Tempo discreto'
set ylabel 'Quantidade de arquivos'
set style line 1 lc rgb '#0060ad' lt 1 lw 2 pi -1 ps 1.0
set style line 2 lc rgb '#dd181f' lt 9 lw 2 pi -1 ps 1.0
set style line 3 lc rgb '#29c524' lt 6 lw 2 pi -1 ps 1.0
set style line 4 lc rgb '#7D72F9' lt 7 lw 2 pi -1 ps 1.0
set style line 5 lc rgb '#000000' lt 8 lw 2 pi -1 ps 1.0
set termoption dashed
#set pointintervalbox 0
#set boxwidth 0.1
#set style fill solid
plot '<paste ../00/StatisticNormal.txt ../01/StatisticNormal.txt ../02/StatisticNormal.txt ../03/StatisticNormal.txt ../04/StatisticNormal.txt ../05/StatisticNormal.txt ../06/StatisticNormal.txt ../07/StatisticNormal.txt ../08/StatisticNormal.txt ../09/StatisticNormal.txt' smooth unique with line ls 1 title 'Normais', \
'<paste ../00/StatisticVogue.txt ../01/StatisticVogue.txt ../02/StatisticVogue.txt ../03/StatisticVogue.txt ../04/StatisticVogue.txt ../05/StatisticVogue.txt ../06/StatisticVogue.txt ../07/StatisticVogue.txt ../08/StatisticVogue.txt ../09/StatisticVogue.txt' smooth unique with line ls 2 title 'na Moda', \
'<paste ../00/StatisticPopular.txt ../01/StatisticPopular.txt ../02/StatisticPopular.txt ../03/StatisticPopular.txt ../04/StatisticPopular.txt ../05/StatisticPopular.txt ../06/StatisticPopular.txt ../07/StatisticPopular.txt ../08/StatisticPopular.txt ../09/StatisticPopular.txt' smooth unique with line ls 3 title 'Populares', \
'<paste ../00/StatisticRarity.txt ../01/StatisticRarity.txt ../02/StatisticRarity.txt ../03/StatisticRarity.txt ../04/StatisticRarity.txt ../05/StatisticRarity.txt ../06/StatisticRarity.txt ../07/StatisticRarity.txt ../08/StatisticRarity.txt ../09/StatisticRarity.txt' smooth unique with line ls 4 title 'Raros'
pause -1
推荐答案
直到4.6版
linestyle
的破折号类型由linetype
给出,除非您用linecolor
明确设置了另一个颜色,否则它也会选择线条颜色.
Until version 4.6
The dash type of a linestyle
is given by the linetype
, which does also select the line color unless you explicitely set an other one with linecolor
.
但是,对虚线的支持取决于所选的终端:
However, the support for dashed lines depends on the selected terminal:
- 某些终端不支持虚线,例如
png
(使用libgd
) - 其他终端(例如
pngcairo
)支持虚线,但默认情况下处于禁用状态.要启用它,请使用set termoption dashed
或set terminal pngcairo dashed ...
. - 端子之间的精确破折号样式有所不同.要查看已定义的
linetype
,请使用test
命令:
- Some terminals don't support dashed lines, like
png
(useslibgd
) - Other terminals, like
pngcairo
, support dashed lines, but it is disables by default. To enable it, useset termoption dashed
, orset terminal pngcairo dashed ...
. - The exact dash patterns differ between terminals. To see the defined
linetype
, use thetest
command:
运行
set terminal pngcairo dashed
set output 'test.png'
test
set output
给予:
而postscript
终端显示不同的破折号:
whereas, the postscript
terminal shows different dash patterns:
set terminal postscript eps color colortext
set output 'test.eps'
test
set output
从5.0版开始,引入了与线型,虚线图案和线条颜色相关的以下更改:
Starting with version 5.0 the following changes related to linetypes, dash patterns and line colors are introduced:
-
引入了新的
dashtype
参数:
要获取预定义的破折号模式,请使用例如
To get the predefined dash patterns, use e.g.
plot x dashtype 2
您还可以指定自定义破折号图案,例如
You can also specify custom dash patterns like
plot x dashtype (3,5,10,5),\
2*x dashtype '.-_'
端子选项dashed
和solid
被忽略.默认情况下,所有行均为实线.要将其更改为虚线,请使用例如
The terminal options dashed
and solid
are ignored. By default all lines are solid. To change them to dashed, use e.g.
set for [i=1:8] linetype i dashtype i
线色的默认设置已更改.您可以使用set colorsequence default|podo|classic
在三种不同的颜色集之间进行选择:
The default set of line colors was changed. You can select between three different color sets with set colorsequence default|podo|classic
:
这篇关于Gnuplot线型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!