1

I want to draw some dependence in function of years. The real functionality uses \addplot table and works fine. However, when I want to draw some simple objects over it (just uncomment some of the lines) I receive a "Dimension too large" error. What do I wrong?

\documentclass[article]{standalone}               
\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}
[
xmin=1993, xmax=2020,% x scale
ymin=1e2, ymax=1e8, % y scale
xlabel=Year,
/pgf/number format/1000 sep={},
ylabel=$Gain$,
ymode=log,
]

%   \draw[thin,gray] (1993,1e3) -- (2011,1e7);
%   \draw[thin,gray] (2010,1e7) -- (2018,1e7);
%   \draw[thick,red] (2014,3e6) circle(1.5cm);
\end{axis}
\end{tikzpicture}
\end{document}
0

You can either switch to a reasonably new compatibility (recommended) or work with axis cs:.

\documentclass[article]{standalone}               
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
\begin{tikzpicture}
\begin{axis}
[
xmin=1993, xmax=2020,% x scale
ymin=1e2, ymax=1e8, % y scale
xlabel=Year,
/pgf/number format/1000 sep={},
ylabel=$Gain$,
ymode=log,
]

  \draw[thin,gray] (1993,1e3) -- (2011,1e7);
  \draw[thin,gray] (2010,1e7) -- (2018,1e7);
  \draw[thick,red] (2014,3e6) circle(1.5cm);
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

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.