如何在Gnuplot中使用非线性轴?
我看到了一些这样的例子:如何在Gnuplot中使用非线性轴?,gnuplot,scale,axes,Gnuplot,Scale,Axes,我看到了一些这样的例子: 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 n
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.
对于x>=0范围内的数据,我需要以几乎半幅图的方式缩放x;
对于-100中的数据,forward函数告诉gnuplot在页面上绘制用户坐标[x,y]的位置。称那个位置为[x',y']。为此,只需要“前进”功能。但交互式终端会回显鼠标位置,并允许您出于各种目的单击绘图。为了知道鼠标点击[x',y']意味着什么,程序必须将其转换回原来的[x,y]。为此,它需要逆函数
有关在完整绘图的不同部分使用不同缩放函数的示例,请参阅下面复制的在线演示
# 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
#此示例显示如何使用非线性轴定义
#创建一个“断轴”。X坐标0-100位于左侧,
#X坐标500-1000位于右侧,它们之间有一个小间隙。
#只要没有绘制(100# 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