Plotting images over a graph in Matlab - matlab

Does anyone know how can one plot() a regular 2D plot in Matlab,
and draw little images over that plot?
Thanks for any tips.

Hmmm, my bad, it's all there in the basic Matlab commands:
You do your plot(),
call 'hold on',
and then call 'image(x,y,img)' to plot that image on top of the existing plot.
:)

Related

How to plot two 2D histograms on the same 2D image?

I wonder if anyone can help me to plot two 2D histograms on the same plot.
I do some lifetime imaging and I want to reproduce my result as histograms (phasor plot method). I know how to plot a single 2D histogram, but not more, without removing the preceding one.
I am currently using the DIPimage toolbox, but I have seen that for plotting 2D histograms you can use as well the function 'ndhist'.
Please, find attached the picture. This is not obviously what I am after, as the background should be all blue and I would like to plot more 'clouds' over the universal circle.

Is there a possibility to draw several cylinders or tubes in a matlab figure

I have 3-D plot in matlab and it contain several lines. I want to draw cylinder or hollow tubes around those line. Is someone has experience of plotting several cylinder in 3-D plot?
Yes, there is a possibility. There is a possibility of everything in Matlab!
Lets Google and find: cylinder()!
Fantastic, Matlab has a function to generate cylinders!
And... That's it. Go plot them wherever you want.
Fun:
clear;clc;
cmap = hsv(10);
for ii=1:10
hold on
[X,Y,Z]=cylinder(rand(1,1)*0.4);
h=surf(X+(rand(1,1)-10)*2,Y+(rand(1,1)-10)*2,Z*rand(1,1)*10,'FaceColor',cmap(ii,:));
end

Plotting 3-D Matrix *values* in MATLAB

I have a 3D Matrix M(256x256x136) and each index(i,j,k) in M has a gray level value in it. I am interested in displaying M in some sort of a 3D plot in MATLAB, but am unable to do so. I cannot use plot3 because plot3 is for plotting points, not the values.
Thanks
If I understand your question correctly, you want to plot the 3D point cloud with i,j, and k as 3D coordinates and the gray level as the point value.
I would suggest using scatter3.
Sounds like you are looking for a volume renderer. For Matlab, you could try this one: Volume Render from Matlab Central
An isosurface plot might be useful as well.

scatter a vector Matlab

to plot a vector I am using something like:
plot(1:length(vector),vector)
Could scatter be used? How?
If you're asking how to plot only points, without lines connecting them, just specify the marker and line style in the call to PLOT:
plot(1:length(vector),vector,'o'); % Use a circle with no connecting line
Scatter can be used in a similar fashion to plot.
scatter(1:length(vector),vector)
plot(vector,'o') is a simpler way.

Is it possible to add colorbar properties to a maltlab plot?

I'd really like to know if there's a way to add the colorbar properties we usually find in surface or mesh, but this time for a simple plot.
Thanx you!
Are you asking how to add a colorbar to a plot? The COLORBAR function does that, but it's really only useful if you have an object in your plot that uses a colormap, like a surface or an image.
For simple line plots, you're probably better off going with a legend.
In addition to what gnovice stated in their answer you can define your own colormap. I would suggest you model it off of a HSV scheme since you're wanting to vary the intensity. That was you can select the color you want and vary just the intensity value of it.