I am having trouble adding a TikZ graphic to my Beamer presentation which uses the theme Metropolis. Here is an example of the issue:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
%\usetheme{metropolis}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
view = {135}{20},
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
xmin=-1, xmax=1,
ymin=-1, ymax=1,
zmin=0, zmax=1,
]
\draw (0, 1, 0) -- (1, 1, 1);
\end{axis}
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
This code does what I want, but uncommenting the line \usetheme{metropolis}
changes the graphic and makes the line shorter. (I don't think it's invisible, just a very small length.) How can I get the desired image while still using the Metropolis theme?
Thanks in advance!
Best Answer
The compile log shows PGFPlots
Even though you have
\pgfplotsset{compat=1.18}
. The 1.9 level is hardcoded in themetropolis
theme.PGFPlots introduced
axis cs:
as the default coordinate system in version 1.11. One way is to keep using version 1.9 and give the coordinate system explicitly like this:an other probably better way is to move
\pgfplotsset{compat=1.18}
inside\begin{document}
like this:-or you could edit line 913 in the theme to correct the version.