Is it possible to make a large range bin to take less area over X axis?
조회 수: 4 (최근 30일)
이전 댓글 표시
לק"י
Hello!
I ploted some data over a histogram. the edges vector is this:
edges=[0:0.1378:8.2668 61.8908];
And the plot commands are these:
figure(15)
histogram(acd3cd8onlyareas*pxl2nm, edges, 'Normalization', 'probability')
set(gca, 'yscale','log')
h.Facecolor=[0 0 1];
hold on
histogram(acd45cd8onlyareas*pxl2nm, edges, 'Normalization', 'probability')
h.Facecolor=[1 0 0];
TestL={'aCD3 - blue','aCD45 - red'};
hLg=legend(TestL,'Location','northeast');
ax = gca;
ax.XTick = [pxl2nm 150*pxl2nm 300*pxl2nm];
When I plot the figure i get a large bin that "squeezes" the first part of the histogram:
is it possible to make only the last bin to take less space? I want it to look as close as possibly to this histogram without the last bin:
Thanks,
Amit.
댓글 수: 1
Dyuman Joshi
2023년 8월 16일
"I want it to look as close as possibly to this histogram without the last bin:"
You can change the xlimits.
답변 (1개)
Vedant
2023년 9월 8일
Hi @Amit Ifrach
If you are experiencing a large bin that "squeezes" the first part of the histogram when plotting a figure, it is likely due to the automatic binning algorithm used by the histogram function. The algorithm tries to determine the optimal number and width of bins based on the data range and distribution.
To address this issue and improve the visualization of your histogram, you can try the following approaches:
- Specify the number of bins: Experiment with different bin numbers to find a value that provides a more balanced distribution and avoids the squeezing effect.
ThemeCopy
% Example specifying the number of bins
numBins = 20; % Adjust the number of bins as needed
histogram(data, numBins);
- Adjust the bin width: Another option is to adjust the width of each bin to better capture the distribution of your data.
ThemeCopy
% Example specifying custom bin edges
binEdges = [0:0.5:10]; % Adjust the bin edges as needed
histogram(data, binEdges);
- Use another methods: kernel density estimation (KDE): https://in.mathworks.com/help/stats/kernel-distribution.html
You may refer to histogram documentation from here:
Thanks,
Vedant Panchal
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!