为GNUPLOT设置线样式

发布于 2025-01-31 10:30:45 字数 595 浏览 0 评论 0原文

我正在使用Epslatex终端,并且正在尝试为即将推出的纸张定义特定的线条样式。我创建了以下样式:

set style line 1 lc rgb '#0060ad' pt 1 lt 1 lw 2 # blue 
set style line 2 lc rgb '#dd181f' pt 2 lt 2 lw 2 # red  
set style line 3 lc rgb '#ff9933' pt 3 lt 3 lw 2 # orange  
set style line 4 lc rgb '#ffcc33' pt 4 lt 4 lw 2 # light orange  
set style line 5 lc rgb '#336600' pt 5 lt 5 lw 2 # green 
set style line 6 lc rgb '#9900CC' pt 6 lt 6 lw 2 # purple 
set style line 7 lc rgb '#000000' pt 7 lt 7 lw 2 # black 

但是,当我使用以下样式的时刻,它们的外观会发生变化。在使用同一终端时,我该怎么做才能保持地块的线样式标准,而不会更改?我使用具有点样式的线。另外,我无法更改我使用的样式中的线条厚度。

I am using the epslatex terminal, and I am trying to define specific line styles for my upcoming paper. I created the following styles:

set style line 1 lc rgb '#0060ad' pt 1 lt 1 lw 2 # blue 
set style line 2 lc rgb '#dd181f' pt 2 lt 2 lw 2 # red  
set style line 3 lc rgb '#ff9933' pt 3 lt 3 lw 2 # orange  
set style line 4 lc rgb '#ffcc33' pt 4 lt 4 lw 2 # light orange  
set style line 5 lc rgb '#336600' pt 5 lt 5 lw 2 # green 
set style line 6 lc rgb '#9900CC' pt 6 lt 6 lw 2 # purple 
set style line 7 lc rgb '#000000' pt 7 lt 7 lw 2 # black 

However, the moment that I use the following styles in a different Figure, their appearance changes. What can I do to keep my plots' line style standard without changing when using the same terminal? I use lines with points style. Also, I can not change the thickness of the lines in the styles I use.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦晓ヶ微光ヅ倾城 2025-02-07 10:30:45

标准的gnuplot样式存储在某个地方(肯定是在GNUPLOT目录中的某个地方),我相信您可以修改它们,以便在GNUPLOT启动后,您将在GNUPLOT启动之后将其作为标准样式。 (检查帮助Linestyles vs LineTypes)。

无论如何,以下内容简单而灵活。只需将所需的样式写入文本文件并在脚本期间加载它(检查help load load)。

样式文件: so72347937_styles.gp

set style line 1 lc rgb '#0060ad' pt 1 lt 1 lw 2 # blue 
set style line 2 lc rgb '#dd181f' pt 2 lt 2 lw 2 # red  
set style line 3 lc rgb '#ff9933' pt 3 lt 3 lw 2 # orange  
set style line 4 lc rgb '#ffcc33' pt 4 lt 4 lw 2 # light orange  
set style line 5 lc rgb '#336600' pt 5 lt 5 lw 2 # green 
set style line 6 lc rgb '#9900CC' pt 6 lt 6 lw 2 # purple 
set style line 7 lc rgb '#000000' pt 7 lt 7 lw 2 # black 

脚本:

### load custom style file
reset session

load "SO72347937_Styles.gp"

set key top left
set samples 20

plot for [i=1:7] '+' u 1:($1*i) w lp ls i ti sprintf("Style %d",i)
### end of code

结果:

The standard gnuplot styles are stored somewhere (certainly somewhere in the gnuplot directory) and I am sure you can modify them such that after starting up of gnuplot you will have these as standard styles after gnuplot startup. (check help linestyles vs linetypes).

Anyway, the following is simple and flexible. Simply write your desired styles into a text file and load it during your scripts (check help load).

Style file: SO72347937_Styles.gp

set style line 1 lc rgb '#0060ad' pt 1 lt 1 lw 2 # blue 
set style line 2 lc rgb '#dd181f' pt 2 lt 2 lw 2 # red  
set style line 3 lc rgb '#ff9933' pt 3 lt 3 lw 2 # orange  
set style line 4 lc rgb '#ffcc33' pt 4 lt 4 lw 2 # light orange  
set style line 5 lc rgb '#336600' pt 5 lt 5 lw 2 # green 
set style line 6 lc rgb '#9900CC' pt 6 lt 6 lw 2 # purple 
set style line 7 lc rgb '#000000' pt 7 lt 7 lw 2 # black 

Script:

### load custom style file
reset session

load "SO72347937_Styles.gp"

set key top left
set samples 20

plot for [i=1:7] '+' u 1:($1*i) w lp ls i ti sprintf("Style %d",i)
### end of code

Result:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文