结合YERRORBARS和可变点大小

发布于 2025-01-29 20:17:32 字数 804 浏览 0 评论 0原文

我正在尝试绘制以下数据文件

#x  y   s   err
1   1   0.1 0.2
2   2   0.2 0.2
3   3   0.3 0.2
4   4   0.4 0.2
5   5   0.5 0.2
6   6   0.6 0.2
7   7   0.7 0.2
8   8   0.8 0.2
9   9   0.9 0.2
10  10  1.0 0.2

,其中这些点具有由第3列给出的可变大小,并且在第4列中给出了错误。我可以

plot "test" u 1:2:3 pt 7 ps variable
plot "test" u 1:2:4 w yerrorbars pt 7

独立工作,给我这一点:

i.sstatic.net/be50b.png“ rel =“ nofollow noreferrer 当我尝试结合它们时,

plot "test" u 1:2:4:3 w yerrorbars pt 7 ps variable

我会得到一些非常奇怪的东西:

​即使是陌生人,如果我尝试u 1:2:3:4,我也会获得相同的输出。我的做法有什么问题吗?我可以手动将错误栏绘制为向量,但是如果可能的话,我更喜欢使用内置的错误栏样式。

I'm trying to plot the following data file

#x  y   s   err
1   1   0.1 0.2
2   2   0.2 0.2
3   3   0.3 0.2
4   4   0.4 0.2
5   5   0.5 0.2
6   6   0.6 0.2
7   7   0.7 0.2
8   8   0.8 0.2
9   9   0.9 0.2
10  10  1.0 0.2

where the points have a variable size given by column 3 and the errors are given in column 4. I can get

plot "test" u 1:2:3 pt 7 ps variable
plot "test" u 1:2:4 w yerrorbars pt 7

to work independently, giving me this:

enter image description here

But when I try to combine them

plot "test" u 1:2:4:3 w yerrorbars pt 7 ps variable

I get something very strange:

enter image description here

yerrorbars seems to be using column 4 as the y column and column 3 as the yerror column. Even stranger, I get the same output if I try u 1:2:3:4. Is there something wrong with how I'm doing this? I can manually draw the errorbars as vectors, but I'd prefer to use the built-in errorbars style if possible.

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

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

发布评论

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

评论(1

当爱已成负担 2025-02-05 20:17:32
gnuplot> help yerrorbars

 The `yerrorbars` (or `errorbars`) style is only relevant to 2D data plots.
 `yerrorbars` is like `points`, except that a vertical error bar is also drawn.
 At each point (x,y), a line is drawn from (x,y-ydelta) to (x,y+ydelta) or
 from (x,ylow) to (x,yhigh), depending on how many data columns are provided.
 The appearance of the tic mark at the ends of the bar is controlled by
 `set errorbars`.

      2 columns:  [implicit x] y ydelta
      3 columns:  x  y  ydelta
      4 columns:  x  y  ylow  yhigh

 An additional input column (4th or 5th) may be used to provide information
 such as variable point color.

因此,为了提供3列以上并仍然使用Ydelta的单个值,您应该可以做

plot "test" u 1:2:($2-$4):($2+$4):3 w yerrorbars pt 7 ps variable 

但是,正如您指出的那样,实际上这实际上并没有记录。

工作范围

一种替代方法是进行两次通过。首先绘制误差线线并抑制点,第二个用所需属性绘制点:

unset key
plot "test" u 1:2:3 with yerrorbars pt 0, \
         "" u 1:2:4 with points pt 7 ps variable

”在此处输入图像说明”

gnuplot> help yerrorbars

 The `yerrorbars` (or `errorbars`) style is only relevant to 2D data plots.
 `yerrorbars` is like `points`, except that a vertical error bar is also drawn.
 At each point (x,y), a line is drawn from (x,y-ydelta) to (x,y+ydelta) or
 from (x,ylow) to (x,yhigh), depending on how many data columns are provided.
 The appearance of the tic mark at the ends of the bar is controlled by
 `set errorbars`.

      2 columns:  [implicit x] y ydelta
      3 columns:  x  y  ydelta
      4 columns:  x  y  ylow  yhigh

 An additional input column (4th or 5th) may be used to provide information
 such as variable point color.

So in order to provide more than 3 columns and still use a single value for the ydelta, you should be able to do

plot "test" u 1:2:($2-$4):($2+$4):3 w yerrorbars pt 7 ps variable 

However, as you point out this doesn't actually work as documented.

Work-around

An alternative is to make two passes; first plot the errorbar lines and suppress the points, second plot the point with the desired properties :

unset key
plot "test" u 1:2:3 with yerrorbars pt 0, \
         "" u 1:2:4 with points pt 7 ps variable

enter image description here

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