Gnuplot 调整multiplot中每个绘图的比例,使其均匀分布

Gnuplot 调整multiplot中每个绘图的比例,使其均匀分布,gnuplot,Gnuplot,我正在尝试使用gnuplot中的“multiplot”选项绘制多个图形。 图I的绘图如下所示 我有一个小问题,但我不知道如何解决这个问题。问题在于每个地块的规模。如果有一个通知,则每个地块a、b、c、d和e的比例不同。对于每个绘图,我使用了不同的设置xrange值。因此,我知道gnuplot试图拉伸绘图以适应给定的宽度限制。因此,沿水平轴的比例并非均匀分布 我希望每个绘图的比例均匀分布,尤其是水平轴 下面我给出了完整的代码供您查看 我怎样才能做到这一点 非常感谢 #!/usr/bin/gnupl

我正在尝试使用gnuplot中的“multiplot”选项绘制多个图形。 图I的绘图如下所示

我有一个小问题,但我不知道如何解决这个问题。问题在于每个地块的规模。如果有一个通知,则每个地块a、b、c、d和e的比例不同。对于每个绘图,我使用了不同的
设置xrange
值。因此,我知道gnuplot试图拉伸绘图以适应给定的宽度限制。因此,沿水平轴的比例并非均匀分布

我希望每个绘图的比例均匀分布,尤其是水平轴

下面我给出了完整的代码供您查看

我怎样才能做到这一点

非常感谢

#!/usr/bin/gnuplot

########################################################################################

mpl_top    = 0.4 #inch  outer top margin, title goes here
mpl_bot    = 0.7 #inch  outer bottom margin, x label goes here
mpl_left   = 0.3 #inch  outer left margin, y label goes here    #vj
mpl_right  = 0.8 #inch  outer right margin, y2 label goes here  #vj
mpl_height = 1.0 #inch  height of individual plots
mpl_width  = 2.2 #inch  width of individual plots       #vj  
mpl_dx     = 0.1 #inch  inter-plot horizontal spacing
mpl_dy     = 0.4 #inch  inter-plot vertical spacing
mpl_ny     = 5   #number of rows
mpl_nx     = 1   #number of columns

# calculate full dimensions
xsize = mpl_left+mpl_right+(mpl_width*mpl_nx)+(mpl_nx-1)*mpl_dx
ysize = mpl_top+mpl_bot+(mpl_ny*mpl_height)+(mpl_ny-1)*mpl_dy

# placement functions
#   rows are numbered from bottom to top
bot(n) = (mpl_bot+(n-1)*mpl_height+(n-1)*mpl_dy)/ysize
top(n)  = 1-((mpl_top+(mpl_ny-n)*(mpl_height+mpl_dy))/ysize)
#   columns are numbered from left to right
left(n) = (mpl_left+(n-1)*mpl_width+(n-1)*mpl_dx)/xsize
right(n)  = 1-((mpl_right+(mpl_nx-n)*(mpl_width+mpl_dx))/xsize)

#=================================================================

#set terminal postscript eps enhanced color dl 2.0 size xsize,ysize "Helvetica" 28
##set encoding iso_8859_1
##set tics scale 1
#set output 'nxm_plot.eps'


set terminal pngcairo size 650,650 enhanced dash #font "Arial-Bold,13" #fontscale 1.20
set output "Fill-Multi-plot-LDP-lyoSystemLast50ns.png"

set encoding iso_8859_1

set offsets
set autoscale fix
set size 1,1
set nokey

# define x-axis settings for all subplots
#set xrange [-30:30]
set yrange [0:3]
set xlabel ''
#set format x ''
set xtic auto
#set xtics 5    #pi
#set mxtics 4


#### VJ DEFINITION
#set style line 4 lt 4 lw 10    # Please DISABLE pause -1 
#########################################################################################

set style line 1 lt 1 lw 1.5  lc rgb "red"
set style line 2 lt 3 lw 1.5  lc rgb "red"
set style line 3 lt 5 lw 1.5  lc rgb "red"

set style line 4 lt 1 lw 1.5  lc rgb "black"
set style line 5 lt 3 lw 1.5  lc rgb "black"
set style line 6 lt 5 lw 1.5  lc rgb "black"

