我有一个用于渲染数据的MATLAB脚本(在这种情况下是许多矩形的时间轴),并且在MATLAB图形查看器中一切正常。但是出于某种原因,当我使用print将文件输出为.eps时,一些黑色(图中的文本和方框)变为紫色。
static = importdata( 'output.out');
static(:,3) = ( static(:,3) - static(:,2) ) * tpms;
start = min( static(:,2) );
static(:,2) = ( static(:,2) - start ) * tpms;
ms_max = max(static(:,2)) - min(static(:,2))
ms_max = ms_max + 0.1 * ms_max;
%ms_max = max(static(:,2)) - min(static(:,2));
static_corner = static( static(:,1)==0 , : );
static_row = static( static(:,1)==1 , : );
static_column = static( static(:,1)==2 , : );
static_split = static( static(:,1) == 3, :);
%static_rest = static( static(:,1)==3 , : );
static_unload = static( static(:,1)==-101 , : );
static_load = static( static(:,1)==-100 , : );
static_ghost = static(static(:,1)==-102,:);
% Init the plot
clf;
subplot('position',[ 0.05 , 0.1 , 0.9 , 0.8 ]);
hold on;
% Plot the selfs in RED
for k=1:size(static_corner,1)
rectangle( 'Position' , [ static_corner(k,2) , static_corner(k,4)+0.5 , static_corner(k,3) , 1 ] , ...
'EdgeColor' , [ 0.8 0 0 ] , 'LineWidth' , 1 , 'FaceColor' , [ 1 0 0 ] );
end
arrays = 0.0;
for k=1:size(static_corner,1)
arrays = arrays + static_corner(k,3);
end
arrays/size(static_corner,1)
% Plot the pairs in GREEN
for k=1:size(static_row,1)
rectangle( 'Position' , [ static_row(k,2) , static_row(k,4)+0.5 , static_row(k,3) , 1 ] , ...
'EdgeColor' , [ 0 0.8 0 ] , 'LineWidth' , 1 , 'FaceColor' , [ 0 1 0 ] );
end
arrays = 0.0;
for k=1:size(static_row,1)
arrays = arrays + static_row(k,3);
end
arrays/size(static_row,1)
% Plot the pc in BLUE
for k=1:size(static_column,1)
rectangle( 'Position' , [ static_column(k,2) , static_column(k,4)+0.5 , static_column(k,3) , 1 ] , ...
'EdgeColor' , [ 0 0 0.8 ] , 'LineWidth' , 1 , 'FaceColor' , [ 0 0 1 ] );
end
arrays = 0.0;
for k=1:size(static_column,1)
arrays = arrays + static_column(k,3);
end
arrays/size(static_column,1)
% Plot the pc in BLUE
for k=1:size(static_split, 1)
rectangle( 'Position' , [ static_split(k,2) , static_split(k,4)+0.5 , static_split(k,3) , 1 ] , ...
'EdgeColor' , [ 0.6 0.6 0.0 ] , 'LineWidth' , 1 , 'FaceColor' , [ 1 1 0 ] );
end
arrays = 0.0;
for k=1:size(static_split,1)
arrays = arrays + static_split(k,3);
end
arrays/size(static_split,1)
% Plot the unload
for k=1:size(static_unload,1)
rectangle( 'Position' , [ static_unload(k,2) , static_unload(k,4)+0.5 , static_unload(k,3) , 1 ] , ...
'EdgeColor' , [ 0.0 0.6 0.6 ] , 'LineWidth' , 1 , 'FaceColor' , [ 0 1 1 ] );
end
% Plot the load
for k=1:size(static_load,1)
rectangle( 'Position' , [ static_load(k,2) , static_load(k,4)+0.5 , static_load(k,3) , 1 ] , ...
'EdgeColor' , [ 0.6 0.0 0.6 ] , 'LineWidth' , 1 , 'FaceColor' , [ 1 0 1 ] );
end
%Plot the ghost in black
for k=1:size(static_ghost,1)
rectangle( 'Position' , [ static_ghost(k,2) , static_ghost(k,4)+0.5 , static_ghost(k,3) , 1 ] , ...
'EdgeColor' , [ 0.0 0.0 0.0 ] , 'LineWidth' , 1 , 'FaceColor' , [ 0 0 0 ] );
end
hold off;
xlabel('time (ms)');
ylabel('block ID');
set(gca,'YTick',0:8:128)
title('Task plot for BH with simulated cudaMemcpy');
axis([ 0 , ms_max , 0.5 , max(static(:,4))+1.5 ]);
% Print this plot
set( gcf , 'PaperSize' , 2.3*[ 30 4 ] );
set( gcf , 'PaperPosition' , 2.3*[ 0.25 0.25 20 4 ] );
%saveas(gcf, '/home/hudson/ug/d74ksy/PhD/BHTimers/tasks.eps', 'epsc');
print(gcf, '/home/hudson/ug/d74ksy/PhD/BHTimers/tasks.eps', '-depsc' );
我尝试过使用saveas和print,但无论如何我都会得到紫色文字。 这是具有奇怪颜色的绘图的输出。 output.eps 我在远程Linux上使用MATLAB R2014a。
任何人都有任何想法为什么会发生这种情况 - 我是否需要设置文字颜色(虽然这不能解释为什么画出矩形:
rectangle( 'Position' , [ static_ghost(k,2) , static_ghost(k,4)+0.5 , static_ghost(k,3) , 1 ] , ...
'EdgeColor' , [ 0.0 0.0 0.0 ] , 'LineWidth' , 1 , 'FaceColor' , [ 0 0 0 ] );
也是紫色
答案 0 :(得分:0)
答案/解决方法: 将xlabel / ylabel / set / title / axis命令移至保持之前;线和移动绘制黑框的部分是第一个绘制的框,解决了问题。