Scatterhist without normalized y axes on the marginal histograms. How ?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
LO
el 27 de Feb. de 2020
The plotting works perfectly if not for one thing: when plotting data using a grouping variable the marginal histograms look all normalized to their own maxima.
This makes it impossible to compare the relative abundance of elements in different groups, as it just gives an idea of how the data are distributed within each of them.
I would like instead to conserve the former information, thus allowing group comparisons.
It should be possible to access the handles of the marginal histograms in this way.
If "s" is the general handle: s = scatterhist(x,y,'Group',grouping_variable,'Kernel','on').
s(1) is the handle for the scatter plot
s(2) the bottom marginal hisogram (referred to the X axis) and
s(3) the one for the vertical histogram (referred to the Y axis)
I also did not manage to change the bin size of the two.
Perhaps all this is very trivial...
thanks for your help
0 comentarios
Respuesta aceptada
Adam Danz
el 27 de Feb. de 2020
Editada: Adam Danz
el 17 de Dic. de 2020
" when plotting data using a grouping variable the marginal histograms look all normalized to their own maxima"
That shouldn't be the case. Consider this example. Note that each group's marginal histograms have different maximum heights which shows that they are not normalized to their hown maxima, if I understand you correctly.
The axes containing the maginal histograms are normallized (axis limits are [0,1]) when you're plotting kernel density but that doesn't affect the shape of the distribution. See comment below to learn how to turn the histogram axes on conver them from normalized axes to axes that show bin counts.
load fisheriris.mat;
x = meas(:,1);
y = meas(:,2);
clf()
scatterhist(x,y,'Group',species,'Kernel','on')
5 comentarios
Adam Danz
el 27 de Feb. de 2020
Editada: Adam Danz
el 27 de Feb. de 2020
Are you able to run my code and produce the demo figure I shared?
Have you substituted your data correctly into the code from my demo?
If you show the relevant section of code, I can take a quick look at it. But first, confirmt the first question.
Más respuestas (0)
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!