3

I use this command in matlab

matlab2tikz('fig_blank.tex','width','\textwidth','height','5cm')

in order to make a tikzpicture out of this matlab plot. My MWE in PdfLaTeX

\documentclass{article}
\usepackage{lipsum}
\usepackage{pgfplots}

\begin{document}
\lipsum[1]
\begin{figure}[h!]
\input{fig_blank.tex}
\end{figure}
\lipsum[2]
\end{document}

The result looks like thisenter image description here

The figure stretches into the right margin... Seems like Matlab2tikz does not count enough space for the tick labels on the left so the figure is too wide. Why is that? I know about workaround like

\resizebox{\textwidth}{!}{\input{fig_blank.tex}}

but I rather look for a clean solution. There must be, no? Because this is the whole point of using Matlab2Tikz to have flush and nicely fitted figures.

Any help appreciated, thanks a lot!

PS: Matlab2Tikz and PgfPlots are up to date.

closed as unclear what you're asking by Torbjørn T., Martin Schröder, Zarko, moewe, Mico Nov 20 '16 at 15:01

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Anyone a clue? =) – Erisch889 Jul 12 '16 at 8:24
  • 2
    The link you give to the matlab tikz code is now dead, which may make it difficult for anyone to provide further assistance with this question. – Dai Bowen Sep 11 '16 at 20:28
  • 1
    Check if you have scale only axis in the axis options in fig_blank.tex. – Torbjørn T. Nov 20 '16 at 13:54

Browse other questions tagged or ask your own question.