set style line 7 lt 1 lw 1.5  lc rgb "green"
set style line 8 lt 3 lw 1.5  lc rgb "green"
set style line 9 lt 5 lw 1.5  lc rgb "green"

set style line 10 lt 1 lw 1.5  lc rgb "blue"
set style line 11 lt 3 lw 1.5  lc rgb "blue"
set style line 12 lt 5 lw 1.5  lc rgb "blue"

set style line 13 lt 1 lw 1.5  lc rgb "magenta"
set style line 14 lt 3 lw 1.5  lc rgb "magenta"
set style line 15 lt 5 lw 1.5  lc rgb "magenta"

set style line 16 lt 1 lw 1.5  lc rgb "#6495ED"
set style line 17 lt 3 lw 1.5  lc rgb "#6495ED"
set style line 18 lt 5 lw 1.5  lc rgb "#6495ED"

###################################################################################################
set macro
#ylabelFONT="font 'arial,16'"
labelFONT="font 'Arial,16'"
scaleFONT="font 'Arial-Bold,14'"
scaleFONtt="font 'Helvetica,10'"
keyFONT="font 'Arial,12'"
#graph="using 1:2 with lines lw 1 "

###################################################################################################


# start plotting
set multiplot

#-----------------------------------------------
# subplot  1-5
#  set horizontal margins for first column
set lmargin at screen left(1)
set rmargin at screen right(1)
#  set horizontal margins for third row (top)
set tmargin at screen top(5)
set bmargin at screen bot(5)


set label "(a)" at -1.5,2.5  @labelFONT
set title ''
unset ylabel
set xrange [-20.0:20.0]
set format y "" #"%-2.1f"
plot    "malto12per-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "malto12per-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
    "malto12per-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
    "malto12per-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
    "malto12per-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
    "malto12per-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
    "malto12per-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
    "malto12per-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
    "malto12per-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
    "malto12per-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
    "malto12per-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
    "malto12per-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
    "malto12per-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
    "malto12per-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
    "malto12per-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
    "malto12per-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
    "malto12per-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
    "malto12per-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18 
;


#-----------------------------------------------
# subplot  1-4 at top most
#  set horizontal margins for first column
set lmargin at screen left(1)
set rmargin at screen right(1)
#  set horizontal margins for third row (top)
set tmargin at screen top(4)
set bmargin at screen bot(4)


unset label
set label "(b)" at -1.5,2.5  @labelFONT
set title ''
unset ylabel
set xtics
set xrange [-26.2:26.2]
set format y "" #"%-2.1f"


plot    "malto23per-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "malto23per-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "malto23per-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "malto23per-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "malto23per-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "malto23per-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "malto23per-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "malto23per-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "malto23per-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "malto23per-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "malto23per-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "malto23per-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "malto23per-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "malto23per-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "malto23per-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "malto23per-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "malto23per-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "malto23per-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18
;


#-----------------------------------------------
# subplot  1-3
#  set horizontal margins for first column
set lmargin at screen left(1)
set rmargin at screen right(1)
#  set horizontal margins for second row (middle)
set tmargin at screen top(3)
set bmargin at screen bot(3)


unset label
set label "(c)" at -1.5,2.5  @labelFONT
set title ''
set ylabel "Number Density" @labelFONT
set xrange [-24.2:24.2]
set format y "" #"%-1.1f"
plot    "bcm25perR-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "bcm25perR-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "bcm25perR-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "bcm25perR-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "bcm25perR-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "bcm25perR-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "bcm25perR-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "bcm25perR-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "bcm25perR-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "bcm25perR-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "bcm25perR-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "bcm25perR-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "bcm25perR-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "bcm25perR-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "bcm25perR-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "bcm25perR-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "bcm25perR-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "bcm25perR-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18
;



#-----------------------------------------------
# subplot  1-2
#  set horizontal margins for first column
set lmargin at screen left(1)
set rmargin at screen right(1)
#  set horizontal margins for second row (middle)
set tmargin at screen top(2)
set bmargin at screen bot(2)


