# “Dimension too large” error with pgfplot generated with matlab2tikz [closed]

I would like to insert a tikz plot generated with matlab2tikz in my code.

This is the code to generate the matlab image

X1=[7.4632    8.0349    8.5251    8.8176    9.2251    9.5559    9.9214   10.1924   10.4235   11.0197   12.0898   13.0078   13.9837];
X2=[5.7940    7.0416    8.2893    9.0191    9.5370    9.9386   10.2668   10.5443   10.7846   11.1863   11.7919   12.4340   13.1638];
Y1=[0.025    0.0500    0.1000    0.1500    0.2000    0.2500    0.3000    0.3500    0.4000    0.5000    0.7000    1.0000    1.5000];
figure1 = figure;

axes1 = axes('Parent',figure1);
box(axes1,'on');
grid(axes1,'on');
hold(axes1,'all');

% Create plot
plot(X1,Y1,'Parent',axes1,'LineWidth',2,'Color',[0 0 1],...
'DisplayName','Experimental profile');

% Create xlabel
xlabel('Mean wind speed [m/s]','FontSize',12);

% Create ylabel
ylabel('height above the ground [m]','FontSize',12);

% Create plot
plot(X2,Y1,'Parent',axes1,'LineStyle','--','Color',[0 0 1],...
'DisplayName','Log profile z_0= 0.001');

% Create legend
legend1 = legend(axes1,'show');
set(legend1,...
'Position',[0.228476914414414 0.766652157055919 0.396513030888031 0.094037760105238],...
'FontSize',12);


The generated tikz code is

\begin{tikzpicture}

\begin{axis}[%
width=0.00358392700912386in,
height=0.00486727016265824in,
scale only axis,
xmin=5,
xmax=14,
xlabel={Mean wind speed [m/s]},
xmajorgrids,
ymin=0,
ymax=1.5,
ylabel={height above the ground [m]},
ymajorgrids,
legend style={at={(0.228476914414414,0.766652157055919)},anchor=south     west,draw=black,fill=white,legend cell align=left}
]
table[row sep=crcr]{7.46324069270281    0.025\\
8.03494715464159    0.05\\
8.5251477423859 0.1\\
8.81756139289803    0.15\\
9.22514701029531    0.2\\
9.55588642181522    0.25\\
9.92139059174763    0.3\\
10.1923874711796    0.35\\
10.4235048516839    0.4\\
11.0197367245308    0.5\\
12.0898028668318    0.7\\
13.0078093923308    1\\
13.9837144687306    1.5\\
};

table[row sep=crcr]{5.79397648476276    0.025\\
7.04164140977066    0.05\\
8.28930633477856    0.1\\
9.01914352937326    0.15\\
9.53697125978646    0.2\\
9.93862965215204    0.25\\
10.2668084543812    0.3\\
10.5442796780702    0.35\\
10.7846361847944    0.4\\
11.1862945771599    0.5\\
11.7919446030781    0.7\\
12.4339595021678    1\\
13.1637966967625    1.5\\
};
\addlegendentry{$\text{Log profile z}_\text{0}\text{= 0.001}$};

\end{axis}
\end{tikzpicture}


I read the answers to many similar post both here and all around the web, but the problems seams to be different time to time. I updated all my packages few hours ago to see if a newer version of pgf plot could solve. I use the latest version of matlab2tikz too.

Do you have any hints for me?

Thank you very much Bye

## closed as off-topic by Torbjørn T., Jesse, Ian Thompson, user31729, percusseJun 7 '14 at 12:33

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• 0.00358392700912386 inches are not that much right? Try 5cm or something like this for width and height. – bonanza May 22 '14 at 10:45
• Thank you. There is an error in the matlab2tikz script that, if the dimension of the figure is expressed as ratio of the screen size, it converts it in inch giving these small numbers. I'm gonna report this to the developer. Thank you very much for your help, not having too much experience with tikz I didn't see that error. Thank you very much. – Luca Amerio May 22 '14 at 11:21
• This question appears to be off-topic because it is about a bug in matlab2tikz, which creates bad pgfplots code. – Torbjørn T. Jun 7 '14 at 12:13