Prev: Problem deleting imrect
Next: isimage?
From: Deepak Kumar on 6 May 2010 11:09 Hi I am having problems printing matlab figures because the location of annotation gets changed. To illustrate this please run the small script at the end of this message. The problem I want to solve is - the eps output should resemble the figure being displayed on the screen. Unfortunately this is not the case. Any help will be appreciated. Thanks Deepak close all; clear all; figure_position = [0 0 800 600]; figure(1); set(gcf,'Position',figure_position); frame = zeros(516,500); frame(:,100-5:100+5) = 10000 + zeros(516,11); frame(:,200-5:200+5) = 10000 + zeros(516,11); display_frame = frame; axes axis_position = [100 100 516 500]; set(gca,'Units','pixels','Position',axis_position); im = imagesc(display_frame',[1000 16000]);colormap(flipud(gray)); axis off; axis tight; pos = [axis_position(1)/figure_position(3) axis_position(2)/figure_position(4) axis_position(3)/figure_position(3) axis_position(4)/figure_position(4)]; x_lim = xlim; y_lim = ylim; text_offset = 5; arrow_offset = -2; index = 100; text(x_lim(2)-60,index+text_offset,['Text 1']); annotation('arrow',pos(1)+pos(3)*([450 400]-x_lim(1))/(x_lim(2) - x_lim(1)),pos(2) + pos(4)*(-[index index]+y_lim(2)+arrow_offset)/(y_lim(2) - y_lim(1))); index = 200; text(x_lim(2)-60,index+text_offset,['Text 2']); annotation('arrow',pos(1)+pos(3)*([450 400]-x_lim(1))/(x_lim(2) - x_lim(1)),pos(2) + pos(4)*(-[index index]+y_lim(2)+arrow_offset)/(y_lim(2) - y_lim(1))); print -f1 -r1200 -depsc 'test.eps';
From: Deepak Kumar on 6 May 2010 12:37 I think I found a probable way to avoid this. By being able to pin the arrows to axes. However there are a lot of arrows in my real figure, and I would like to do it by a script rather than GUI for all the arrows. Does anyone know of a command to pin annotations? Thanks
|
Pages: 1 Prev: Problem deleting imrect Next: isimage? |