我试图在另一个上面绘制几组数据,我试图绘制一些垂直线来表示每个图中的一些标记。问题是对齐这些标记线。对于所有图,x轴从0开始到每个图的不同最大值。
编译下面的脚本,可以获得我的问题示例。每个图的左边有两条蓝色虚线,从相同的x坐标开始,我想我们应该垂直对齐。对于左侧的黑线,没有必要,因为那里的最大值是不同的。问题是:为什么蓝色虚线不对齐,我怎样才能使它们对齐?
mpl_top = 0.2 #inch outer top margin, title goes here
mpl_bot = 0.6 #inch outer bottom margin, x label goes here
mpl_left = 1.3 #inch outer left margin, y label goes here
mpl_right = 0.2 #inch outer right margin, y2 label goes here
mpl_height = 3.0 #inch height of individual plots
mpl_width = 4.5 #inch width of individual plots
mpl_dx = 0.1 #inch inter-plot horizontal spacing
mpl_dy = 0.5 #inch inter-plot vertical spacing
mpl_ny = 2 #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.5
set output 'test.eps'
#
set offsets
set autoscale fix
set size 1,1
set nokey
#
set multiplot
#
set lmargin at screen left(1)
set rmargin at screen right(1)
#
set tmargin at screen top(2)
set bmargin at screen bot(2)
#.....................................................
#.....................................................
#
set origin 0.0,0.0
set xrange [0.0:79.739]
set yrange [-1.1:1.1]
set format x
set ylabel "z-z_0 ({\305})" font ",36"
set format y "%-2.2f"
set ytics
set mytics
#
set arrow 19 from first 7.5, first 0 to first 72.239, first 0 nohead dt 2 lw 2 lc 0
set arrow 29 from first 7.5, graph 0 to first 7.5, graph 1 nohead dt 2 lw 2 lc rgb "blue"
set arrow 39 from first 72.239, graph 0 to first 72.239, graph 1 nohead dt 2 lw 2 lc 0
set arrow 49 from first 19.215, graph 0 to first 19.215, graph 1 nohead dt 2 lw 2 lc rgb "blue"
set arrow 59 from first 58.5715, graph 0 to first 58.5715, graph 1 nohead dt 2 lw 2 lc 0
#
plot '9pto.dat' u 1:(column(1)-column(2)) w p pt 7 ps 1 lc rgb "red"
#-----------------------------------------------
#
#========================9pto================================
#
unset arrow 19
unset arrow 29
unset arrow 39
unset arrow 49
unset arrow 59
#
#========================7pto================================
#
#-----------------------------------------------
set lmargin at screen left(1)
set rmargin at screen right(1)
#
set tmargin at screen top(1)
set bmargin at screen bot(1)
#.....................................................
unset xrange
unset yrange
unset y2range
unset ylabel
unset y2label
unset ytics
unset y2tics
unset my2tics
#.....................................................
#
set origin 0.0,0.0
set xrange [0.0:71.427]
set yrange [-1.1:1.1]
set format x
set ylabel "z-z_0 ({\305})" font ",36"
set format y "%-2.2f"
set ytics
set mytics
#
set arrow 17 from first 7.5, first 0 to first 63.927, first 0 nohead dt 2 lw 2 lc 0
set arrow 27 from first 7.5, graph 0 to first 7.5, graph 1 nohead dt 2 lw 2 lc rgb "blue"
set arrow 37 from first 63.927, graph 0 to first 63.927, graph 1 nohead dt 2 lw 2 lc 0
set arrow 47 from first 19.215, graph 0 to first 19.215, graph 1 nohead dt 2 lw 2 lc rgb "blue"
set arrow 57 from first 50.2595, graph 0 to first 50.2595, graph 1 nohead dt 2 lw 2 lc 0
#
plot '7pto.dat' u 1:(column(1)-column(2)) w p pt 7 ps 1 lc rgb "red"
#-----------------------------------------------
#
#========================7pto================================
#
unset multiplot
9pto.dat如下:
7.500000000 7.5000000000000
7.500000000 7.5000000000000
9.452500000 9.4525000000000
9.452500000 9.4525000000000
9.452500000 9.4525000000000
11.583156599 11.405000000000
11.539727382 11.405000000000
13.596201524 13.357500000000
13.536332124 13.357500000000
13.536332124 13.357500000000
15.716136896 15.310000000000
15.609405439 15.310000000000
17.730589548 17.262500000000
17.577538550 17.262500000000
17.577538550 17.262500000000
19.942432455 19.215000000000
19.696399454 19.215000000000
21.853782286 21.130916000000
21.613241577 20.806748000000
21.613241577 20.806748000000
23.951367855 23.371000000000
23.675253265 22.897216000000
25.876028840 25.286916000000
25.652539079 24.962748000000
25.652539079 24.962748000000
27.981455855 27.527000000000
27.700588520 27.053216000000
29.901766287 29.442916000000
29.673917026 29.118748000000
29.673917026 29.118748000000
32.015564739 31.683000000000
31.728849366 31.209216000000
33.935280551 33.598916000000
33.711807047 33.274748000000
33.711807047 33.274748000000
36.043972335 35.839000000000
35.760577517 35.365216000000
37.962737205 37.754916000000
37.735787279 37.430748000000
37.735787279 37.430748000000
40.076026405 39.995000000000
39.789136095 39.521216000000
41.995165304 41.910916000000
41.771451945 41.586748000000
41.771451945 41.586748000000
44.104011430 44.151000000000
43.820512338 43.677216000000
46.022759682 46.066916000000
45.795460028 45.742748000000
45.795460028 45.742748000000
48.136073388 48.307000000000
47.849254547 47.833216000000
50.056153041 50.222916000000
49.831177787 49.898748000000
49.831177787 49.898748000000
52.166378677 52.463000000000
51.883485575 51.989216000000
54.072515581 54.378916000000
53.849825503 54.054748000000
53.849825503 54.054748000000
56.210825315 56.619000000000
55.904445477 56.145216000000
58.071242482 58.571500000000
57.894686723 58.571500000000
57.894686723 58.571500000000
60.260074125 60.524000000000
60.099923105 60.524000000000
62.215148559 62.476500000000
62.119379597 62.476500000000
62.119379597 62.476500000000
64.312509506 64.429000000000
64.237663656 64.429000000000
66.335699265 66.381500000000
66.265901323 66.381500000000
66.265901323 66.381500000000
68.348020041 68.334000000000
68.359113309 68.334000000000
70.495709175 70.286500000000
70.423033245 70.286500000000
70.423033245 70.286500000000
72.195364598 72.239000000000
72.542252421 72.239000000000
7pto.dat文件是:
7.500000000 7.5000000000000
7.500000000 7.5000000000000
9.452500000 9.4525000000000
9.452500000 9.4525000000000
9.452500000 9.4525000000000
11.570027646 11.405000000000
11.528708226 11.405000000000
13.575782705 13.357500000000
13.513624522 13.357500000000
13.513624522 13.357500000000
15.677771574 15.310000000000
15.586498468 15.310000000000
17.700850877 17.262500000000
17.547059322 17.262500000000
17.547059322 17.262500000000
19.888641959 19.215000000000
19.678988604 19.215000000000
21.803504020 21.130916000000
21.596035886 20.806748000000
21.596035886 20.806748000000
23.873441618 23.371000000000
23.640802845 22.897216000000
25.807281382 25.286916000000
25.618453971 24.962748000000
25.618453971 24.962748000000
27.871056796 27.527000000000
27.641136558 27.053216000000
29.799548044 29.442916000000
29.605761869 29.118748000000
29.605761869 29.118748000000
31.867722758 31.683000000000
31.637509864 31.209216000000
33.793129515 33.598916000000
33.592025117 33.274748000000
33.592025117 33.274748000000
35.870634350 35.839000000000
35.636214996 35.365216000000
37.804791496 37.754916000000
37.605887777 37.430748000000
37.605887777 37.430748000000
39.885438407 39.995000000000
39.649447834 39.521216000000
41.818678704 41.910916000000
41.616398208 41.586748000000
41.616398208 41.586748000000
43.903726004 44.151000000000
43.665404575 43.677216000000
45.824542985 46.066916000000
45.630606451 45.742748000000
45.630606451 45.742748000000
47.935779735 48.307000000000
47.672861008 47.833216000000
49.824715050 50.259500000000
49.673951259 50.259500000000
49.673951259 50.259500000000
51.987893623 52.212000000000
51.855902368 52.212000000000
53.965761583 54.164500000000
53.884656301 54.164500000000
53.884656301 54.164500000000
56.057317126 56.117000000000
55.987281835 56.117000000000
58.080894317 58.069500000000
58.010422067 58.069500000000
58.010422067 58.069500000000
60.105273987 60.022000000000
60.105270232 60.022000000000
62.246754237 61.974500000000
62.167660596 61.974500000000
62.167660596 61.974500000000
63.942897335 63.927000000000
64.295080389 63.927000000000
我不确定如何附加数据文件,所以我很抱歉此消息的长度。
答案 0 :(得分:1)
请再想一想:蓝线与from first 7.5
,from first 19.215
位于同一个x位置。坐标系first
由x和y轴定义。你有不同的x轴。因此,没有真正的理由将蓝线对齐。
要对齐线条,有几种可能性:
使用不依赖于x轴的坐标系:graph
或screen
保持first
坐标系并在任何地方使用相同的x范围(我认为这可能是首选解决方案。)
保持first
坐标系和不同的x范围,并重新计算每个绘图的x位置,使线条对齐