是否可以相对于图形和数据设置 gnuplot 标签?
Is it possible to set a gnuplot label relative to both the graph and the data?
我有一个折线图,我想在其中放置一个坐标基于 (x,y) 的标签,其中:
x would be relative to the graph at position (x = 0.01)
y would be relative to the data at position (value = 32)
是否可以根据 32 是否在当前范围内(换句话说,如果 yMin < 32 < yMax,将显示标签,否则不显示标签) )--结果大致如下所示:
是的,这是可能的。让我感到困惑的是 Gnuplot 如何处理浮点计算。在我期待分数值的地方,实际上我得到的是零。我的问题的关键是 Gnuplot 需要用浮点数 "think" 表示法:
stats dataFileForecast using 2 nooutput
freezeWarning = 32.
Yhigh = STATS_max + 10.
Ylow = STATS_min - 10.
freezeLabel = ((freezeWarning-Ylow) / (Yhigh-Ylow))
set yrange [Ylow:Yhigh]
if (32 > Ylow) set label "32°" at graph 0.01,freezeLabel tc rgb "#FFFFFF" font ",8"
关键是公式中使用的整数的 'dot' 表示法允许浮点计算(其他人也许可以向我解释为什么这是必要的......)标签绘图坐标是介于 0 和 1 之间(因此中间值为 0.5)因此需要分数答案。
公式 "freezeLabel" 计算 x 轴上方或下方的百分比,其中 32 将根据绘图 Yrange 比例绘制。如果 32 小于 Ylow,则标签不会绘制(if 语句),但数学会起作用,只是在负 Y 值处绘制标签(因此,看不见。)
我有一个折线图,我想在其中放置一个坐标基于 (x,y) 的标签,其中:
x would be relative to the graph at position (x = 0.01)
y would be relative to the data at position (value = 32)
是否可以根据 32 是否在当前范围内(换句话说,如果 yMin < 32 < yMax,将显示标签,否则不显示标签) )--结果大致如下所示:
是的,这是可能的。让我感到困惑的是 Gnuplot 如何处理浮点计算。在我期待分数值的地方,实际上我得到的是零。我的问题的关键是 Gnuplot 需要用浮点数 "think" 表示法:
stats dataFileForecast using 2 nooutput
freezeWarning = 32.
Yhigh = STATS_max + 10.
Ylow = STATS_min - 10.
freezeLabel = ((freezeWarning-Ylow) / (Yhigh-Ylow))
set yrange [Ylow:Yhigh]
if (32 > Ylow) set label "32°" at graph 0.01,freezeLabel tc rgb "#FFFFFF" font ",8"
关键是公式中使用的整数的 'dot' 表示法允许浮点计算(其他人也许可以向我解释为什么这是必要的......)标签绘图坐标是介于 0 和 1 之间(因此中间值为 0.5)因此需要分数答案。
公式 "freezeLabel" 计算 x 轴上方或下方的百分比,其中 32 将根据绘图 Yrange 比例绘制。如果 32 小于 Ylow,则标签不会绘制(if 语句),但数学会起作用,只是在负 Y 值处绘制标签(因此,看不见。)