2

I am designing a slide in beamer, where I want to plot a 3D figure.

My preamble is as follows:

\documentclass[compress,red]{beamer}
\mode<presentation>
{
  \usetheme{Warsaw}
  \setbeamercovered{transparent}
}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage[T1]{fontenc}
\usefonttheme{serif}
\usepackage{pgfplots}
\usepackage{gnuplottex}
\usepackage{epstopdf}
\usepackage{graphicx,caption,subcaption}
\graphicspath{{images/}}

My slide code is as follows:

\begin{frame}[fragile]{Illustration of 3D plot}{Rastrigin's function}
    \begin{figure}
        \centering
        \begin{gnuplot}[terminal=cairolatex,terminaloptions={color size=\textheight,\textheight}]
            set xrange [-5.6:5.6]
            set yrange [-5.6:5.6]
            set ticslevel 0
            f(x,y) = 20 + x**2 - 10 * cos(2 * pi * x) + y**2 - 10 * cos(2*pi *y) 
            set pm3d
            set isosample 100
            set hidden3d
            legend off
            set palette rgbformulae 22,13,-31
            splot f(x,y)  
        \end{gnuplot}
    \end{figure}
\end{frame} 

The trouble is that the 3D plot wouldn't fit in the slide, even though I have attempted multiple combinations.

OS: Sierra / 64 bit / GNUPLOT on MAC / TexLive 2015

2

I get a result with

\documentclass[compress,red]{beamer}
\mode<presentation>
{
  \usetheme{Warsaw}
  \setbeamercovered{transparent}
}

\usepackage{gnuplottex}

\begin{document}
\begin{frame}[fragile]
\frametitle{Illustration of 3D plot}{Rastrigin's function}
\centering
\begin{gnuplot}[terminal=cairolatex,terminaloptions={color size 9cm,7.25cm}]
  set xrange [-5.6:5.6]
  set yrange [-5.6:5.6]
  set ticslevel 0
  f(x,y) = 20 + x**2 - 10 * cos(2 * pi * x) + y**2 - 10 * cos(2*pi *y)
  set pm3d
  set isosample 100
  set hidden3d
  set palette rgbformulae 22,13,-31
  unset key
  splot f(x,y)
\end{gnuplot}
\end{frame}

\end{document}

The size cannot be given in terms of \textheight (not that way, at least).

I also get an error at legend off, but probably it depends on the fact I have gnuplot 5.0 that uses unset key.

The font is too big, find the way to make it smaller.

enter image description here

  • Maybe also draw attention to the explicit size. With {color size=\textheight,\textheight} I get an error during compilation. – user36296 Dec 15 '16 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.