尝试绘制单个值时的奇怪行为 [英] Strange behavior when trying to plot single values

查看:54
本文介绍了尝试绘制单个值时的奇怪行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下Gnuplot脚本:

I am using the following Gnuplot script :

#####  Definitions  ####
a=0.3
s0=10.
s1=-9.999
r1u(x)=-exp(x)*(-1+a+a*exp(x))/((1+exp(x))**3)
r2u(x)=exp(x)*(1-exp(x))*(-1+a+a*exp(x))/((1+exp(x))**4)
f1(c,d)=s0*c*(1-2*a)/2. + s1*r1u(d)
f2(c,d)=1./(3.*c) - s0*c/6. + s1*r2u(d)
dummyx(z)=25.
dummyy1(z)=.08
dummyy2(z)=.06

#####   Prologue   #####
clear
reset

######  Plot data   #####
set zeroaxis
set key title 'plot of dw/dt'
plot '019999.rrp' using 1:(f2(($4),($5))) with linespoints linewidth 2 notitle
pause -1
stats '019999.rrp' using 5 nooutput
do for [i=0:int(STATS_records-1)] {
    reset
    set term x11 1
    set key title '-x0/w at t'.i.' and its position on the "source term" curve'
    set xrange [STATS_min:STATS_max]
    set label 1 sprintf("t = %3.0f",i) at 25,.04
    set label 2 'w is' at 19,.08
    set label 3 'dw/dt is' at 19,.06
    plot '019999.rrp' every ::i::i:1 using 5:(r1u($5)) linewidth 5 notitle,\
         '019999.rrp' every ::i::i:1 using (dummyx($1)):(dummyy1($1)):4 with labels notitle,\
         '019999.rrp' every ::i::i:1 using (dummyx($1)):(dummyy2($1)):(f2(($4),($5))) with labels notitle,\
         r1u(x) with lines lw 2 notitle
    pause -1
}

,最后一个f2(($4),($5))不会执行应有的操作.它只是绘制($5).但是第一个f2(($4),($5))起作用.

and the last f2(($4),($5)) doesn't do what it should. It just plots ($5). However the first f2(($4),($5)) works.

绘制的文件在这里: http://we.tl/SPX4ykaX4j .我不知道提供链接是否是一个好习惯,因此,这里是该文件的头,足以再现该错误.

The plotted file is here : http://we.tl/SPX4ykaX4j . I don't know if it's good practice to provide a link, so here is the head of this file which is sufficient to reproduce the error.

0.0000000E+00  -15.00000      -60.00000      0.4472136       33.54102    
0.2500000      -14.77640      0.8944144      0.4472048       33.04168    
0.5000000      -14.55279      0.8944079      0.4472023       32.54186    
0.7500000      -14.32919      0.8944058      0.4472016       32.04191    
1.000000      -14.10559      0.8944051      0.4472014       31.54192    
1.250000      -13.88199      0.8944049      0.4472013       31.04193
1.500000      -13.65839      0.8944048      0.4472013       30.54193    
1.750000      -13.43479      0.8944047      0.4472013       30.04193    
2.000000      -13.21119      0.8944047      0.4472013       29.54193    
2.250000      -12.98759      0.8944047      0.4472013       29.04193    
2.500000      -12.76398      0.8944047      0.4472013       28.54192    
2.750000      -12.54038      0.8944046      0.4472012       28.04193    
3.000000      -12.31678      0.8944047      0.4472013       27.54192    
3.250000      -12.09318      0.8944047      0.4472013       27.04192    
3.500000      -11.86958      0.8944047      0.4472013       26.54192    
3.750000      -11.64598      0.8944047      0.4472013       26.04192    
4.000000      -11.42238      0.8944047      0.4472013       25.54192    
4.250000      -11.19878      0.8944047      0.4472013       25.04192    
4.500000      -10.97517      0.8944047      0.4472013       24.54191    
4.750000      -10.75157      0.8944047      0.4472013       24.04191    
5.000000      -10.52797      0.8944047      0.4472013       23.54191    
5.250000      -10.30437      0.8944046      0.4472012       23.04191    
5.500000      -10.08077      0.8944047      0.4472013       22.54191    
5.750000      -9.857169      0.8944047      0.4472013       22.04191    
6.000000      -9.633568      0.8944047      0.4472013       21.54191    
6.250000      -9.409966      0.8944047      0.4472013       21.04191    
6.500000      -9.186366      0.8944047      0.4472013       20.54190    
6.750000      -8.962765      0.8944047      0.4472013       20.04190    
7.000000      -8.739163      0.8944047      0.4472013       19.54190    
7.250000      -8.515562      0.8944047      0.4472013       19.04190    
7.500000      -8.291961      0.8944047      0.4472013       18.54190    
7.750000      -8.068360      0.8944046      0.4472012       18.04190    
8.000000      -7.844759      0.8944047      0.4472013       17.54190    
8.250000      -7.621158      0.8944047      0.4472013       17.04190    
8.500000      -7.397556      0.8944047      0.4472013       16.54189    
8.750000      -7.173955      0.8944047      0.4472013       16.04189    
9.000000      -6.950354      0.8944047      0.4472013       15.54189    
9.250000      -6.726753      0.8944047      0.4472013       15.04189    
9.500000      -6.503151      0.8944047      0.4472013       14.54189 

推荐答案

如果使用sprintf格式化函数值,则此问题已解决:

The problem is fixed, if you use sprintf to format the function value:

...
plot '019999.rrp' every ::i::i using (dummyx($1)):(dummyy2($1)):(sprintf("%g", f2(($4),($5)))) with labels notitle
...

可以通过以下简化示例重现相同的错误(?):

The same error (?) can be reproduced with the following, simplified example:

set samples 11
set xrange [0:10]
f(x,y) = x+y
unset key

set multiplot layout 2,1
plot '+' using 1:1:(f($1,$1)) with labels
plot '+' using 1:1:(sprintf("%g", f($1,$1))) with labels
unset multiplot

我不知道,是否可以将其视为错误.我将其报告为#1368字符串列中数字表达式的转换.

I don't know, if that may be regarded as a bug. I reported it as #1368 Conversion of numerical expressions in string columns .

这篇关于尝试绘制单个值时的奇怪行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