unset label
set label "(d)" at -1.5,2.5  @labelFONT
set title ''
unset ylabel
set xrange [-24.8:24.8]
set format y "" #"%-1.1f"
plot    "bcm25perS-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "bcm25perS-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "bcm25perS-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "bcm25perS-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "bcm25perS-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "bcm25perS-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "bcm25perS-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "bcm25perS-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "bcm25perS-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "bcm25perS-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "bcm25perS-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "bcm25perS-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "bcm25perS-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "bcm25perS-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "bcm25perS-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "bcm25perS-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "bcm25perS-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "bcm25perS-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18
;


#-----------------------------------------------
# subplot  1-1
#  set horizontal margins for first column
set lmargin at screen left(1)
set rmargin at screen right(1)
#  set horizontal margins for first row (bottom)
set tmargin at screen top(1)
set bmargin at screen bot(1)


unset label
set label "(e)" at -1.5,2.5  @labelFONT
set title ''
# now set a label and tic marks for the x-axis
set xlabel "Distance / ({\305})"    @labelFONT
unset ylabel
set xrange [-24.1:24.1]
set format y "" # "%-1.1f"

plot    "bcm25perRS-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "bcm25perRS-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "bcm25perRS-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "bcm25perRS-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "bcm25perRS-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "bcm25perRS-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "bcm25perRS-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "bcm25perRS-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "bcm25perRS-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "bcm25perRS-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "bcm25perRS-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "bcm25perRS-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "bcm25perRS-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "bcm25perRS-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "bcm25perRS-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "bcm25perRS-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "bcm25perRS-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "bcm25perRS-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18
;

#----------------------------------------------------
set size 0.3,0.5
set origin -0.56,-0.35
set bmargin at screen 0
#set key at screen 0.85,screen 0.45 Left reverse spacing 1.0 samplen 1.0 maxcols 1 maxrows 6 @keyFONT
set key at screen 1.00,screen 0.45 maxcols 3 maxrows 6 @keyFONT
#set key center left  
set border 0 
unset xlabel
unset ylabel
unset label
unset tics
set format x ""
set format y ""
set yrange [0:1]
plot 2 ls 1 t '1-50ns', \
     2 ls 4 t '51-100ns', \
     2 ls 7 t '101-150ns', \
     2 ls 10    t '151-200ns', \
     2 ls 13    t '201-250ns', \
     2 ls 16    t '251-300ns'
;

unset multiplot


如果我理解正确,您希望所有图形的单位长度相同。您可以通过
do
循环动态设置边距以获得此效果。基本上,您需要在开始时定义xranges,以及您将找到的最大范围(您也可以通过更多的工作自动完成这一点)。以下代码应满足您的要求(有关详细信息,请阅读注释):

当然,这里有大量定制的空间

您还可以根据标签
i
定义函数,以便它们在循环中更改:

f(x,i) = (i == 1 ? sin(x) : \
          i == 2 ? cos(x) : \
          i == 3 ? tan(x) : 1/0)
.
.
.
plot f(x,i)
如果您有数据文件,可以通过以下方式执行相同操作:

datafiles = "data1 data2 data3"
.
.
.
plot word(datafiles,i)
与样式等类似:

set style line 1 lw 1
set style line 2 lw 2
set style line 3 lw 3
.
.
.
plot f(x,i) ls i
最后,如果您想要完全控制(例如,您正在混合函数和数据文件或其他内容),您可以在for循环中定义
if
语句:

.
.
.
if (i == 1) {plot sin(x)}
if (i == 2) {plot cos(x)}
if (i == 3) {plot "data1"}

如果我理解正确,您希望所有图形的单位长度相同。您可以通过
do
循环动态设置边距以获得此效果。基本上,您需要在开始时定义xranges,以及您将找到的最大范围(您也可以通过更多的工作自动完成这一点)。以下代码应满足您的要求(有关详细信息,请阅读注释):

当然,这里有大量定制的空间

您还可以根据标签
i
定义函数,以便它们在循环中更改:

f(x,i) = (i == 1 ? sin(x) : \
          i == 2 ? cos(x) : \
          i == 3 ? tan(x) : 1/0)
.
.
.
plot f(x,i)
如果您有数据文件,可以通过以下方式执行相同操作:

