在MATLAB图中添加徽标

时间:2014-09-18 17:33:11

标签: matlab

我已经阅读了许多关于在MATLAB中添加图像作为图形背景的文章,但我想知道是否可以在MATLAB图形中添加徽标,例如在右上角或左上角。

2 个答案:

答案 0 :(得分: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

答案 1 :(得分: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