Graphics, Figures & TablesGnuplot 'epslatex' Figure overlapping with Text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
mariaXY
Posts: 9
Joined: Wed Jul 06, 2011 11:00 am

Gnuplot 'epslatex' Figure overlapping with Text

Post by mariaXY »

Hello!

Hi have an overlapping problem with a figure. I am creating my figures in Gnuplot with epslatex. I am also using the multiplot option. My figure is OK so far, but I have a problem when inserting it into the latex document, since it overlap with the description of the figure. Here I attach the figure, and this is the code that I am using:

Code: Select all

set terminal epslatex 

set size 1,1
set origin 0.0,0.0
set logscale x
set xrange[500:10000]
set multiplot

set output 'filename.tex'
set origin 0.0,0.0
set size 1,0.75
set tmarg 0
set bmarg 0
set lmarg 7
set rmarg 3
set format x ""
unset key
set logscale y
set yrange[1:8]
set ytics(1,2,3,4,5,6,7,8)
set ylabel "Spectra"
set style line 1 lt 1 lw 3 lc rgb "red"
set style line 2 lt 1 lw 3 lc rgb 'green'
set style line 4 lt 1 lw 3 lc rgb 'blue'
set style line 3 lt 1 lw 3 pt 7 lc rgb "black"
set key right bottom
set point 1.3
plot 'data1.dat' u 1:(($3*0.908173)/4) w l ls 1 t '$\beta=5.4905$',\
'data2.dat' u 1:(($3*0.908173)/4) w l ls 2 t '$\beta=6.19$',\
'data3.dat' u 1:2 w l ls 4 t 'Blue',\
'data4.dat' using 1:2:3 with yerrorbars ls 3 not ,\
'data4.dat' using 1:2 ls 3 t 'N'

set origin 0.0,-0.25
set size 1,0.25
unset logscale y
set tmarg 0
set bmarg 0
set lmarg 7
set rmarg 3
set xlabel "$l$"
set format x "%g"
set yrange[-10:10]
set ytics -10,5,5
set xlabel "$l$"
set ylabel "Residual"
set arrow 1 from graph 0, first 0 rto graph 1,0 nohead lt 1 lw 1 lc 0
set style line 1 lt 1 lw 3 lc rgb "red"
set style line 2 lt 1 lw 3 lc rgb 'green'
set style line 4 lt 1 lw 3 lc rgb 'blue'
plot 'data5.dat' u 1:2 w l ls 1 not,\
'data6.dat' u 1:2 w l ls 2 not,\
'data7.dat' u 1:2 w l ls 4 not

set output

unset multiplot
I think the problem is due to the code in Gnuplot, and not with the latex itself. But I just cannot solve it.

I appreciate if someone can help me!

Thanks,

Maria
Attachments
draft.pdf
(29.19 KiB) Downloaded 358 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Gnuplot 'epslatex' Figure overlapping with Text

Post by cgnieder »

Hi,

It looks like the bounding box is not right. Maybe you need to specify it in \includegraphics (which I assume you're using). It is extremely difficult to say more since I can't test it myself, lacking all your data files.
mariaXY wrote:think the problem is due to the code in gnuplot, and not with the latex itself
This sounds as if you're not really sure. That means it could be the LaTeX source. Maybe you should provide a Infominimal working example anyway, that reproduces the wrong behaviour.

As a sidenote: have you considered using gnuplottex which allows you to use gnuplot code directly in your source, or switching to pgfplots which is an excellent package for creating plots?

Regards
site moderator & package author
mariaXY
Posts: 9
Joined: Wed Jul 06, 2011 11:00 am

Gnuplot 'epslatex' Figure overlapping with Text

Post by mariaXY »

Hi,

Thanks for the reply. Here I attach an example of the strange behaviour of Gnuplot. It happens when I change the

Code: Select all

set origin
of the plots:

For the first plot instead of

Code: Select all

set origin 0.0,0.0
I put

Code: Select all

set origin 0.0,0.50
and for second one instead of

Code: Select all

set origin 0.0,-0.25
I write

Code: Select all

set origin 0.0,0.25
.

Then, as you can see just the label of the x and y axis moves, but not the graph itself.

Thanks,

Maria
Attachments
draft2.pdf
(29.19 KiB) Downloaded 291 times
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Re: Gnuplot 'epslatex' Figure overlapping with Text

Post by localghost »

Put all the data files (*.dat) into a ZIP or RAR archive and attach them to your next post.


Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
mariaXY
Posts: 9
Joined: Wed Jul 06, 2011 11:00 am

Gnuplot 'epslatex' Figure overlapping with Text

Post by mariaXY »

Hello,

Finally I solved my problem. It was just matter of playing around with the size of the image. At the end I just change the first

Code: Select all

set size 1,1
to

Code: Select all

set size 1,1.30
When one uses "multiplot", one has to change the size of the figure, to adapt it in to the new environment.

Cheers,

Maria
Post Reply