You can use the xlim and ylim commands. Answer from the cyclist on mathworks.com
MathWorks
mathworks.com › matlabcentral › answers › 467758-what-represents-the-y-axis-in-matlab-s-histogram
What represents the Y-axis in matlab's histogram? - MATLAB Answers - MATLAB Central
June 18, 2019 - The default is 'count' in which case the Y axis values represent the number of elements in the data being binned that falls into each bin. For a list of the other possible values, see the histogram documentation (specifically the description ...
MathWorks
mathworks.com › matlabcentral › answers › 334705-switch-x-and-y-axis-in-a-histogram
Switch X and Y axis in a histogram - MATLAB Answers - MATLAB Central
April 10, 2017 - hist(a) How to switch the X and Y axis? Currently X represents values, and Y represents the number of elements in that range. I w...
MathWorks
mathworks.com › matlabcentral › answers › 676188-how-to-make-the-y-axis-counts-and-x-axis-the-variable-on-histograms
How to make the y axis 'counts' and x axis the variable on Histograms - MATLAB Answers - MATLAB Central
December 3, 2020 - The two existing answers below create a horizontal histogram which puts the counts on the x-axis and the variable values on the y-axis. ... https://www.mathworks.com/matlabcentral/answers/676188-how-to-make-the-y-axis-counts-and-x-axis-the-variable-on-histograms#comment_1180448
MathWorks
mathworks.com › matlabcentral › answers › 131063-how-to-change-y-axis-limit-of-a-histogram
How to change y-axis limit of a histogram - MATLAB Answers - MATLAB Central
May 25, 2014 - I want to add a histogram to a GUI, but i have to keep it small, when i initiate it, it shows a value of 5000 on y axis whereas the frequency of pixels is less than 500 so i want to decrease it to clearly show the bars. So can anybody tell me on how to change y axis limit in imhist. ... https://www.mathworks.com/matlabcentral/answers/131063-how-to-change-y-axis-limit-of-a-histogram#comment_440176
MathWorks
mathworks.com › matlabcentral › answers › 246146-normalize-y-axis-in-matlab-histogram
Normalize y axis in Matlab histogram - MATLAB Answers - MATLAB Central
October 1, 2015 - Normalize y axis in Matlab histogram. Learn more about histogram, matlab
MathWorks
mathworks.com › matlabcentral › answers › 13005-histogram-y-axis-to-logarithmic-scale
Histogram Y axis to Logarithmic Scale - MATLAB Answers - MATLAB Central
August 3, 2011 - on a histogram that I plotted in Matlab 2016b using the "histogram" command, and it worked like a charm. It kept the graph as a histogram, and just changed the y-axis to logarithmic scale, exactly as desired.
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › data distribution plots
Histogram - Histogram plot - MATLAB
Plot a histogram of the random numbers. Scale and label the y-axis as percentages.
MathWorks
mathworks.com › videos › using-hist-and-bar-to-customize-your-histograms-97279.html
How to Customize Histograms in MATLAB - MATLAB
This video demonstrates how to leverage simple MATLAB functions to customize the appearance of a histogram. You’ll learn how to accomplish tasks like changing the bin size and displaying relative frequencies on the y-axis instead of absolute counts.
Published: February 4, 2021
MathWorks
mathworks.com › matlabcentral › answers › 1987673-scaling-the-x-and-y-axis-of-a-matlab-histogram
Scaling the X and Y axis of a matlab histogram. - MATLAB Answers - MATLAB Central
June 24, 2023 - This lets histogram go ahead and do the binning itself, then just scales the resulting counts as desired. Piece 'o cake!!! :) Dunno why didn't dawn on me initially...and, of course, then don't scale the ticklabels yet again. ... https://www.mathworks.com/matlabcentral/answers/1987673-scaling-the-x-and-y-axis-of-a-matlab-histogram#comment_2794653
Top answer 1 of 3
2
Browse the MATLAB documentation for 'yticks' and 'yticklabels'.
One solution might be as follows:
yticklabels(yticks*100)
2 of 3
2
I’m not certain what you’ve already done.
The *|'YTick'|* values are available, and you can modify them as you would with any other usual axis object.
*_Example_ —*
d = randn(1, 1000); % Create Data
figure
histogram(d, 50, 'Normalization','probability', 'DisplayStyle','stairs')
figure
histogram(d, 50, 'Normalization','probability', 'DisplayStyle','stairs');
ytix = get(gca, 'YTick')
set(gca, 'YTick',ytix, 'YTickLabel',ytix*100)
Compare the two figures to see the result of recalculating the *|'YTick'|* values in the second *|histogram|*.
MathWorks
mathworks.com › matlabcentral › answers › 1593014-histogram-with-two-axes
Histogram with two axes - MATLAB Answers - MATLAB Central
November 22, 2021 - Note in the code below the YAxis property on the Axes is a vector with two elements: the first is a handle to the left y-axis and the second is a handle to the right y-axis. ... Thanks a lot! For me the first approach is enough because I only produce and save the pictures and don't scroll them, but thanks for the advanced approach as well! Sign in to comment. Sign in to answer this question. Find more on Histograms in Help Center and File Exchange ... Find the treasures in MATLAB Central and discover how the community can help you!
Top answer 1 of 2
4
You can do this:
data = 0.1 * rand(1, 1000); % Create sample data.
edges = linspace(0, 1, 21); % Create 20 bins.
% Plot the histogram.
histogram(data, 'BinEdges',edges);
% Fancy up the graph.
grid on;
xlim([0, 1]);
xlabel('Data Value', 'FontSize', 14);
ylabel('Bin Count', 'FontSize', 14);
title('Histogram of Data', 'FontSize', 14);
Of course you will have only 2 bins for your data to fall into, so I don't know if that's what you want.
2 of 2
0
h=histogram('BinEdges',edges,'BinCounts',20)
h.BinLimits=[0 1] % x-axis range
MathWorks
mathworks.com › matlabcentral › answers › 1881322-histogram-with-sum-of-variables-on-y-axis
Histogram (with sum of variables on y-axis) - MATLAB Answers - MATLAB Central
December 19, 2022 - I want to create a histogram where I sum the values in an interval on the x-axis, such as all values between 0 to 5, and plot the associated sum on the y-axis. Hence, I am not interested in the count on the y-axis, but the sum of the variables within that range. Thanks in advance. Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/1881322-histogram-with-sum-of-variables-on-y-axis#answer_1131702
MathWorks
mathworks.com › matlabcentral › answers › 50240-how-to-get-a-vertical-histogram-as-in-the-x-axis-should-be-displayed-vertically
How to get a vertical histogram, as in the X axis should be displayed vertically? - MATLAB Answers - MATLAB Central
October 9, 2012 - I want to have x-axis displayed vertically and y-axis horizontally, and also I would like to have the mean and median displayed on the histogram graph itself (like mean = 24, should be displayed on the graph). Is there a solution to this? Thank you in advance. Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/50240-how-to-get-a-vertical-histogram-as-in-the-x-axis-should-be-displayed-vertically#answer_61342
MathWorks
mathworks.com › matlabcentral › answers › 263102-i-want-to-find-x-axis-and-y-axis-values-of-an-histograms-in-matlab
i want to find x axis and y axis values of an histograms in matlab. - MATLAB Answers - MATLAB Central
January 8, 2016 - i did this too,but i need to find total no of pixels at particular value of x-axis,so that i can calculate entropy from histogram using programming rather than manually. Sign in to comment. ... https://www.mathworks.com/matlabcentral/answers/263102-i-want-to-find-x-axis-and-y-axis-values-of-an-histograms-in-matlab#answer_205641


