Construct a 'Bubble Plot' from a matrix
Mostra commenti meno recenti
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.
Risposta accettata
Più risposte (1)
Andres
il 8 Giu 2021
0 voti
4 Commenti
Himanshu Saxena
il 9 Giu 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
il 11 Giu 2021
Andres
il 12 Giu 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.
Categorie
Scopri di più su Data Distribution Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

