plot tick justification error in EPS file
10 次查看(过去 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 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!