Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
668 views
in Technique[技术] by (71.8m points)

latex - Using gnuplot, how to obtain a PDF with canvas size, including the texts?

Question

I want
enter image description here
neither
enter image description here
nor enter image description here

Description

The first figure is what I want.
The second figure is obtained by

set terminal cairolatex pdf
set output 'cairolatex.pdf'
set xlabel '$sigma$'
set ylabel '$alpha$'
plot 'data' u 1:2 w l

For the third figure, first

set terminal cairolatex pdf
set output 'cairolatex.tex'
set xlabel '$sigma$'
set ylabel '$alpha$'
plot 'data' u 1:2 w l

Then

pdflatex plot.tex

where plot.tex is

documentclass{article}
usepackage{graphics}
egin{document}
input{plot.tex}
end{document}

Edit: Thanks to Ethan, I can reach
enter image description here
by

set term pdf size 10cm,7cm
set output 'term.pdf'
set xlabel '$sigma$'
set ylabel '$alpha$'
plot 'data' u 1:2 w l

But I want to use latex typesetting for xlabel and ylabel.

question from:https://stackoverflow.com/questions/65867455/using-gnuplot-how-to-obtain-a-pdf-with-canvas-size-including-the-texts

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

OK, revised answer to produce a figure using TeX typesetting. Several gnuplot terminals could do this but I recommend using tikz.

set term tikz standalone size 12cm, 7cm
set output 'figure.tex'
set xlabel '$sigma$'
set ylabel '$alpha$' offset -2
set xrange [1:7]
set lmargin 12
set border lw 2
plot 10.**x title '$10^x$'
unset output
!pdflatex figure

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...