Skip to content

pgfplotsthemetol puts \pgfplotsset{compat=1.9} at end of preamble, overriding other settings #397

@jasperhabicht

Description

@jasperhabicht

The metropolis theme loads the pgfplotsthemetol package which essentially sets \AtEndPreamble{ \pgfplotsset{compat=1.9} } and thereby overrides other settings of the PGF key compat.

The problem is that compat=1.9 is relatively old and therefore some functions are not activated such as using axis coordinates inside the axis environment when using standard TikZ commands such as \draw or \fill without the need to prexis the coordinates with axis cs:.

A solution to this is to set \AtEndPreamble{ \pgfplotsset{compat=1.18} } instead of \pgfplotsset{compat=1.18} in the preamble, but it is not obvious to the user why they should do that.

Consider the following MWE:

\documentclass{beamer}
\usetheme{metropolis}

\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

%\AtEndPreamble{
%    \pgfplotsset{compat=1.18}
%}

\begin{document}
    \begin{frame}
        \begin{tikzpicture}
            \begin{axis}
                \addplot coordinates {(0,0) (1,1)};
                \fill[red] (0.5,0.5) circle[radius=2pt];
            \end{axis}
        \end{tikzpicture}
    \end{frame}
\end{document}

Uncommenting %\AtEndPreamble{ \pgfplotsset{compat=1.18} } fixes the problem and the red circle is placed in the middle of the plot instead of somewhere at the origin.

A simple solution would be to just avoid setting compat via the pgfplotsthemetol package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions