# How can I scale a TiKZ image created in MATLAB in my Tex File?

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.

-
For future reference, what would have been useful here would have been to see an example .tikz file. Well done for finding the solution yourself and for posting it here for anyone else stuck with this. –  Andrew Stacey Apr 23 '12 at 7:03
add comment

## 1 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' )

-
add comment