gnuplottex and cairolatex for 3D plots: remove extra whitespace
1,473
Is this what you are after?
\documentclass{article}
\usepackage{gnuplottex}
\begin{document}
\begin{figure}
\begin{gnuplot}[terminal=cairolatex,terminaloptions={size 5in,4in}]
set format '$%g$'
set xlabel '$x$'
set ylabel '$y$'
set zlabel '$z$'
set xtics offset 0,-.5
set ytics offset 1,-.5
set parametric
unset key
set xrange [-3:1]
set yrange [-3:1]
set zrange [-1:1]
set urange [0:pi]
set vrange [0:2*pi]
r = .5
splot r*sin(u)*cos(v),r*sin(u)*sin(v),r*cos(u)
\end{gnuplot}
\caption{Some gnuplot figure}
\label{fig:blah}
\end{figure}
\end{document}
Related videos on Youtube
Comments
-
vardonir over 1 year
as title says.
I'm using gnuplottex with the cairolatex terminal for both my 2D and 3D plots. While the 2D plots look great, the 3D plots have too much whitespace. I tried negative vspace, negative l/r/t/bmargin (which apparently doesn't really work), and setting the size manually. The third one results in tiny tiny tiny plots.
My code looks like this:
\begin{figure} \begin{gnuplot}[terminal=cairolatex, terminaloptions={size 7in,6in crop}] ***gnuplot code*** \end{gnuplot} \caption []{} \label{fig:blah} \end{figure}
I'm not sure if "crop" is doing anything. I tried epslatex but it doesn't change anything. The document is A4-sized paper. It's the same result when using multiplot.
edit: the whitespace is a lot more when I used set view xyz. I need that, tho. Maybe it's related?
edit2: MWE:
\documentclass[a4paper, 12pt, oneside]{book} \usepackage[cleanup, subfolder]{gnuplottex} \usepackage[top=0.5in, bottom=0.5in, left=1.5in, right=1.25in]{geometry} \usepackage[scaled=.90]{helvet} \usepackage{courier} \usepackage{color} \usepackage{graphicx} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{figure}[h!] \begin{gnuplot}[terminal=cairolatex] set parametric set view 66,200 set view equal xyz set ticslevel 0 set xrange [-1:3] set yrange [-1:3] set zrange [-1:1] set xlabel"x" set ylabel "y" set zlabel "z" r = 0.5 splot [-pi:pi][-pi/2:pi/2] r*cos(u)*cos(v), r*sin(u)*cos(v), r*sin(v) lc 3 title "sphere" \end{gnuplot} \end{figure} \lipsum[1] \end{document}
And how it looks
-
Henri Menke almost 9 years
size 7in,6in
is quite excessive. Either reduce it to, saysize 5in,3in
or remove it completely.
-
-
egreg almost 9 yearsThe hyphens used as minus signs are really ugly.
-
vardonir almost 9 yearsI tried removing the size entirely and got a very small (half the width of the document) image. I tried 5x4in and it's still the same, just more vspace between the key and the graph and the caption (something I'm trying to reduce, either).
-
Henri Menke almost 9 years@egreg Aesthetics improved.
-
Henri Menke almost 9 years@Vardonir Well, without a minimal working example (MWE) there's nothing I can do for you.
-
vardonir almost 9 yearsjust added a working code.