Question

I am preparing some plots with MATLAB. I want them all to have the same appearance (fonts, fontsize, X Label, etc), in particular I want the X label and the Y label to be at the same position for each and every plot I do. These I set manually by changing the x and y positions under "More Properties". However, when I save and close the figures and reopen them later for some modifications I find a slight change in the positions of the X and Y labels. The changes are small yet totally undesirable.

Is this a known bug or am I doing something wrong? I have tried this on several computers but I always get the same problem. I am using MATLAB2012b.

Was it helpful?

Solution

Try using things like:

clear all close all

X=rand(10,1); Y=rand(10,1);

figure(1)
plot(X,Y)
title('This is a figure','interpreter','latex','FontSize',30);
whitebg([1,0.89063,0.87891]) % Background
set(gca,'FontSize',21); % Font size
set(gca,'YTick',[0 0.2 0.4 0.6 0.8 1])
set(gca,'XTick',[0 0.2 0.4 0.6 0.8 1])
set(gca,'XColor',[0.38,0.10,0.10]) %Color of the axis X
set(gca,'YColor',[0.38,0.10,0.10]) %Color of the axis Y
xlabel('x','interpreter','latex','FontSize',30); % Using for instance latex fonts
ylabel('y','interpreter','latex','FontSize',30);
set(gca,'LineWidth',3)

and save them in the final file such as pdf, eps jpeg... I guess this can solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top