Can I have the improfile intensity graph added to subplot

1 次查看(过去 30 天)
Hi, I have an image I use improfile to give a plot of the intensity across an image using mouse clicks, is there a way to add that improfile generated plot to a subplot?
tiff_image = imread('liney.png');
hIm_orig2 = tiff_image(:,:,1:3);
hFig=figure('units','normalized','outerposition',[0 0 1 1]);
set(0,'CurrentFigure',hFig)
subplot(4,7,[1 2 3 4 8 9 10 11 15 16 17 18])
imshow(hIm_orig2)
title('reference image','FontSize',15,'Color',[0,0,.9])
improfile
Best regards, Steve

回答(1 个)

Ameer Hamza
Ameer Hamza 2018-5-16
A simple way is to copy the axes object to the required figure.
hIm_orig2 = tiff_image(:,:,1:3);
hFig=figure('units','normalized','outerposition',[0 0 1 1]);
set(0,'CurrentFigure',hFig)
subplot(4,7,[1 2 3 4 8 9 10 11 15 16 17 18])
imshow(hIm_orig2)
title('reference image','FontSize',15,'Color',[0,0,.9])
improfile
axProfile = gca;
axProfileNew = copyobj(axProfile, hFig);
This will create an axis which will be overlapping the original axis. To remove overlapping and specify a position use axProfileNew.Position property.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by