graph - fix annotation so that they dont move when converted to .tif/.eps/.pdf
이전 댓글 표시
Hi,
maybe someone can halp me out with my problem: I want to generate a plot in Matlab with the code below and then convert it to .tif/.eps/.pdf - format (via "export" or "save as . . ." ). However when converting the format the positions of the annotations change (same happens when the plot editor is started).
Is there any command to fix the relative position annotations or to avoid the scaling of the graph when converted to .tif/.eps/.pdf - format?
cheers Patrick
%M-File to create PLOT_.xls
del= [30,100,200,300,400,500,570];
y_I= [60, 60,60,60,60,60,60];
y_II=[60.94, 63.048,65.860,68.464,70.880,73.129,74.613];
%Definition der Achsenabstände und Längen
x0 = 0;
xe = 600;
xint = 4;
y0 = 55;
ye = 75;
yint = 4;
figure ('color','w','un','pix','pos',[360 150 500 390], 'PaperPositionM','auto','Invert','off','rend','Painters');
axes('un','pix','pos',[100,90,350,260],...
'box','on',...
'LineWidth',2,...
'FontName','times',...
'FontSize',22,...
'ylim',[y0 ye],...
'YTick', y0:(ye-y0)/yint:ye,...
'xlim',[x0 xe],...
'XTick', x0:(xe-x0)/xint:xe);
hold on
plot(del, y_I, 'b', 'LineWidth', 4)
plot(del, y_II, 'r', 'LineWidth', 4)
% Create arrow: x-Achsenpfeil
annotation('arrow',[0.76 0.84],[0.043 0.043]);
% Create arrow: y-Achsenpfeil
annotation('arrow',[0.045 0.045],[0.86 0.94]);
% Create textbox: Einheiten Beschriftung an der
% x-Achse%'HorizontalAlignment','center',...
annotation('textbox',[0.79 0.105 0.05 0.1],...
'String',{'x'},...
'FontSize',22,...
'FontName','times',...
'LineStyle','none');
% Create textbox: Einheiten Beschriftung an der y-Achse %
% 'HorizontalAlignment','center',...
annotation('textbox',[0.118 0.79 0.05 0.1],'String',{'%'},...
'FontSize',22,...
'FontName','times',...
'LineStyle','none');
xlabel('labelx \Delta x','FontName','times','FontSize',25);
ylabel('labely \eta_{y}','FontName','times','FontSize',25);
hold off
print(gcf, '-dpdf', '-r150','-painters', '-loose', 'figure.pdf')
댓글 수: 1
Oleg Komarov
2011년 8월 4일
Can you format the code please: http://www.mathworks.com/matlabcentral/answers/7885-tutorial-how-to-format-your-question
채택된 답변
추가 답변 (1개)
Patrick
2011년 8월 4일
0 개 추천
댓글 수: 6
Oleg Komarov
2011년 8월 4일
Yes, but you didn't explicitly declare the dimensions of both figure and axes as I wrote on my example.
Patrick
2011년 8월 4일
Oleg Komarov
2011년 8월 4일
So, you just have to reposition your annotations in the new layout (which I didn't do for you) but when you print the figure is the same as in Matlab, isn't it?
Patrick
2011년 8월 4일
Oleg Komarov
2011년 8월 4일
Try then to use export_fig. I put the link in my edited answer.
Patrick
2011년 8월 4일
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!