2

我想将我的图形包含在 LaTeX 文档中,但有以下问题。

  1. 将数字打印为 EPS 不起作用。图被错误地裁剪。请看下图。

  2. 如何使用句柄在循环中打印多个图形?

我的数据:

str=[...
    '15.12.2012 11:27'
    '15.12.2012 11:12'
    '15.12.2012 10:57'
    '15.12.2012 10:42'
    '14.12.2012 10:27'
    '14.12.2012 10:12'
    '14.12.2012 09:57'
    '14.12.2012 09:42'
    '14.12.2012 09:27'
    '14.12.2012 09:12'
    '14.12.2012 08:57'
    '13.12.2012 08:42'
    '13.12.2012 08:27'
    '13.12.2012 08:12'
    '13.12.2012 07:57'
    '13.12.2012 07:42'
    '13.12.2012 07:27'
    '12.12.2012 07:12'
    '12.12.2012 06:57'
    '12.12.2012 06:42'
    '12.12.2012 06:27'
    '12.12.2012 06:12'
    '11.12.2012 05:57'
    '11.12.2012 05:42'
    '10.12.2012 05:27'
    '10.12.2012 05:12'
    '10.12.2012 04:57'];

Col1=[...
0.9884753
1.670642
1.14455
1.0301446
0.99031037
1.0459388
0.97192177
0.8925
0.8985693
0.955
0.95103529
0.95203444
0.955
0.95970876
0.95929422
0.95578656
0.955
0.955
0.95342687
0.955
0.955
0.95930485
0.95530825
0.96452381
0.9675
0.98778061
1.3];
Col2=rand(27,1).*(Col1);
Col3=Col1+Col2;
% find first occurrence of dates
[y,m,d,h,mn] = datevec(str,'dd.mm.yyyy HH:MM');

dn = datenum(y,m,d);
[~,ind] = unique(dn,'first');
ind = sort(ind);
% plot it nicely
plot(Col1);
hold all
plot(Col2);
hold all
plot(Col3);
leg_h=legend('bus','Car', 'truck','Location','NorthEastOutside');
set(leg_h,'Interpreter','latex','fontsize',14)
xlabel('time $t$','Interpreter','latex','fontsize',12);
ylabel('speed $m$','Interpreter','latex','fontsize',12);
ax = gca;
dstr = cellstr(datestr(dn,'dd.mm.yyyy'));
set(ax, 'XTick',ind, 'XTickLabel',dstr(ind), 'Position',[0.1,0.15,0.8,0.75]);
ylim([-20 20]); 


% plot something...
print -deps epsFig

乳胶代码:

\begin{figure}
\centering
\includegraphics[width=0.9\textwidth, angle=0]{epsFig.eps}
\caption{Insert caption}
\end{figure}

在此处输入图像描述

4

1 回答 1

4
  1. 试试datetick。使用“keepticks”,我发现它对于日期时间图的效果要好得多。无论如何,这是 Matlab 方面,而不是 Latex 方面。
  2. 我已经开始使用export_fig并取得了巨大的成功。
  3. 创建一个图(不知道为什么代码部分不起作用)

    句柄=图;

    ..生成情节..

    export_fig(句柄,....)

于 2012-12-18T21:15:37.743 回答