[Tex/LaTex] How to scale a TiKZ image created in MATLAB in the Tex File

MATLABtikz-pgf

I'm currently having trouble scaling TiKZ figures in LaTeX and wondering if anyone can help figure out what was going on, or suggest a smarter way to do things.

I'm currently creating plots in MATLAB 2012a and then saving these as .tikz files using the matlab2tikz package. After I have created the .tikz file (i.e. test.tikz), I use the following code to include it in my TeX document.

\begin{figure}
    \centering
    \newlength\fheight 
    \newlength\fwidth 
    \setlength\fheight{3cm} 
    \setlength\fwidth{3cm}
    \input{test.tikz}
    \caption{testing}
    \label{fig:test}
\end{figure}

Although I am able to include the picture, I can't seem to rescale it. In particular changing the fheight and fwidth from {3cm} to another figure does not seem to make any difference.

I'm also a lost in terms of finding the appropriate documentation for this approach to including figures in TeX files. Should I be checking out pgfplots or tikz? And should I be using the \input command or the \begin{tikzpicture} syntax.

Best Answer

Just found out the answer to my problem :)

I was creating the figures in MATLAB using the code:

matlab2tikz( 'test.tikz')

I should have been creating them using the code:

matlab2tikz( 'test.tikz', 'height', '\fheight', 'width', '\fwidth' )
Related Question