Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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')

Risposte (1)

Image Analyst
Image Analyst il 25 Dic 2012
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.

Categorie

Scopri di più su Printing and Saving in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by