简体   繁体   English

乳胶图形标题与通过epslatex终端生成的gnuplot图形重叠

[英]Latex figure caption overlaps gnuplot figure generated with the epslatex terminal

I have to plot 4 graphs without vertical spaces between them and add a caption in my tex document. 我必须绘制4个图形,它们之间没有垂直间隔,并在tex文档中添加标题。 The problem is that the caption is overlapped with the x-axis label because of the zero bottom margin, I think. 问题在于,由于底部底边距为零,字幕与x轴标签重叠。

The gnuplot file is something like this gnuplot文件是这样的

set term epslatex
set output 'foo.tex'

set xrange [-1:1]
set yrange [-1:1]

set multiplot layout 4,1
set ylabel '$y$'
unset xlabel
unset xtics
set tmargin 0
set bmargin 0
plot x w lines
plot x*x w lines
plot x*x*x w lines
set xlabel '$x$'
set xtics
plot x*x*x*x w lines
unset multiplot

and the tex file is 和tex文件是

\documentclass[a4paper,11pt]{toptesi}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\input{foo}
\caption{bla bla}
\end{figure}

\end{document}

and the "bla bla" comes over the x label... I tried to put an set bmargin "something" before the last graph but this have the problem that the last graph hasn't the size of the first three anymore... How to fix the size of plots but allow a bmargin for the tex caption? 并且“ bla bla”出现在x标签上...我试图在最后一张图之前放一个设置的bmargin“某物”,但这有一个问题,就是最后一张图不再具有前三个图的大小了...如何确定地块的大小,但允许tex标题留有边距?

Try this code... 试试这个代码...

set term epslatex size <width> <height>
set output 'foo.tex'

set xrange [-1:1]
set yrange [-1:1]

set multiplot
# setup sizes of single plots
set size 1,.25
set ylabel '$y$'
unset xlabel
unset xtics
set tmargin 0
set bmargin 0
# set bottom left corner of current plot
set origin 0,.75
plot x w lines
set origin 0,.5
plot x*x w lines 
set origin 0,.25
plot x*x*x w lines
set xlabel '$x$'
set xtics 
# set bmargin back
set bmargin 3 #might be enought for place xlabel, try it...
set origin 0,0 
plot x*x*x*x w lines

unset multiplot
set out
set term pop

But... The bottom panel is smaller than others, so you must increase vertical size of bottom panel (using set size 1, a ) a>0.25 and decrease vertical size of others ( set size 1, b before each plot command) and satisfy that a+3b=1 . 但是...底部面板比其他面板要小,因此必须增加底部面板的垂直尺寸(使用set size 1, aa>0.25并减小其他面板的垂直尺寸(在每个绘图命令之前set size 1, b ),然后满足a+3b=1 This fine tuning will depend on size parameter of epslatex terminal. 这种微调将取决于epslatex终端的大小参数。

Much much better solution might be this: 更好的解决方案可能是:

 ...
 set size 0,.25
 set tmargin 0
 set bmargin 1
 set origin .75,0
 plot ...
 set tmargin -1
 set bmargin 2
 set origin .5,0
 plot ...
 set tmargin -2
 set bmargin 3
 set origin .25,0
 plot ...
 set tmargin -3
 set bmargin 4
 set origin .25,0
 plot ...

Now we might have enough space for bottom xlabel and all of the panels have same height. 现在我们可能有足够的空间用于底部xlabel,并且所有面板的高度都相同。 Unfotunatelly gnuplot 4.6.3 interprets tmargin -3 as tmargin 0 . 不幸的是,gnuplot 4.6.3将tmargin -3解释为tmargin 0 So we can't use it right now... May be in some newer version. 因此我们暂时无法使用...可能是某些较新的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM