1

I try to include from matlab exported (matlab2tikz) tikz files into latex, but get error messages if i don't use matlab default colors. I don't get the problem?! Thanks you guys in advance

Error:

!Illegal unit of measure (pt inserted) and ! Missing number treated as zero

Latex:

\begin{figure}[!h]
    \centering
        \setlength\fheight{0.7\textwidth}
    \setlength\fwidth{0.9\textwidth}    
    \includegraphics{img/image1.tikz}
    \caption{Blabla}
    \label{fig:blabla}
\end{figure}

TIKZ FILE

% This file was created by matlab2tikz v0.4.7 running on MATLAB 8.1.
% Copyright (c) 2008--2014, Nico Schlömer <nico.schloemer@gmail.com>
% All rights reserved.
% Minimal pgfplots version: 1.3
% 
% The latest updates can be retrieved from
%   http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz
% where you can also make suggestions and rate matlab2tikz.
% 
\begin{tikzpicture}

\begin{axis}[%
width=\fwidth,
height=\fheight,
view={322.5}{30},
scale only axis,
xmin=-0.2,
xmax=1.2,
xmajorgrids,
ymin=-1,
ymax=1,
ymajorgrids,
zmin=-0.1,
zmax=1.5,
zmajorgrids,
axis x line*=bottom,
axis y line*=left,
axis z line*=left
]
\addplot3 [color=blue,solid]
 table[row sep=crcr] {0.001 0.001   0.001\\
};
 \addplot3 [color=white!96!green,solid,line width=2.0pt]
 table[row sep=crcr] {0.479697819765937 -1.66533453693767e-18   -0.00291092455504537\\
0.46967140529907    -1.72084568816899e-17   -0.00304749019655101\\
};
 \addplot3 [color=white!94!green,solid,line width=2.0pt]
 table[row sep=crcr] {0.489715272722715 1.22124532708768e-17    -0.0027807983753805\\
0.479697819765937   -1.66533453693767e-18   -0.00291092455504537\\
};
 \addplot3 [color=white!92!green,solid,line width=2.0pt]
 table[row sep=crcr] {0.49972270061696  1.99840144432529e-17    -0.00265670325886659\\
0.489715272722715   1.22124532708768e-17    -0.0027807983753805\\
};
 \addplot3 [color=white!90!green,solid,line width=2.0pt]
 table[row sep=crcr] {0.509720409510899 2.66453525910038e-17    -0.00253825813233725\\
0.49972270061696    1.99840144432529e-17    -0.00265670325886659\\
};



...etc.




 \addplot3 [color=white!26!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.829795595454906 -0.105304898583202  1.38110200542629\\
0.819887002709082   -0.107828908692529  1.38122697033729\\
};
 \addplot3 [color=white!24!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.839625002204565 -0.102840751537362  1.38096723284625\\
0.829795595454906   -0.105304898583202  1.38110200542629\\
};
 \addplot3 [color=white!22!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.849338403333923 -0.100435918845974  1.38082311765581\\
0.839625002204565   -0.102840751537362  1.38096723284625\\
};
 \addplot3 [color=white!20!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.858894935151754 -0.0980874166907242 1.38067020233289\\
0.849338403333923   -0.100435918845974  1.38082311765581\\
};
 \addplot3 [color=white!18!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.868252379508359 -0.0957923868952757 1.38050895947337\\
0.858894935151754   -0.0980874166907242 1.38067020233289\\
};
 \addplot3 [color=white!16!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.877369369839138 -0.0935501070091226 1.38033968037477\\
0.868252379508359   -0.0957923868952757 1.38050895947337\\
};
 \addplot3 [color=white!1.400000e+01!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.886207753298735 -0.0913610489013081 1.38016252820557\\
0.877369369839138   -0.0935501070091226 1.38033968037477\\
};
 \addplot3 [color=white!12!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.894734885516806 -0.089226416250731  1.37997756748673\\
0.886207753298735   -0.0913610489013081 1.38016252820557\\
};
 \addplot3 [color=white!10!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.902923998583969 -0.0871451464648408 1.37978494412629\\
0.894734885516806   -0.089226416250731  1.37997756748673\\
};
 \addplot3 [color=white!8!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.910755941285036 -0.0851129457921532 1.37958495399157\\
0.902923998583969   -0.0871451464648408 1.37978494412629\\
};
 \addplot3 [color=white!6!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.918222014540111 -0.0831254886403127 1.37937794641879\\
0.910755941285036   -0.0851129457921532 1.37958495399157\\
};
 \addplot3 [color=white!4!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.9253245154501   -0.0811820599220048 1.37916419853541\\
0.918222014540111   -0.0831254886403127 1.37937794641879\\
};
 \addplot3 [color=white!2!red,solid,line width=2.0pt]
 table[row sep=crcr] {0.932071571122559 -0.0792840566576747 1.37894400837872\\
0.9253245154501 -0.0811820599220048 1.37916419853541\\
};
 \addplot3 [color=red,solid,line width=2.0pt]
 table[row sep=crcr] {0.938471567465238 -0.0774304719790548 1.37871788704809\\
0.932071571122559   -0.0792840566576747 1.37894400837872\\
};
 \addplot3 [color=black,line width=4.0pt,mark size=6.5pt,only marks,mark=o,mark options={solid}]
 table[row sep=crcr] {0.938471567465238 -0.0774304719790548 1.37871788704809\\
};
 \addplot3 [color=red,line width=2.0pt,mark size=6.5pt,only marks,mark=o,mark options={solid}]
 table[row sep=crcr] {0.938471567465238 -0.0774304719790548 1.37871788704809\\
};
 \end{axis}
\end{tikzpicture}%
  • 1
    Welcome at tex.sx! Inside of our editor, you can mark code lines and hit 'CTRL-K' to format them as "code example". – Christian Feuersänger May 17 '14 at 18:57
1

There appears to be a mismatch in the number format when providing colors.

The syntax color=white!1.400000e+01!red is unsupported by the xcolor package; it expects fixed point numbers in mixing expressions.

Changing it to color=white!14!red fixes the problem.

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.