plot tick justification error in EPS file
1 回表示 (過去 30 日間)
古いコメントを表示
On a plot, I have replaced x-ticks with text and then rotated them through 90 degrees. When printing to EPS format (top image), the text is centrally justified and crosses the x-axis. When I print to PNG (bottom image), the text is right justified and does not cross the x-axis. Furthermore, the font in the EPS image is incorrect; it should be Garamond but appears to be Courier New. How can I correct these two issues?
0 件のコメント
回答 (1 件)
Kiran Felix Robert
2020 年 11 月 4 日
Hi Benjamin,
This happens because the X axis ticks in the figure are set to 'Auto' and the X axis is rescaled when the figure is resized for exporting.
To avoid this refer the following code snippet to set the X Axis ticks to ‘Manual’
X = 1:5;
Y = X.^2;
f = figure;
plot(X,Y);
ax = gca;
names = {'One';'Two';'Three';'Four';'Five'};
ax.XTick = [1:5]; % Ticks
ax.XTickLabel = names; % Tick Lables
ax.XTickLabelRotation = 90; % Rotation
ax.XTickMode = 'Manual'; % Manual X Ticks Mode
ax.FontName = 'Garamond'; % Font
print(f,'png','-dpng','-opengl')
print(f,'eps','-deps','-opengl')
Kiran Felix Robert
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!