Construct a 'Bubble Plot' from a matrix
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (1)
Andres
le 8 Juin 2021
0 votes
4 commentaires
Himanshu Saxena
le 9 Juin 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
le 11 Juin 2021
Andres
le 12 Juin 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.
Catégories
En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

