Why does my histogram go out of its frame?

12 Ansichten (letzte 30 Tage)
NIna
NIna am 12 Mai 2023
Bearbeitet: Cris LaPierre am 16 Mai 2023
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 Kommentare
Cris LaPierre
Cris LaPierre am 12 Mai 2023
Please save your variables to a mat file and attach the file to your post using the paperclip icon.
Cris LaPierre
Cris LaPierre am 13 Mai 2023
%% 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(:)));

Melden Sie sich an, um zu kommentieren.

Antworten (3)

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

Cris LaPierre
Cris LaPierre am 16 Mai 2023
Bearbeitet: Cris LaPierre am 16 Mai 2023
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 am 16 Mai 2023
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

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by