1

One can see in page 353 "Manual for Package pgfplots Version 1.16" the below code. I run it, however, I have an error

! Dimension too large.
<recently read> \pgf@xx 
 l.28 \end{loglogaxis}

When \draw command is Inactive, it worked! Dear friends, where is the problem?

\documentclass{article}
\usepackage{‎amsmath}‎
‎‎\usepackage{tikz}‎‎
\usepackage{pgfplots}‎
‎
‎\usepackage{graphicx}‎‎
‎
%\usepackage{pgfplotstable}

\begin{document}
‎%‎\begin{figure}
‎%‎\pgfplotsset{compat=1.‎16‎}
\begin{tikzpicture}
\begin{loglogaxis}‎‎[title=Convergence Plot, xlabel={Degrees of freedom}, ylabel={$L_2$ Error},legend entries={$d=2$,$d=3$}‎,‎grid=‎major‎,‎]‎‎
‎
‎‎\draw (1793,4.442e-05) ‎|-‎ (4097,1.207e-05) node [near start,left] {$‎‎\frac{dy}{dx} =‎ ‎-1.58‎$}‎;‎
‎‎\addplot coordinates {
(5, 8.312e-02)
(17, 2.547e-02)
(49, 7.407e-03)
(129, 2.102e-03)
(321, 5.874e-04)
(769, 1.623e-04)
(1793, 4.442e-05)
(4097, 1.207e-05)
(9217, 3.261e-06‎)‎
‎ }‎;‎
\end{loglogaxis}
\end{tikzpicture}
%\caption{...}
‎%‎\end{figure}
\end{‎document}‎
  • If you include the \pgfplotsset{compat=1.16} command again, it works. Not sure why it does not otherwise. – Psirus May 2 at 8:12
  • Sorry, it doesn't work again – user108438 May 2 at 8:55
  • 2
    I noticed that there are a lot of U+200E symbols in your code which might be the root cause of your problem. Removing them and -- as Psirus already mentioned in his comment -- uncommenting \pgfplotsset{compat=1.16} then works as expected. – Stefan Pinnow May 2 at 10:00
  • If you do not immediately understand what @StefanPinnow is saying, paste your code e.g. here to see where these characters are. – user121799 May 2 at 10:31
  • The issue why you need to set a not too old compatibility mode is the draw command. if you use \draw (axis cs:1793,4.442e-05) |- (axis cs:4097,1.207e-05) node [near start,left] {$\frac{dy}{dx} = -1.58$}; instead it does work with \pgfplotsset{compat=1.16} commented out. This is because from pgfplots version 1.11 on axis cs: it is the default coordinate system but before it was not. – user121799 May 2 at 10:37

Your Answer

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

Browse other questions tagged or ask your own question.