我有这个多重时段:
由以下代码生成:
set terminal pdf size 15,10
set output "graph.pdf"
set key off
set multiplot layout 5, 1 scale 1, 1
set style data histograms
set style histogram
set style fill solid border -1
set boxwidth 0.75
set yrange [0:178]
set ytics 50
set xtics offset 0,graph 0.01
set xtics font ",20"
set x2tics font ",20"
set ytics font ",20"
set tmargin 3
set bmargin 3
set style line 1 linetype -1 linewidth 3
set grid mxtics
set xtics (0.5 1,1.5 1,2.5 1,3.5 1,4.5 1,5.5 1,6.5 1,7.5 1,8.5 1,9.5 1,10.5 1,11.5 1,12.5 1,13.5 1,14.5 1,15.5 1,16.5 1,17.5 1,18.5 1,19.5 1,20.5 1,21.5 1,22.5 1,23.5 1,24.5 1,25.5 1,26.5 1,27.5 1,28.5 1,29.5 1,30.5 1 )
set tics out
plot 'outil1' every ::0::30 u 7:xtic(2) notitle lt rgb "blue" fillstyle pattern 2, 'ppm' every ::0::30 u 7 notitle lt rgb "red" fillstyle pattern 2, \
newhistogram at 0, 'outil1' every ::0::30 u 6:x2tic(1) notitle lt rgb "blue", 'ppm' every ::0::30 u 6 notitle lt rgb "red"
plot 'outil1' every ::30::60 u 7:xtic(2) notitle lt rgb "blue" fillstyle pattern 2, 'ppm' every ::30::60 u 7 notitle lt rgb "red" fillstyle pattern 2, \
newhistogram at 0, 'outil1' every ::30::60 u 6:x2tic(1) notitle lt rgb "blue", 'ppm' every ::30::60 u 6 notitle lt rgb "red"
plot 'outil1' every ::60::90 u 7:xtic(2) notitle lt rgb "blue" fillstyle pattern 2, 'ppm' every ::60::90 u 7 notitle lt rgb "red" fillstyle pattern 2, \
newhistogram at 0, 'outil1' every ::60::90 u 6:x2tic(1) notitle lt rgb "blue", 'ppm' every ::60::90 u 6 notitle lt rgb "red"
plot 'outil1' every ::90::120 u 7:xtic(2) notitle lt rgb "blue" fillstyle pattern 2, 'ppm' every ::90::120 u 7 notitle lt rgb "red" fillstyle pattern 2, \
newhistogram at 0, 'outil1' every ::90::120 u 6:x2tic(1) notitle lt rgb "blue", 'ppm' every ::90::120 u 6 notitle lt rgb "red"
plot 'outil1' every ::120::150 u 7:xtic(2) notitle lt rgb "blue" fillstyle pattern 2, 'ppm' every ::120::150 u 7 notitle lt rgb "red" fillstyle pattern 2, \
newhistogram at 0, 'outil1' every ::120::150 u 6:x2tic(1) notitle lt rgb "blue", 'ppm' every ::120::150 u 6 notitle lt rgb "red"
要生成图表,您需要outil1 data file和ppm data file
我遇到的问题是情节是最后一个与前4个图的大小不相同。抽搐之间的距离在最后一个图中更大,以使其适合整个画布。
有没有办法让最后一个情节与另一个情节对齐?例如,126 thic与第4个图中的96 tic对齐。
谢谢。
答案 0 :(得分:2)
绘制四个图形后,可以将左边距固定为它在此处的值,并根据图4到图5中的不同比例调整右边距。
您可以计算屏幕坐标中的左边距(即在[0:1]范围内,其中0表示最左边的画布边缘,1表示最右边的画布边缘),如下所示:
LMARGIN = GPVAL_TERM_SCALE * (0.0 + GPVAL_TERM_XMIN)/GPVAL_TERM_XSIZE
此处,GPVAL_TERM_SCALE
是一个因子,仅在gnuplot 5中可用,但需要独立于使用的终端获得正确的计算。使用gnuplot 4.6时。和pdfcairo
终端,此值为20
。您可以在脚本中放置一个小的if子句来检查:
if (exists('GPVAL_TERM_SCALE')) SCALE = GPVAL_TERM_SCALE; else SCALE = 20
因此,脚本中的最后一个plot
命令应如下所示:
if (exists('GPVAL_TERM_SCALE')) SCALE = GPVAL_TERM_SCALE; else SCALE = 20
LMARGIN = SCALE * (0.0 + GPVAL_TERM_XMIN)/GPVAL_TERM_XSIZE
RMARGIN = SCALE * (0.0 + GPVAL_TERM_XMAX)/GPVAL_TERM_XSIZE
set lmargin screen LMARGIN
set rmargin screen LMARGIN + (17.0/32.0)*(RMARGIN - LMARGIN)
plot 'outil1' every ::120::150 u 7:xtic(2) notitle lt rgb "blue" fillstyle pattern 2, 'ppm' every ::120::150 u 7 notitle lt rgb "red" fillstyle pattern 2, \
newhistogram at 0, 'outil1' every ::120::150 u 6:x2tic(1) notitle lt rgb "blue", 'ppm' every ::120::150 u 6 notitle lt rgb "red"
我只是通过手动计算您想要绘制的范围来获得因子(17.0/32.0)
。结果是