how to create log histogram?
5 views (last 30 days)
Show older comments
hi matlab community, how can i create a histogram as shown below that include many result?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1410234/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1410234/image.png)
this is about image processing. i actually don't know what coding should i do. can see the file attach. thankyou so much!
0 Comments
Answers (2)
Kanishk Singhal
on 14 Jun 2023
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
0 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!