# Plots from externalized TikZ are rotated [closed]

I just found out about tikzexternalize and I love it - well, almost. This is my situation: I have done simulations in Matlab and used matlab2tikz to get the plots from Matlab into my .tex document. This worked fine until I reached the point where I got an error because I ran out of memory. Then I found the externalization stuff. When I finally got it to work, my plots were all rotated 90 degrees clockwise. Why? When I just do a simple plot inside my main file, it works fine, so why does it not work for those input files?

This is an MWE:

\documentclass[a4paper,fontsize=10pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[mode = list and make,optimize=false,
prefix=Bilder/]
\usepackage{pgfplots}
\pgfplotsset{
xlabel=\hspace*{-1.0 ex}\raisebox{-1.5 ex}{$x$},
ylabel=\hspace*{-2.5 ex}\raisebox{-2.5 ex}{$y$}
}

\begin{document}

\begin{figure}
\centering
\input{Bilder/mymatlabfig.tikz}
\end{figure}

\end{document}


where mymatlabfig.tikz comes from the matlab2tikz script:

% This file was created by matlab2tikz v0.2.3.
% Copyright (c) 2008--2012, Nico Schlömer <nico.schloemer@gmail.com>
%
%   http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz
% where you can also make suggestions and rate matlab2tikz.
%
%
%
\begin{tikzpicture}

\begin{axis}[%
view={0}{90},
width=0.5\textwidth,
height=0.394354838709677\textwidth,
scale only axis,
xmin=-4, xmax=4,
ymin=-1, ymax=1,
legend style={align=left}]
color=blue,
solid
]
coordinates{
(-3.14159265358979,-1.22464679914735e-16)(-3.0133643820147,-0.127877161684506)(-2.88513611043961,-0.253654583909507)(-2.75690783886451,-0.375267004879374)(-2.62867956728942,-0.490717552003938)(-2.50045129571433,-0.598110530491216)(-2.37222302413923,-0.695682550603486)(-2.24399475256414,-0.78183148246803)(-2.11576648098904,-0.855142763005346)(-1.98753820941395,-0.914412623015812)(-1.85930993783886,-0.958667853036661)(-1.73108166626376,-0.98718178341445)(-1.60285339468867,-0.999486216200688)(-1.47462512311358,-0.995379112949198)(-1.34639685153848,-0.974927912181824)(-1.21816857996339,-0.93846842204976)(-1.0899403083883,-0.886599306373)(-0.961712036813202,-0.820172254596956)(-0.833483765238108,-0.740277997075315)(-0.705255493663015,-0.648228395307789)(-0.577027222087921,-0.545534901210549)(-0.448798950512828,-0.433883739117558)(-0.320570678937734,-0.315108218023621)(-0.192342407362641,-0.191158628701372)(-0.064114135787547,-0.0640702199807131)(0.064114135787547,0.0640702199807131)(0.192342407362641,0.
191158628701372)(0.320570678937734,0.315108218023621)(0.448798950512828,0.433883739117558)(0.577027222087921,0.545534901210549)(0.705255493663015,0.648228395307788)(0.833483765238108,0.740277997075315)(0.961712036813202,0.820172254596956)(1.0899403083883,0.886599306373)(1.21816857996339,0.938468422049761)(1.34639685153848,0.974927912181824)(1.47462512311358,0.995379112949198)(1.60285339468867,0.999486216200688)(1.73108166626376,0.98718178341445)(1.85930993783886,0.958667853036661)(1.98753820941395,0.914412623015812)(2.11576648098904,0.855142763005346)(2.24399475256414,0.78183148246803)(2.37222302413923,0.695682550603487)(2.50045129571432,0.598110530491217)(2.62867956728942,0.490717552003938)(2.75690783886451,0.375267004879374)(2.88513611043961,0.253654583909507)(3.0133643820147,0.127877161684506)(3.14159265358979,1.22464679914735e-16)
};

color=green!50!black,
solid
]
coordinates{
(-3.14159265358979,-1)(-3.0133643820147,-0.991790013823246)(-2.88513611043961,-0.967294863039029)(-2.75690783886451,-0.926916757346022)(-2.62867956728942,-0.871318704123389)(-2.50045129571433,-0.801413621867957)(-2.37222302413923,-0.718349350097727)(-2.24399475256414,-0.623489801858733)(-2.11576648098904,-0.518392568310525)(-1.98753820941395,-0.404783343122394)(-1.85930993783886,-0.284527586631032)(-1.73108166626376,-0.159599895033379)(-1.60285339468867,-0.0320515775716552)(-1.47462512311358,0.0960230259076819)(-1.34639685153848,0.222520933956314)(-1.21816857996339,0.345365054421308)(-1.0899403083883,0.462538290240835)(-0.961712036813202,0.57211666012217)(-0.833483765238108,0.672300890261317)(-0.705255493663015,0.761445958369134)(-0.577027222087921,0.838088104891841)(-0.448798950512828,0.900968867902419)(-0.320570678937734,0.949055747010669)(-0.192342407362641,0.981559156991065)(-0.064114135787547,0.997945392750336)(0.064114135787547,0.997945392750336)(0.192342407362641,0.981559156991065)(0.320570678937734,
0.949055747010669)(0.448798950512828,0.900968867902419)(0.577027222087921,0.838088104891841)(0.705255493663015,0.761445958369135)(0.833483765238108,0.672300890261317)(0.961712036813202,0.57211666012217)(1.0899403083883,0.462538290240835)(1.21816857996339,0.345365054421307)(1.34639685153848,0.222520933956314)(1.47462512311358,0.0960230259076814)(1.60285339468867,-0.032051577571655)(1.73108166626376,-0.159599895033379)(1.85930993783886,-0.284527586631032)(1.98753820941395,-0.404783343122394)(2.11576648098904,-0.518392568310525)(2.24399475256414,-0.623489801858733)(2.37222302413923,-0.718349350097727)(2.50045129571432,-0.801413621867956)(2.62867956728942,-0.871318704123389)(2.75690783886451,-0.926916757346022)(2.88513611043961,-0.967294863039029)(3.0133643820147,-0.991790013823246)(3.14159265358979,-1)
};

\end{axis}
\end{tikzpicture}%


The result is a rotated plot. How can I fix this?

-

## closed as too localized by Qrrbrbirlbel, Thorsten, Martin Schröder, doncherry, Claudio FiandrinoOct 24 '12 at 7:12

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.

Welcome to TeX.sx! Why list and make? Without it, it compiles perfectly (x to the right, y going up). –  Qrrbrbirlbel Oct 12 '12 at 16:43
@Qrrbrbirlbel, thanks for the suggestion, but it does not work. I used "list and make" to have references, but leaving it out does not result in a correct plot, either. There is a greater issue somewhere... By the way, the x and y are placed correctly, but the plot is wrong, it is supposed to be a sine and a cosine... –  schnupsi Oct 15 '12 at 7:43
I do not know about list and make to use it successfully. In my list and make-less compilation it looks like sine and cosine, though. –  Qrrbrbirlbel Oct 15 '12 at 11:20
OK, you're right - I forgot to delete the file... So now I can have correct plots, but no references? When I add a label to the figure and use \ref I get an error and no reference. With list and make referencing works, but the plots are wrong. Why? –  schnupsi Oct 15 '12 at 12:53
In fact, without "list and make" I always get an error (even without labels and \ref) complaining about a missing -shell-escape option, but I used it... –  schnupsi Oct 15 '12 at 13:02