Filter löschen
Filter löschen

Blank histogram plot window

7 Ansichten (letzte 30 Tage)
Kevin
Kevin am 26 Jun. 2012
Hello,
I have a matrix full of data. I am interested in plotting a histogram of one column of said data. The number of rows in the data is 195,104. This minimum and maximum of the data series are -8.8317e+181 and Infinity, respectively.
Whenever I attempt to plot a histogram of the results, the plot window appears to be empty. Is there a way to properly plot this data? I am not necessarily interested in the outlier values, but more so in the range of -20 to 20. I have tried to limit the x-axis to this range, but the plot sill appears to be empty.
Thank you,
Kevin
  1 Kommentar
Image Analyst
Image Analyst am 27 Jun. 2012
It could be that there were lots of outliers - more than any valid values so the y range is huge, compressing all your histogram bars vertically. You may have needed to set ylim() also, in addition to xlim(). But actually, I tlawren's answer better.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

tlawren
tlawren am 26 Jun. 2012
If you are not interested in outliers (data outside of [-20,20]), then set all outliers to NaN's. Something like the following should work.
M(abs(M) > 20) = NaN;
hist(M(:,col));
where M is your data matrix and col is the column you want to plot.
Inf's will cause empty histograms.
  2 Kommentare
Kevin
Kevin am 26 Jun. 2012
Sorry, what does M represent in this case?
tlawren
tlawren am 26 Jun. 2012
M is your data matrix.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by