필터 지우기
필터 지우기

How can i export figure with all bold axes saved?

조회 수: 1 (최근 30일)
Simple Life
Simple Life 2021년 6월 1일
댓글: Simple Life 2021년 6월 2일
when i using following code, ploting is okay, and not all bold axes saved?
I am using R2019a
clc;clear all;close all;
% define size of picture
f=figure;
f.Units='centimeters';
ax=gca;
ax.LineWidth=1.5;
ax.FontSize = 10;
set(gca,'box','on')
set(gca, 'FontName', 'Times New Roman');
set(gcf,'Position',[5 10 7 7*0.618])
hold on
% data and plot
datax=linspace(0,2,2000000);
freq=1;
w=2*pi*freq;
datay=0.1*sin(w*datax);
plot(datax,datay,'-k',...
'LineWidth',1.2,...
'MarkerSize',10,...
'MarkerEdgeColor','b',...
'MarkerFaceColor',[0.5,0.5,0.5])
% label and legend
xlabel('\fontname{Times New Roman}Distance, mm')
ylabel('\fontname{Times New Roman}Amplitude, mm')
legend(['\fontname{Times New Roman}freq=',num2str(freq)],'Location','northeast');
%xlim([min(datax)-0.02*(max(datax)-min(datax)),max(datax)+0.02*(max(datax)-min(datax))]);
limfactor=0.2;
xlim([min(datax),max(datax)]);
ylim([min(datay)-limfactor*(max(datay)-min(datay)),max(datay)+limfactor*(max(datay)-min(datay))]);
% no margin or small margin
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
ax.Position = [left bottom ax_width ax_height];
% output picture now
%saveas(gcf,'C:\Users\admin\Desktop\p.emf')
saveas(gcf,'C:\Users\admin\Desktop\p.jpg')

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 1일
Hi,
Here is a simple answer:
...
exportgraphics(gcf,'p.png','Resolution',600)
  댓글 수: 1
Simple Life
Simple Life 2021년 6월 2일
Thanks for your answer. It does't work at R2019a. Is there any way I can use exportgraphics at R2019a?

댓글을 달려면 로그인하십시오.

카테고리

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