フィルターのクリア

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 Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by