how to create log histogram?

4 次查看(过去 30 天)
RACHEL LYN JAHIRIN
RACHEL LYN JAHIRIN 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 中查找有关 Annotations 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by