# Trying to import a tikz figure generated by matplotlib2tikz, getting dimension too large for y-axis [closed]

I'm trying to use a graph exported by matplotlib2tikz, with the following code in it:

\begin{tikzpicture}
\begin{axis}[
ylabel={CF [\%]},
xmin=0.5, xmax=7.5,
ymin=0.096, ymax=0.144,
axis on top,
width=\figurewidth,
height=\figureheight,
legend entries={Without Daytime,With Daytime}
]
\addplot [red, dotted, mark=square*, mark options={draw=black}]
coordinates {
(1,0.133436580942456) (2,0.115673379339152) (3,0.120904949173964) (4,0.131747653060196) (5,0.132274436935023) (6,0.13189650135679) (7,0.131731186551343)
};
\addplot [blue, dotted, mark=diamond*, mark options={draw=black}]
coordinates {
(1,0.109315022898981) (2,0.11263226182201) (3,0.113782540485058) (4,0.107637011084747) (5,0.108459720680927) (6,0.120093612355885) (7,0.120109008832872)
};
\path [draw=black, fill opacity=0] (axis cs:13,1)--(axis cs:13,1);

\path [draw=black, fill opacity=0] (axis cs:1,13)--(axis cs:1,13);

\path [draw=black, fill opacity=0] (axis cs:13,0)--(axis cs:13,0);

\path [draw=black, fill opacity=0] (axis cs:0,13)--(axis cs:0,13);

\end{axis}


In my tex-file I have:

\usepackage{tikz}
\usepackage{tkz-fct}
\usepackage{pgfplots}

\newlength\figureheight
\newlength\figurewidth


and:

\setlength\figurewidth{0.8\textwidth}
\setlength\figureheight{0.625\figurewidth}

\begin{figure}
\centering
\input{.fig1.tikz}
\caption{CAPTION}
\end{figure}


But this gives me: ! Dimension too large. <to be read again> ...

Changing the ymin and ymax to 0 an 1.5 solves it but it doesn't look that good anymore. I know I'm a real newbie when it comes to latex, but I hope someone could help me out.

-

## closed as too localized by Jake, lockstep, Claudio Fiandrino, Torbjørn T., percusseSep 22 '12 at 18:07

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

The error occurs because of the four \path commands, which try to draw lines that lie far outside the plot area. If you delete them, everything works fine. What are they for (they don't produce anything visible in this plot)? –  Jake Sep 21 '12 at 20:15
Thanks, that's wondefull, that just shows sometimes a fresh eye is all it needs. I honestly don't know what the idea of those \path commands is, seems like some editing of the tikz files is almost always necessary when using matplotlib2tikz, but still it gives nice results. Thanks –  BartV Sep 22 '12 at 13:34
Glad the problem's solved! We'll probably close this as "too localized", if you don't mind? –  Jake Sep 22 '12 at 13:47

Use the new pgf backend in matplotlib-1.2.0svn instead of matplotlib2tikz. You need a recent LaTeX installation with LuaTeX or XeTeX.