我在 Gnuplot 中绘制了以下内容。我的问题是曲线超出了边界(所以我们可以看到紫色和蓝色曲线超出了 y 轴)。有什么办法可以解决这个问题?我希望有一些东西将绘图限制在绘图区域内。当然,我可以绘制更少的曲线,但这看起来很奇怪。理想情况下,我希望 Gnuplot 绕过曲线的框架并删除那里的任何曲线位。
我让紫色曲线异常胖只是为了说明问题。不过,蓝色曲线也存在问题。
产生上述情节的代码是:
#!/usr/bin/env gnuplot
### n: change this parameter to equal the number of data sets to be plotted
n = 2
# t: top margin in pixels
t = 25.0
# b: key height in pixels (bottom margin)
b = 25.0
# h: height of output in pixels
h = 150.0*n + t + b
### define functions to help set top/bottom margins
top(i,n,h,t,b) = 1.0 - (t+(h-t-b)*(i-1)/n)/h
bot(i,n,h,t,b) = 1.0 - (t+(h-t-b)*i/n)/h
### first set up some basic plot parameters
#set term cairolatex size 15cm,15cm
#set output 'DifferentialAmplifierPlot.tex'
set term pdfcairo size 15cm,15cm
set output 'DifferentialAmplifierPlot.pdf'
set border lw 4
set grid mxtics mytics xtics ytics ls '-1' ls '-1' lc rgb 'gray70', lc rgb 'gray90'
set mxtics
set mytics
# Make yrange > ytics > function to get padding.
set yrange [-1.5:1.5]
set ytics ("" -1.5, -1.25 1, -1.0, -0.75 1, -0.5, -0.25 1, 0.0, 0.25 1, 0.5, 0.75 1, 1.0, 1.25 1, "" -1.5)
set xtics 0,1,5
set xrange [0:5]
set xtics
set mxtics
set mytics
set format x ""
set grid xtics ytics mxtics mytics ls -1 ls -1 lc rgb 'gray60', lc rgb '#C0E5E5E5''
set multiplot layout (n+1),1 #font ",14" title 'Input And Output Voltages Of Differential Amplifier'
### First plot
# change only plot command here
currentplot = 1
set tmargin at screen top(currentplot,n,h,t,b)
set bmargin at screen bot(currentplot,n,h,t,b)
unset key
unset xlabel
set title 'Input (Bottom) And Output (Top) Voltages Of The Differential Amplifier'
set ylabel 'Voltage [V]'
plot 'DifferentialAmplfier.dat' using (1000*$1):2 with lines lw 20 lc rgb 'dark-magenta'
### Last plot
# change only plot command here
currentplot = currentplot + 1
set tmargin at screen top(currentplot,n,h,t,b)
set bmargin at screen bot(currentplot,n,h,t,b)
set format x
unset title
set xlabel 'Time [ms]'
set ylabel 'Voltage [mV]'
plot 'DifferentialAmplfier.dat' using (1000*$1):(1000*$3) with lines lw 10 lc rgb 'navy'
unset multiplot
set term x11
有问题/狡猾的修复...