how make x and y -axis labels(titles) for histogram of an image?
29 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
somasekar jalari
am 2 Mai 2015
Kommentiert: somasekar jalari
am 4 Mai 2015
i execute the following matlab code to display histogram of gray scale image with x-axis and y-axis names but i didnot get names in x-axis and y-axis labels.
k=imhist(image)
xlabel('grayscale range')
ylabel('intensity values range');
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 2 Mai 2015
Your code should have worked. Try my boilerplate code snippet:
% Let's compute and display the histogram.
[pixelCount, grayLevels] = imhist(grayImage);
bar(grayLevels, pixelCount); % Plot it as a bar chart.
grid on;
title('Histogram of original image', 'FontSize', fontSize);
xlabel('Gray Level', 'FontSize', fontSize);
ylabel('Pixel Count', 'FontSize', fontSize);
xlim([0 grayLevels(end)]); % Scale x axis manually.
Weitere Antworten (1)
Ahmet Cecen
am 2 Mai 2015
Bearbeitet: Ahmet Cecen
am 2 Mai 2015
This sometimes happens to me too. The problem is xlabel sometimes get stuck BEHIND the imhist colorbar at the bottom. To fix it you can use this instead (may need to play around with the values for your liking):
xlabel('grayscale range')
xl = get(gca,'XLabel');
set(xl,'Position',get(xl,'Position') - [0 60000 0])
And Image Analyst's solution would also work because it gets rid of the default bar at the bottom. Take your pick.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!