필터 지우기
필터 지우기

saving image using export_fig or saveas, messes up the axis labels

조회 수: 3 (최근 30일)
pemfir
pemfir 2012년 12월 24일
The x axis, labels either gets chopped off in the saved file or mixed up with the x-axis marks. I need to save an image like this, with large axis titles, and marks.
close all;
sizee = 20;
h = figure(1)
line([0 1],[0 1])
g = get(h,'Currentaxes');
set(g,'FontSize',sizee,'FontName','Times');
xlabel('$X_1$','interpreter','latex','FontSize',sizee,'FontName','Times');
ylabel('$X_2$','interpreter','latex','FontSize',sizee,'FontName','Times');
xlim([-pi,pi])
ylim([-pi,pi])
h = figure(1) ;
set(h,'Color',[1.0 1.0 1.0]);
set(h,'units','normalized','outerposition',[0 0 1 1]);
export_fig(h,'test') % you can try either one saveas(h,'test.png')

답변 (1개)

Image Analyst
Image Analyst 2012년 12월 25일
Move the X over with some non-breaking spaces (slash space):
xlabel('\ \ \ \ \ \ \ \ \ $X_1$','interpreter','latex','FontSize',sizee,'FontName','Times');
Use as many as you need to nudge the X over.
Either that or reduce your font size.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by