フィルターのクリア

imhist & suppress color bar

4 ビュー (過去 30 日間)
Richard
Richard 2020 年 9 月 11 日
コメント済み: Ameer Hamza 2020 年 9 月 11 日
Quick question: I am trying to overlay 2+ image histograms, using imhist (as it provides the color bar at the bottom). When I try to make more than one, using hold on, it adds extra color bars to the bottom. Is there a way to supress that output (or is there a better option I am unaware of)? Idealy the output should look like the output of the code below but with only 1 color bar.
Quick example of what's happening:
I = imread('moon.tif');
I1 = I(100:120,210:230);
I2 = I(450:470,170:190);
I3 = I(370:390,60:80);
figure
hold on
imhist(I1);
imhist(I2);
imhist(I3);
hold off

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 9 月 11 日
編集済み: Ameer Hamza 2020 年 9 月 11 日
Try this
I = imread('moon.tif');
I1 = I(100:120,210:230);
I2 = I(450:470,170:190);
I3 = I(370:390,60:80);
f = figure;
ax = axes();
hold on
imhist(I1);
pos = ax.Position; % save the axes position because next commands will resize it
imhist(I2);
imhist(I3);
hold off
stripes = findall(f, 'Tag', 'colorstripe');
delete(stripes(1:end-1))
ax.Position = pos;
  2 件のコメント
Richard
Richard 2020 年 9 月 11 日
Dang, you're fast! That's exactly what I was looking for!
Ameer Hamza
Ameer Hamza 2020 年 9 月 11 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by