2014-09-18 77 views
1

我已經閱讀了許多關於在MATLAB中添加圖像作爲背景的文章,但是我想知道是否可以在MATLAB圖形中添加徽標,例如右上或左上手邊。添加徽標到MATLAB圖

+0

所以沒有任何提示的解決方案解決問題了嗎? – 2014-09-29 15:34:39

+0

不完全是,我決定將軸插入我的圖中,然後插入圖片。然而,在說了這些之後,你的答案是兩者中較好的答案,我會接受它,因爲這是可能的。謝謝! – user2958395 2014-10-02 21:21:33

+0

確定沒問題,謝謝!我很好奇你是如何解決你的問題的;這是一個有趣的問題:) – 2014-10-02 22:14:59

回答

0

這裏。它可能不是最通用/健壯,但它可以解決你的問題:

clc; 
clear all; 

LogoImage = imread('Matlab_logo.png'); 

x=0:0.1:10; 
y=sin(x); 

figure 

subplot('Position',[0.8 0.8 0.2 0.2]) % Place the logo using the sub^plot command. 
imshow(LogoImage) 

%set(gca,'LooseInset',get(gca,'TightInset')) % Not necessary... actually it can be used to get rid of the blank space around plots. In this case it does not apply however. 

subplot(1,5,1:4) % Make the actual plot span 4 of the 5 subplots. 
plot(x,y) 

給予這樣的:

enter image description here

1

你能做到這一點

>> z = peaks; z = round(255 * z/max(max(z))); 
>> x = linspace(0, 2*pi, 101); 
>> plot(x, sin(x)) 
>> hold on 
>> image([4,2*pi], [0.5,1.5], z) 
>> xlim([0, 2*pi]) 
>> ylim([-1.5, 1.5]) 

使用插曲替代解決方案,其結果如下情節

enter image description here

+0

如果我想把徽標放在圖表之外怎麼辦? – user2958395 2014-09-18 18:03:29