how to organize my histogram please
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
0 votes
Share a link to this answer
9 Comments
Share a link to this comment
I cannot get any information from your .fig file.
My best guess is that none of your data are between the limits you set.
Consider:
Data = randi(50000, 100, 1); edges = linspace(3000, 41000, 40); % Define 39 Bins With 40 Edges histogram(Data, edges)
This produces an appropriate histogram, with the appropriate edges and 39 bins.
Share a link to this comment
Share a link to this comment
When I add a get call to my previous code: Data =
randi(50000, 100, 1); edges = linspace(3000, 41000, 40); % Define 39 Bins With 40 Edges histogram(Data, edges) XL = get(gca,'XLim')
the result is:
XL =
1100 42900
so the result is appropriate, and does not extend from 0 to 45000. The 'BinEdges' and 'BinLimits' correspond to those I set in my code. The 'BinEdges' returned by:
BE = Ax.Children.BinEdges
coresponds to those I set in my code. The width of each bin is about 974.36, since those are the requirements you set.
You may need to experiment with the number of bins you want and how to define them. I am using the information you provided, to produce the histogram result you specified.
Share a link to this comment
What is your definition of didn’t work?
This code:
filename = 'test.txt'; Load = load(filename); edges = linspace(3000, 41000, 40); % Define 39 Bins With 40 Edges histObject = histogram(Load, edges, 'Normalization','probability');
produces this plot:

Share a link to this comment
Share a link to this comment
As always, my pleasure.
I am using R2018a if that is important.
I would suggest that you see if the histfit function will do what you want. (I have not used it here.)
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)