Re: Repeat Texture as Background Image



A better idea :

figure

% Plot your data
plot(rand(5))

% Load an image
load clown

% Create a second axes
ax=axes('units','normalized', ...
'position',[0 0 1 1],...
'color','none',...
'xtick',[], ...
'ytick',[],...
'box','on',...
'hittest','off');

fig_units=get(gcf,'units');
set(gcf,'units','pixels');
fig_pos=get(gcf,'position');
set(gcf,'units',fig_units);
n=ceil(fig_pos(3)/size(X,2));

% Add the replicated image
image('cdata',repmat(flipud(X),n,n), ...
'hittest','off', ...
'handlevisibility','off');

% Adjust the axes limits
set(ax,'xlim',[1 n*size(X,2)], ...
'ylim',[1 n*size(X,1)], ...
'handlevisibility','off');

% Place the axes at the background
uistack(ax,'bottom');

Jérôme
.



Relevant Pages