plot and figure windows
4 views (last 30 days)
Show older comments
How can use plot function to indicate specific points in the figure window which displays an image?
0 Comments
Answers (1)
Ayush
on 21 Oct 2024
Hi,
To indicate specific points in the figure window which display an image, you can first use “hold on” which will allow you to overlay plots on the current figure without erasing the image. Then define the coordinates of the points you want to indicate on the figure and pass them to the “plot” function. Finally, use “hold off” to release the “hold on” the current figure. Refer to an example code below for better understanding:
% Read the image
img = imread('your_image.jpg');
% Display the image
imshow(img);
hold on; % Hold the current figure
% Define the points you want to plot
x = [50, 100, 150]; % X-coordinates of the points
y = [75, 125, 175]; % Y-coordinates of the points
% Plot the points on the image
plot(x, y, 'r*', 'MarkerSize', 10, 'LineWidth', 2);
% Release the hold on the current figure
hold off;
0 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!