Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using matlab2tikz to plot some matlab graphs, turn those to pdf using the standalone document format, and combine them side by side in a latex document. Whenever I predefine fill color with

\definecolor{mycolor1}{rgb}{0.5625,1,0.4375}

the whole plot gets shifted to the right (like this). If I in turn comment the line everything works just fine. Note that I didn't even use the specified mycolor1 in addplot properties, instead I used fill=yellow. The code is, apart from the color definition, in both cases exactly the same.

Any ideas what might be causing this?

Minimal working example:

bucket.tex

\definecolor{mycolor1}{rgb}{0.5625,1,0.4375}
\begin{tikzpicture}
% Axis at [0.13 0.11 0.78 0.81]
\begin{axis}[%
view={0}{90},
width=10cm,
height=10cm,
scale only axis,
xmin=-5, xmax=-1,
ymin=-5, ymax=-1,
hide x axis,
hide y axis]

\addplot [fill=yellow,draw=black,forget plot] coordinates{ (-5,-0.99999897405059)(-3.00088134424625,-1.02)(-4.24,-4.89040515321358)(-5,-0.99999897405059)};

\addplot [fill=yellow,draw=black,forget plot] coordinates{ (-1,-3.00099999987623)    (-1.72,-5.00000063103793)(-2.08,-3.87877006628044)(-1,-3.00099999987623)};
\end{axis}
\end{tikzpicture}%

test.tex

\documentclass[]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\input{bucket.tex}
\end{document}

this produces the erroneous file mentioned above, commenting \definecolor produces the correct result.

share|improve this question
1  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. Is it also the same if you move your definitions in the preamble (before \begin{document}) and also are you using preview package or standalone class? – percusse Oct 15 '12 at 9:38
I feel stupid now. When I moved the definition as you suggested (out of bucket.tex and before \begin{document}) everything solved itself. Thanks for the help! – vuce Oct 15 '12 at 10:12
Might be a little frustrating having to do this on tens of such files, but it works. – vuce Oct 15 '12 at 10:37

closed as too localized by lockstep, Stefan Kottwitz Oct 15 '12 at 10:28

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, see the FAQ.

Browse other questions tagged or ask your own question.