如何在 Gnuplot 中使用非线性轴?

How to use nonlinear axes in Gnuplot?

我看到了一些这样的例子:

f(x) = log10(x)
g(x) = 10**x
set nonlinear x via f(x) inverse g(x)

所以这个相当于对 x 进行对数缩放。
但是我不明白为什么我们需要写反函数? 我也有这种情况:

For data in x>=0 range I need to scale x in a way that it shows in an almost-half plot;
For data in -100<=x<0 I need to scale x in a way that it shows in a small part of plot;
For data in x<-100 I need to scale x in a way as for data in x>=0.

让我们假设我们有一个 a4paper 并且 gnuplot 在上面创建了他的图。我想要一个以 x 比例绘制的绘图结果,例如:

If x>=0 1cm = 5 
If -100<=x<0 1cm = 100
If x<-100 1cm = 5

(我并不是说只有这一厘米对我很重要,它只是说我需要两个 x 值的增量与它们之间的实际长度之间的相关性。)

很抱歉我无法理解这种缩放机制。

forward 函数告诉 gnuplot 在页面上的何处绘制用户坐标 [x,y]。将该位置称为 [x',y']。为此只需要 forward 函数。但是交互式终端会回显鼠标位置,并允许您出于各种目的点击绘图。为了了解鼠标点击 [x',y'] 的含义,程序必须将其转换回原始的 [x,y]。为此,它需要反函数。

有关在完整图的不同部分使用不同缩放函数的示例,请参阅下面转载的在线演示 nonlinear1.dem

# This example shows how a nonlinear axis definition can be used to 
# create a "broken axis". X coordinates 0-100 are at the left,
# X coordinates 500-1000 are at the right, there is a small gap between them.
# So long as no data points with (100 < x < 500) are plotted, this works as expected.
#
# f(x) maps x axis (discontinuous) to shadow axis coords (continuous linear range [0:1000])
# g(x) maps shadow axis coords to x axis readout
# 
  set title "A 'broken' x axis can be defined using 'set nonlinear x'"

# Define the broken-axis mapping
  axis_gap = 25.
  f(x) = (x <= 100) ? x : (x < 500) ? NaN : (x - 400 + axis_gap)
  g(x) = (x <= 100) ? x : (x < 100 + axis_gap) ? NaN : (x + 400 - axis_gap)
  set xrange [15:600] noextend
  set nonlinear x via f(x) inverse g(x)

  set xtics 50.
  set xtics rotate by -90 nomirror
  set ytics nomirror
  set border 3
  unset key

# Creation of the broken axis marks (this should be automated)
  set arrow 500 from 100, graph 0 to 500, graph 0 nohead lt 500 lw 2 lc bgnd front
  set arrow 501 from 100, graph 0 length graph  .01 angle 75 nohead lw 2 front
  set arrow 502 from 100, graph 0 length graph -.01 angle 75 nohead lw 2 front
  set arrow 503 from 500, graph 0 length graph  .01 angle 75 nohead lw 2 front
  set arrow 504 from 500, graph 0 length graph -.01 angle 75 nohead lw 2 front

  plot 'silver.dat' with yerrorbars lw 2, '' with lines