Why does my histogram go out of its frame?

10 ビュー (過去 30 日間)
NIna
NIna 2023 年 5 月 12 日
編集済み: Cris LaPierre 2023 年 5 月 16 日
I draw a histogram from an image using imhist just like this:
subplot(2, 2, 3), imhist(a+50), title("Blob1 lighter hist");
and then when I plot it, the lines are getting out of the frame and I don't know why.
Please someone help me, I really don't understand what is going on with my Matlab program and I don't find anything online.
  2 件のコメント
Cris LaPierre
Cris LaPierre 2023 年 5 月 12 日
Please save your variables to a mat file and attach the file to your post using the paperclip icon.
Cris LaPierre
Cris LaPierre 2023 年 5 月 13 日
%% Blobs
figure;
a = imread("blobs1.png");
b = imread("blobs2.png");
c = imread("blobs3.png");
d = imread("blobs4.png");
subplot(2, 2, 1), imshow(a), title("Blob1");
subplot(2, 2, 2), imshow(b), title("Blob2");
subplot(2, 2, 3), imshow(c), title("Blob3");
subplot(2, 2, 4), imshow(d), title("Blob4");
figure;
subplot(2, 2, 1), imhist(a), title("Blob1");
subplot(2, 2, 2), imhist(b), title("Blob2");
subplot(2, 2, 3), imhist(c), title("Blob3");
subplot(2, 2, 4), imhist(d), title("Blob4");
disp('Blob1');
Blob1
mean(a(:));
std(double(a(:)));
disp('Blob2');
Blob2
mean(b(:));
std(double(b(:)));
disp('Blob3');
Blob3
mean(c(:));
std(double(c(:)));
disp('Blob4');
Blob4
mean(d(:));
std(double(d(:)));

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

回答 (3 件)

Cris LaPierre
Cris LaPierre 2023 年 5 月 13 日
I'm able to reproduce as well. I suggest reporting this here: https://www.mathworks.com/support/contact_us.html

Cris LaPierre
Cris LaPierre 2023 年 5 月 16 日
編集済み: Cris LaPierre 2023 年 5 月 16 日
I would recommend not using imhist to create your histogram. Instead, use histogram(I) or bar(counts) to visualize.
B1 = imread('blobs1.png');
figure
histogram(B1,'BinWidth',1)
xlim([0,255])
figure
counts = imhist(B1);
bar(counts)

Image Analyst
Image Analyst 2023 年 5 月 16 日
I am not able to reproduce in either R2022b or R2023a. It looks perfectly fine. I'd call tech support. Maybe try a different renderer with opengl
  1 件のコメント
Cris LaPierre
Cris LaPierre 2023 年 5 月 16 日
It will depend on your graphics card.

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

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by