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!