how to create log histogram?

조회 수: 6 (최근 30일)
RACHEL LYN JAHIRIN
RACHEL LYN JAHIRIN 2023년 6월 14일
답변: Image Analyst 2023년 6월 14일
hi matlab community, how can i create a histogram as shown below that include many result?
this is about image processing. i actually don't know what coding should i do. can see the file attach. thankyou so much!

답변 (2개)

Kanishk Singhal
Kanishk Singhal 2023년 6월 14일
What I understand from your question is that you need to plot histograms as points inside a plot.
You can do that by setting position of histogram plot to your desired location. To calculate the desired location you need postion of parent plot and its handle which can be easily derived from gcf and gca as shown.
% Number of plots you need with respect to X Axis
% Number of types of distortions
numX = 5;
% Dummy plot to hold other plots
x = 0:numX;
y = zeros(numX+1);
plot(x, y, 'k');
% Handle to current plots and axes
fig = gcf;
pos = get(gca, 'Position');
% Set X and Y labels to plots
set(gca, 'XTick',0.5:numX-0.5, 'XTickLabel', {'Jp2k' 'JPEG' 'WN'})
set(gca, 'Ylim', [0 120]);
for i = 0:numX-1
for dmos = (4).*rand(1,10)
x = 10:100;
y = -log(x);
% Set position and size of graph
% Position - [left bottom width height]
% modify dmos values in bottom and height to desired position
h = axes('Parent', fig, ...
'Position', [pos(1)+pos(3)*i/numX pos(2)+dmos*pos(4)/6 pos(3)/numX pos(4)/6]);
histogram(h, y);
set(h, 'XTick', [], 'YTick', []);
end
end

Image Analyst
Image Analyst 2023년 6월 14일

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by