4

When exporting a box plot with matlab2tikz I get no errors, but when running pdflatex I get a "dimension too large" error. This only happens with box plots. Still the box plot shows up as it should, except only x labels ('A' , 'B' etc) are missing.

Plots in Matlab are generated by

matlab2tikz( 'myfile.tex', 'height', '\figureheight', 'width', '\figurewidth' );

Plots in LaTeX are generated by

\newlength\figureheight 
\newlength\figurewidth 
\setlength\figureheight{5cm} 
\setlength\figurewidth{5cm}
\input{myfile.tex}

Any ideas?

Here is the content of myfile.tex

\begin{tikzpicture}
\begin{axis}[%
width=\figurewidth,
height=\figureheight,
unbounded coords=jump,
clip=false,
scale only axis,
xmin=0.5,
xmax=1.5,
xtick={\empty},
ymin=-0.906787341211142,
ymax=1.91353502249058
]
\addplot [
color=black,
dashed,
forget plot
]
table[row sep=crcr]{
1 1.22705846866506\\
1 1.78533855141323\\
};
\addplot [
color=black,
dashed,
forget plot
]
table[row sep=crcr]{
1 -0.778590870133791\\
1 -0.1615124881432\\
};
\addplot [
color=black,
solid,
forget plot
]
table[row sep=crcr]{
0.9625 1.78533855141323\\
1.0375 1.78533855141323\\
};
\addplot [
color=black,
solid,
forget plot
]
table[row sep=crcr]{
0.9625 -0.778590870133791\\
1.0375 -0.778590870133791\\
};
\addplot [
color=blue,
solid,
forget plot
]
table[row sep=crcr]{
0.925 -0.1615124881432\\
0.925 1.22705846866506\\
1.075 1.22705846866506\\
1.075 -0.1615124881432\\
0.925 -0.1615124881432\\
};
\addplot [
color=red,
solid,
forget plot
]
table[row sep=crcr]{
0.925 0.232038283285484\\
1.075 0.232038283285484\\
};
\node[above, inner sep=0mm, text=black]
at (axis cs:216.829133858268, -13.9889763779528, 0) {1};
\end{axis}
\end{tikzpicture}%
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
  • 1
    Could you edit your question to include the code generated by matlab2tikz? – Jake Jun 24 '13 at 13:39
  • 4
    The problem is that final \node command: Your axis only goes from x=0.5 to 1.5, but the node is positioned at x=216.8, which is waaaay over to the right. Where is the node supposed to go? Also, maybe you're better served with using the boxplot functionality that's been introduced in PGFPlots recently (see Boxplots in LaTeX) – Jake Jun 24 '13 at 14:00
  • Take also a look if the error still persists once you have solved the problem raised by @Jake to the number of digits after the coma for your y-axis. I remember to have already crossed such a problem with the pgfplots package. See this answer for more details. – Ludovic C. Jun 24 '13 at 14:19
  • exactly @LudovicC. it´s definitely useful to limit the number of digits after the comma in gnuplot via set format "% .5f", as for example you might get pseudo-zero values like 1e-14 which pgf cannot handle – escalator Dec 15 '13 at 20:26

1 Answers1

5

The problem is that final \node command: Your axis only goes from x=0.5 to 1.5, but the node is positioned at x=216.8, which is waaaay over to the right. Also, maybe you're better served with using the boxplot functionality that's been introduced in PGFPlots recently (see Boxplots in LaTeX)

Jake
  • 232,450