You can also make MATLAB generate the .tex
file for you, by using matlab2tikz
, which is "a script to convert MATLAB/Octave into TikZ figures for easy and consistent inclusion into LaTeX" available on https://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
This is very useful if you have to deal with many charts generated by MATLAB. By working with .tex
files, the final products remains consistent if you, for any reason, change the fonts in your document or include your charts in another document. Drawback: if data change, you have to regenerate the MATLAB plot, then the .tex
file, and finally compile the document again.
You don't have worry about the font size and style, as you can see in the following example, where the text font (Palatino) and size has been kept in the chart. Notice that you may still have to fix something or customize the code to obtain what you want. Also, the example I show you dates back to 2012, while the script available online has been updated recently.

% This file was created by matlab2tikz v0.2.1.
% Copyright (c) 2008--2012, Nico Schlömer <nico.schloemer@gmail.com>
% All rights reserved.
%
%
%
\begin{tikzpicture}
\begin{axis}[%
every axis y label/.append style={rotate=-90},
axis lines=middle,
view={0}{90},
width=\figurewidth,
height=1.2\figureheight,
%scale only axis,
xmin=-0, xmax=1,
xlabel={$z_h / b_v$},
xmajorgrids,
y dir=reverse,
ymin=-0.9, ymax=-0.5,
ymajorgrids,
name=plot1,
ylabel={$C_{Y_{\beta_v}} \, (\si{\radian^{-1}})$},
%title={Sideforce derivative},
legend style={at={(0.03,0.90)},anchor=north west,nodes=right}]
\addplot [
color=black,
mark size=3.5pt,
mark=o
]
coordinates{
(0,-0.609244430498508)(0.1,-0.589569218432885)(0.2,-0.575580003823558)(0.3,-0.564720763857404)(0.4,-0.557085538078227)(0.5,-0.555584036143151)(0.6,-0.565871990115845)(0.7,-0.595749175477526)(0.8,-0.653467629096353)(0.9,-0.74440910676988)(1,-0.866688483793922)
};
\addlegendentry{USAF};
\addplot [
color=black,
mark size=3.5pt,
mark=triangle
]
coordinates{
(0,-0.595312937013058)(0.1,-0.594216172156085)(0.2,-0.591285259055598)(0.3,-0.587582342745093)(0.4,-0.584824333687759)(0.5,-0.585302910887511)(0.6,-0.591772526244447)(0.7,-0.607280530796657)(0.8,-0.634798332622844)(0.9,-0.677639499267638)(1,-0.740595972655539)
};
\addlegendentry{ESDU};
\addplot [
color=black,
mark size=3.5pt,
only marks,
mark=square
]
coordinates{
(0,-0.639839932916833)
};
\addlegendentry{USAF body-mounted};
\addplot [
color=black,
mark size=3.5pt,
only marks,
mark=diamond,
]
coordinates{
(0,-0.795654227407493)
};
\addlegendentry{ESDU body-mounted};
\addplot [
color=black,
mark size=3.5pt,
only marks,
mark=*
]
coordinates{
(0.82,-0.668926601130689)
};
\addlegendentry{ATR-42 (USAF)};
\addplot [
color=black,
mark size=3.5pt,
only marks,
mark=triangle*
]
coordinates{
(0.82,-0.642004556024089)
};
\addlegendentry{ATR-42 (ESDU)};
\end{axis}
\begin{axis}[%
every axis y label/.append style={rotate=-90},
axis lines=middle,
view={0}{90},
width=\figurewidth,
height=\figureheight,
%scale only axis,
xmin=-0, xmax=1,
xlabel={$z_h / b_v$},
xmajorgrids,
ymin=0, ymax=30,
ylabel={$\% \, \Delta$},
ymajorgrids,
at=(plot1.below south west), anchor=above north west]
\addplot [
color=black,
solid,
forget plot
]
coordinates{
(-0.0101010101010101,2.00423589528513)(0.0101010101010102,1.98513676330423)(0.0303030303030303,1.37608243346336)(0.0505050505050506,0.758949234476695)(0.0707070707070707,0.133575348526556)(0.0909090909090908,0.500205392814883)(0.111111111111111,0.999235610868496)(0.131313131313131,1.3858185234428)(0.151515151515152,1.77615347435414)(0.171717171717172,2.17029535393037)(0.191919191919192,2.56830012843458)(0.212121212121212,2.88590197672501)(0.232323232323232,3.14968658370057)(0.252525252525253,3.4155021124051)(0.272727272727273,3.68337210808616)(0.292929292929293,3.95332048136197)(0.313131313131313,4.16910846939229)(0.333333333333333,4.35581230060881)(0.353535353535354,4.54354348811356)(0.373737373737374,4.73231053499549)(0.393939393939394,4.92212203843935)(0.414141414141414,5.03145178747091)(0.434343434343434,5.10606561382981)(0.454545454545455,5.18076081445205)(0.474747474747475,5.25553752253107)(0.494949494949495,5.33039587155124)(0.515151515151515,5.230317559302)(0.535353535353535,5.07294027455566)(0.555555555555556,4.91672845994868)(0.575757575757576,4.76166921676807)(0.595959595959596,4.60774983594119)(0.616161616161616,4.13145582830931)(0.636363636363636,3.58489228565705)(0.656565656565657,3.04965030370611)(0.676767676767677,2.52538171487842)(0.696969696969697,2.01175248282245)(0.717171717171717,1.04768027535438)(0.737373737373737,0.0395650146794334)(0.757575757575758,0.931172583550881)(0.777777777777778,1.86657344855685)(0.797979797979798,2.76853257808149)(0.818181818181818,4.09174740288066)(0.838383838383838,5.3941632552252)(0.858585858585859,6.62886598741652)(0.878787878787879,7.80100245416585)(0.898989898989899,8.9152107849498)(0.919191919191919,10.1780395648388)(0.939393939393939,11.3728913566219)(0.95959595959596,12.4955127915158)(0.97979797979798,13.5522613404144)(1,14.5487696555531)
};
% Annotazione differenza percentuale dei piani montati in fusoliera
\node[coordinate,pin=-60:{$\Delta_\textup{body mounted} = 24\%$}]at (axis cs:0,24.3521) {};
\end{axis}
\end{tikzpicture}