Matlab plot .eps file position legend is not same as in matlab plot
3 ビュー (過去 30 日間)
表示 古いコメント
Hello,
I want to save my plot as a .eps file. But when I open then the .eps file the legend is always inside the plot and not
in the right upper corner as in the real plot. See the picutres. How can I change that also in the .eps file the legend
is in the right upper corner?
Matlab plot:

.eps file:

Code:
M1 = readmatrix('1111');
M2 = readmatrix('2222');
M3 = readmatrix('3333');
M4 = readmatrix('4444');
M2(:,1) = M2(:,1) + M1(end,1) + 4;
M3(:,1) = M3(:,1) + M2(end,1) + 4;
M4(:,1) = M4(:,1) + M3(end,1) + 4;
M = [M1; M2; M3; M4];
% plot force data
subplot(2,1,1)
plot(M(:,1)/1000,M(:,2),'color',' [0, 0.4470, 0.7410]')
hold on
plot(M(:,1)/1000,M(:,3))
hold on
plot(M(:,1)/1000,M(:,4))
hold on
legend('Fx','Fy','Fz', 'Location', 'northeast')
grid on
h_xlabel = xlabel ({ '$t$\,/\,s'});
set(h_xlabel,'Interpreter','latex');
h_ylabel = ylabel ({'$F$\,/\,N'});
set(h_ylabel,'Interpreter',' latex');
% plot torque data
subplot(2,1,2)
plot(M(:,1)/1000,M(:,5),'color',' [0, 0.4470, 0.7410]')
hold on
plot(M(:,1)/1000,M(:,6))
plot(M(:,1)/1000,M(:,7))
legend('Mx','My','Mz', 'Location', 'northeast')
grid on
h_xlabel = xlabel ({ '$t$\,/\,s'});
set(h_xlabel,'Interpreter','latex');
h_ylabel = ylabel ({'$M$\,/\,Nmm'});
set(h_ylabel,'Interpreter',' latex');
grid on
h_xlabel = xlabel ({ '$t$\,/\,s'});
set(h_xlabel,'Interpreter','latex');
h_ylabel = ylabel ({'$s$\,/\,mm'});
set(h_ylabel,'Interpreter',' latex');
set(gcf,'units','centimeters');
set(gca,'FontSize',10,'FontName','Times');
print("title",'-depsc2');
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!