我刚刚发现它tikzexternalize
,我非常喜欢它 - 嗯,差不多。这是我的情况:我在 Matlab 中做过模拟,并使用
matlab2tikz
将 Matlab 中的绘图导入我的.tex
文档。这一直运行良好,直到我遇到错误,因为我的内存不足。然后我发现了外部化的东西。当我终于让它工作时,我的绘图全部顺时针旋转了 90 度。为什么?当我在主文件中进行简单的绘图时,它运行良好,那么为什么它对这些输入文件不起作用?
这是一个 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}
mymatlabfig.tikz
脚本来自哪里matlab2tikz
:
% This file was created by matlab2tikz v0.2.3.
% Copyright (c) 2008--2012, Nico Schlömer <[email protected]>
% All rights reserved.
%
% 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}[%
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}]
\addplot [
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)
};
\addlegendentry{sin x};
\addplot [
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)
};
\addlegendentry{cos x};
\end{axis}
\end{tikzpicture}%
结果是图旋转了。我该如何修复这个问题?