GNUplot中的多个图

use*_*228 5 linux gnuplot

我想在GNUplot中做多色图或子图.我有两个文件,在两个文件中有x1,y1.我想在GNUplot中绘制两个图形,如子图.假设我有以下两个文件

Plot1

12:14:38 10

12:15:38 11

12:16:38 12

12:17:38 15

和另一个文件

Plot2

12:17:38 15

12:18:38 11

12:19:38 12

12:20:38 15

我想为这两个值生成两个图.我如何使用GNUplot来做到这一点.任何人都可以帮助我.

谢谢

and*_*ras 12

如果我理解你在问什么,这里是基本语法:

set term png size 600,400
set output 'plot.png'

set multiplot           # engage multiplot mode
set size 1.0,1.0        # sets the size of the first plot
set xdata time          ## these three lines control how gnuplot
set timefmt '%H:%M:%S'  ## reads and writes time-formatted data.
set format x '%H:%M:%S' ##

plot 'data1' u 1:2      # plot the first data set

set size 0.4,0.4        # set the size of the second plot in plot units
set origin 0.15,0.5     # set the origin for the second plot in plot units

plot 'data2' u 1:2      # plot the second data set
Run Code Online (Sandbox Code Playgroud)

这将绘制第二个数据集作为子图.

子图

要在网格中制作两个图,您可以使用set multiplot layout:

set term png size 600,300
set output 'plot.png'

set multiplot layout 1,2        # engage multiplot mode
#set size 1.0,1.0       # sets the size of the first plot
set xdata time          ## these three lines control how gnuplot
set timefmt '%H:%M:%S'  ## reads and writes time-formatted data.
set format x '%H:%M:%S' ##
set xtics 120           # make time spacing of 2 minutes

plot 'data1' u 1:2      # plot the first data set 

#set size 0.4,0.4       # set the size of the second plot in plot units
#set origin 0.15,0.5    # set the origin for the second plot

plot 'data2' u 1:2      # plot the second data set 
unset multiplot
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述