sanobar
sanobar

Reputation: 1

How do I overlap image with a graph in MATLAB?

I want to write a software that reads the satellite data from a text file and plots graph for different parameters of the oceans. The idea came from Oceonographic Data View(ODV).

My problem is plotting a graph on an image of the Indian ocean, where the image must be overlapped with the graph. Also, on zooming the area, the image with the graph could be zoomed.

How can I do this?

Upvotes: 0

Views: 3745

Answers (1)

Matt Mizumi
Matt Mizumi

Reputation: 1193

To load and display images, the Displaying Bit-Mapped Images tutorial from MathWorks may not be a bad place to start.

To overlay plots on the image, using hold on followed by plot should work.

An important part will be to have a sensible metric when displaying your image that allows you to place your overlays accurately. In the example below, notice the first and second arguments to image that define this; you could replace it by say linspace(0,1,size(X,1)) if you wanted it scaled between 0 and 1 instead of between 1 and 480 as below.

load mandrill
image(1:480,1:500,X) % display image
colormap(map)

hold on % prevent subsequent plot commands from destroying the image
plot([1 480],[100 100],'w','LineWidth',2) % plot an overlay line

Upvotes: 1

Related Questions