datafiles = "data1 data2 data3"
.
.
.
plot word(datafiles,i)
与样式等类似:

set style line 1 lw 1
set style line 2 lw 2
set style line 3 lw 3
.
.
.
plot f(x,i) ls i
最后,如果您想要完全控制(例如,您正在混合函数和数据文件或其他内容),您可以在for循环中定义
if
语句:

.
.
.
if (i == 1) {plot sin(x)}
if (i == 2) {plot cos(x)}
if (i == 3) {plot "data1"}

如果我理解正确,您希望所有图形的单位长度相同。您可以通过
do
循环动态设置边距以获得此效果。基本上,您需要在开始时定义xranges,以及您将找到的最大范围(您也可以通过更多的工作自动完成这一点)。以下代码应满足您的要求(有关详细信息,请阅读注释):

当然,这里有大量定制的空间

您还可以根据标签
i
定义函数,以便它们在循环中更改:

f(x,i) = (i == 1 ? sin(x) : \
          i == 2 ? cos(x) : \
          i == 3 ? tan(x) : 1/0)
.
.
.
plot f(x,i)
如果您有数据文件,可以通过以下方式执行相同操作:

datafiles = "data1 data2 data3"
.
.
.
plot word(datafiles,i)
与样式等类似:

set style line 1 lw 1
set style line 2 lw 2
set style line 3 lw 3
.
.
.
plot f(x,i) ls i
最后,如果您想要完全控制(例如,您正在混合函数和数据文件或其他内容),您可以在for循环中定义
if
语句:

.
.
.
if (i == 1) {plot sin(x)}
if (i == 2) {plot cos(x)}
if (i == 3) {plot "data1"}

如果我理解正确,您希望所有图形的单位长度相同。您可以通过
do
循环动态设置边距以获得此效果。基本上,您需要在开始时定义xranges,以及您将找到的最大范围(您也可以通过更多的工作自动完成这一点)。以下代码应满足您的要求(有关详细信息,请阅读注释):

当然,这里有大量定制的空间

您还可以根据标签
i
定义函数,以便它们在循环中更改:

f(x,i) = (i == 1 ? sin(x) : \
          i == 2 ? cos(x) : \
          i == 3 ? tan(x) : 1/0)
.
.
.
plot f(x,i)
如果您有数据文件,可以通过以下方式执行相同操作:

datafiles = "data1 data2 data3"
.
.
.
plot word(datafiles,i)
与样式等类似:

set style line 1 lw 1
set style line 2 lw 2
set style line 3 lw 3
.
.
.
plot f(x,i) ls i
最后,如果您想要完全控制(例如,您正在混合函数和数据文件或其他内容),您可以在for循环中定义
if
语句:

.
.
.
if (i == 1) {plot sin(x)}
if (i == 2) {plot cos(x)}
if (i == 3) {plot "data1"}

请添加一个重现您的问题的最小工作示例。这会增加有人花时间检查您的代码的可能性。请添加一个重现您的问题的最小工作示例。这会增加有人花时间检查您的代码的可能性。请添加一个重现您的问题的最小工作示例。这会增加有人花时间检查您的代码的可能性。请添加一个重现您的问题的最小工作示例。这会增加有人花时间浏览你的代码的机会。谢谢你的回复。我第一次遇到这种情况。在这个例子中,所有三个图都绘制了相同的函数。对于循环中的不同函数,如cos(x)、sin(x)和tan(x)如何?亲爱的Miguel,在我的例子中,我可以分别定义每个图的范围吗?为此,我需要像这样定义范围-(范围(1)=(1?”-20):\)?1/0的含义是什么?
I
只是一个标签,用于通过循环更改某些选项。要更改范围,只需编辑代码的第一部分。要更改函数,可以尝试类似的方法:
f(x,I)=(I==1?sin(x):I==2?cos(x):1/0)
。1/0告诉gnuplot忽略该函数,在我的示例中,如果我不是1、2或3,则返回该函数。感谢您的友好回复。我第一次遇到这个问题。在本示例中,所有三个图都绘制了相同的函数。对于循环中的不同函数,如cos(x)、sin(x)和tan(x)如何亲爱的米格尔,在我的情况下,我可以定义