【发布时间】:2014-06-13 16:00:53
【问题描述】:
我们有一个需要像素完美的大频谱图(1 行 = 100ms 的数据,1 列 = fft 的 1 个频率区间)。我使用下面的代码来计算绘图的大小:
set terminal unknown
sedcmd="<(sed -n '1p;" .rowstart. "," .rowend. "p' " .filename. ".csv)"
plot sedcmd nonuniform matrix using 2:1:3 notitle with image
xspan = GPVAL_DATA_X_MAX - GPVAL_DATA_X_MIN
yspan = GPVAL_DATA_Y_MAX - GPVAL_DATA_Y_MIN
set terminal png size (rowend-rowstart),yspan
sedcmd="<(sed -n '1p;" .rowstart. "," .rowend. "p' " .filename. ".csv)"
plot sedcmd nonuniform matrix using 2:1:3 notitle with image
rowstart 和 rowend 是传入 gnuplot 的变量,它们表示频率区间。这可以正常工作,但有一个例外,它没有考虑图例和标签所需的空间。我如何计算或设置像素以便:
[ylabels][ PLOT ][LEGEND]
[ xlabels ]
PLOT 将是我指定的确切尺寸(即:1000x1000)
编辑:绘图大小和边距的最终计算代码:
# margins and plotsize
rowstart = 2457 # rowstart/end represent the fft bins
rowend = 5734 # plot is actually rotated 90deg (rows are cols)
cols = 6970 # number of ms in plot (plotted rows)
plotwidth = (rowend - rowstart) +1
plotheight = cols
lm = 1200.00
rm = 600
tbmargin = 200.00
width = plotwidth + (lm + rm)
height = plotheight + (tbmargin * 2)
set lmargin at screen lm / width
set rmargin at screen 1 - (rm / width)
set tmargin at screen tbmargin / height
set bmargin at screen 1 - (tbmargin / height)
show margin
【问题讨论】:
标签: gnuplot