latex TickLabelInterpreter in Matlab 2011b
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I am trying to prepare some figures in Matlab for my Latex document. One part is done correctly with
set(0,'DefaultTextFontname', 'CMU Serif');
set(0,'DefaultAxesFontName', 'CMU Serif');
set(0,'defaulttextinterpreter','latex');
however, I can not have tick labels with the same font. I have tried with
set(ax,'TickLabelInterpreter', 'latex');
but I got error
Error using hg.axes/set The name 'TickLabelInterpreter' is not an accessible property for an instance of class 'axes'.
Then I tried with
F = getframe(gca);
set(gca, 'FontName', 'CMU Serif')
and then it is OK in Matlab, but exported eps. file with
saveas(gcf, name,'epsc');
in Latex does not have CMU Serif font on tick labels. However, legend and axis labels have.
Any suggestion? I use Matlab 2011b and obtained figures are attched.
Thanks in advance.
댓글 수: 0
답변 (2개)
Julio Perez Olvera
2020년 5월 2일
I have the same issue, any ideas why? See the MWE:
set(0,'DefaultTextFontName','Garamond',...
'DefaultTextFontWeight', 'normal', ...
'DefaultTextFontSize',13.5,...
'DefaultAxesFontName','Garamond',...
'DefaultAxesFontWeight', 'normal', ...
'DefaultAxesFontSize',12,...
'DefaultLineLineWidth',1.2,...
'DefaultLegendFontSize',11.5,...
'DefaultLegendFontSizeMode','manual',...
'DefaultLineMarkerSize',8.5,...
'defaulttextinterpreter','latex')
set(0,'DefaultFigureRenderer','opengl');
x=[10:2:1000];
y=[10:2:1000];
n=figure('Units','centimeters',...
'Position',[0 0 width height],...
'PaperPositionMode','auto');
scatter(x,y,10,'filled','^','k')
grid on
ax = gca;
ax.XTick = [0:200:1000];
ax.XTickLabel=({'0','200','400','600','800','1000'});
ax.YTick = [0:200:1000];
ax.YTickLabel=({'0','200','400','600','800','1000'});
txt2 = '234';
text(600,600,'Something','HorizontalAlignment','right','Interpreter','Latex')
ylabel('metres')
xlabel('metres')
title('Test');
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
ax.Position = [left bottom ax_width ax_height];
print('-dpng','-r500','Name.png')
print('-depsc2','-r500','Name.eps')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!