当我尝试将一个3D图形(实际上只有这个图形)在Matlab中以.eps格式打印时,它并没有提供矢量图形,而是提供了一个栅格化的图像作为输出。
这个问题只出现在这个特定的图形中,其他图形都很好(如预期所示)。
这个问题在2014b、2015a和2016b中都有复制,因为这些是唯一可用的软件版本,我无法测试其他版本。此外,是否有人遇到过这种问题?
这是我第一次遇到这样的问题,因为直到现在我从未在图形打印方面遇到任何问题(包括2D和3D)。
请分享您克服此问题的建议。
这个问题只出现在这个特定的图形中,其他图形都很好(如预期所示)。
这个问题在2014b、2015a和2016b中都有复制,因为这些是唯一可用的软件版本,我无法测试其他版本。此外,是否有人遇到过这种问题?
这是我第一次遇到这样的问题,因为直到现在我从未在图形打印方面遇到任何问题(包括2D和3D)。
请分享您克服此问题的建议。
clc
clear all
close all
warning('off','all')
warning
%% print size def
width = 6; % Width in inches
height = 4.9; % Height in inches
alw = 1; % AxesLineWidth
fsz = 12; % Fontsize
lw = 1.5; % LineWidth
msz = 8; % MarkerSize
set(0,'defaultLineLineWidth',lw); % set the default line width to lw
set(0,'defaultLineMarkerSize',msz); % set the default line marker size to msz
set(0,'defaultLineLineWidth',lw); % set the default line width to lw
set(0,'defaultLineMarkerSize',msz); % set the default line marker size to msz
set(0,'DefaultAxesFontSize',fsz)
% Set the default Size for display
defpos = get(0,'defaultFigurePosition');
set(0,'defaultFigurePosition', [defpos(1) defpos(2) width*100, height*100]);
% Set the defaults for saving/printing to a file
set(0,'defaultFigureInvertHardcopy','on'); % This is the default anyway
set(0,'defaultFigurePaperUnits','inches'); % This is the default anyway
defsize = get(gcf, 'PaperSize');
left = (defsize(1)- width)/2;
bottom = (defsize(2)- height)/2;
defsize = [left, bottom, width, height];
set(0, 'defaultFigurePaperPosition', defsize);
%% loading the data
load('E_fw')
%norm of fw with mass
j=1;
for i=2:1:length(E_m1)
if length(E_m1{i})>1
e_m1{j}=E_m1{i}';
L_m1(j)=length(E_nm1{i});
j=j+1;
end
end
%% plotting m1
t_m1=(0:1:max(L_m1)-1)/8000;
x_m1=1:1:length(L_m1);
for i=1:1:length(L_m1)
B_m1(:,i)=[e_m1{i};ones(max(L_m1)-length(e_m1{i}),1)*inf];
end
[X_ss,Y_ss]=meshgrid(t_m1,x_m1);
g=figure
surf(X_ss,Y_ss,abs(B_m1'), 'LineStyle', 'none', 'FaceColor', 'interp'),grid minor
colormap(flipud(hot))
view([-1, -1, 7])%xaxis from 0 (neg, same for all)
camlight headlight
lighting gouraud
xlabel('op');
ylabel('dop');
zlabel('V');
box on
ax = gca;
ax.LineWidth = lw;
zlim([0 1.6])
xlim([0 0.3])
ylim([1 max(max(abs(Y_ss)))])
set(g,'Units','Inches');
pos = get(g,'Position');
set(g,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3),
pos(4)])
print('map_m1_3d', '-depsc', '-r0');
由于问题仅出现在此特定情况下,我建议您使用链接中提供的数据文件以及此 MWE。该问题也已向 Mathworks 报告。
.mat
,因为我使用一些数据文件来创建图形,在这种特定情况下问题是反复出现的。无论如何,我现在会发布MWE,请指导我如何发布必要的数据文件。 - Raaja_is_at_topanswers.xyzexport_fig
?或者我一直使用的内置saveas
:saveas(g,'outname.eps','epsc')
。虽然我认为MATLAB可能会根据某些启发式方法切换到光栅化,但是我曾经意外地生成过表面图的矢量化150MB eps文件而没有任何问题,所以如果这是情况的话,我会感到惊讶。 - Andras Deak -- Слава Україні-painters
扩展,唯一的缺点是输出文件的大小会呈非线性增长,这明确取决于输出图形的复杂性。 - Raaja_is_at_topanswers.xyz-painters
扩展来覆盖内部开关时,我最终得到的.eps
文件大小约为450 MB,这实际上是非常巨大的,因为它们需要被重复使用于文档目的。 - Raaja_is_at_topanswers.xyz