Construct a 'Bubble Plot' from a matrix
Mostrar comentarios más antiguos
Hi,
I want to generate a bubble plot of a matrix. Such plots are possibe to make in 'R Studio'. I have attached an example image of the desired plot.
Is there a way to do so in MATLAB?
Thanks in advance.
Respuesta aceptada
Más respuestas (1)
Andres
el 8 de Jun. de 2021
0 votos
4 comentarios
Himanshu Saxena
el 9 de Jun. de 2021
I don't know 'R Studio' and what kind of matrix it expects, but perhaps in Matlab you need to do a bit more handwork as you can't call bubblechart (and e.g. scatter) with a single argument as you could do with surf(A) with a 2d-array A. This could be a possible enhancement for bubblechart.
An example with scatter (I don't have bubblechart here)
% bubble size matrix
A = repmat(magic(3),1,2);
% generate x,y data for scatter or bubblechart
[s1,s2] = size(A);
[x,y] = meshgrid(1:s2,1:s1);
% mirror and scale for scatter
b = flipud(A)*150;
figure
scatter(x(:),y(:),b(:))
xlim([0,s2]+1/2)
ylim([0,s1]+1/2)

Himanshu Saxena
el 11 de Jun. de 2021
Andres
el 12 de Jun. de 2021
Thanks for your reply. Maybe you can give a small example of such a matrix and describe how the bubble plot should look like.
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

