Is it possible to make a large range bin to take less area over X axis?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
לק"י
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 comentario
Dyuman Joshi
el 16 de Ag. de 2023
"I want it to look as close as possibly to this histogram without the last bin:"
You can change the xlimits.
Respuestas (1)
Vedant
el 8 de Sept. de 2023
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 comentarios
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!