在同一图中绘制多个图像 [英] Plotting several images in the same plot

查看:82
本文介绍了在同一图中绘制多个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在较大的图上绘制小图像...实际上是它的isomap算法,我有很多点,现在每个点对应一个图像,我知道它是哪个图像...问题是如何加载该图像并在图形上绘制? 我还必须同时绘制图像和点,因此,基本上,图像将与点重叠. 当然,在此处

I'm trying to plot small images on a larger plot... Actually its isomap algorithm, I got many points, now each point correspond to some image, I know which image is it... The porblem is how to load that image and plot on the graph? One more thing I have to plot both image and the points, so, basically the images will overlap the points. Certainly, the type of image given here

推荐答案

类似的东西应该可以帮助您入门.您可以使用image函数的低级版本绘制一组轴.

Something like this should get you started. You can use the low-level version of the image function to draw onto a set of axes.

% Define some random data
N = 5;
x = rand(N, 1);
y = rand(N, 1);

% Load an image
rgb = imread('ngc6543a.jpg');

% Draw a scatter plot
scatter(x, y);
axis([0 1 0 1]);

% Offsets of image from associated point
dx = 0.02;
dy = 0.02;

width = 0.1;
height = size(rgb, 1) / size(rgb, 2) * width;

for i = 1:N
  image('CData', rgb,...
        'XData', [x(i)-dx x(i)-(dx+width)],...
        'YData', [y(i)-dy y(i)-(dy+height)]);
end

这篇关于在同一图中绘制多个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