Choose the ideal number of bins in hist3
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear all,
I want to plot a hist3 plot but i'm not sure which is the ideal number of bins that I would need to define.
I have two variables with 116640 x 1 size and I'm using the following line of code:
hist3([Var1, Var2],[200 200],'CDataMode','auto','EdgeColor','none');
In this case I'm using [200 x 200] number of bins but as I want to compare these results with others with different variable sizes I'm not sure how to get the ideal number of bins based on the matrix sizes.
Do you have any idea how to do this?
Thank you in advance
5 comentarios
Jan
el 3 de Dic. de 2022
What about a 2D interpolation with the smaller number of bins? This will keep the highest possible resolution for a 1-by-1 comparison.
Respuestas (1)
Muskan
el 4 de Sept. de 2023
Hi Ricardo,
I understand that you're interested in learning more about selecting the appropriate number of bins when plotting the histogram using the "hist3" function.
You can consider the following approaches to help you choose an appropriate number of bins in the “hist3” function:
Sturges' formula: One approach is to use Sturges' formula, which estimates the number of bins based on the logarithm of the number of data points. The formula is numBins = ceil(1 + log2(numPoints))
Experimentation and visualization: If the above approach do not provide satisfactory results, you can experiment with different numbers of bins and visually inspect the resulting “hist3” plots. Start with a smaller number of bins and gradually increase it to see how the histogram representation changes. Make sure to choose a number of bins that captures the desired level of detail without being too coarse or too fine.
You can further refer to the documentation of the “hist3” function:
I hope the above information helps resolve your query.
Thanks
0 comentarios
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!