Construct a 'Bubble Plot' from a matrix
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (1)
Andres
am 8 Jun. 2021
0 Stimmen
4 Kommentare
Himanshu Saxena
am 9 Jun. 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
am 11 Jun. 2021
Andres
am 12 Jun. 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.
Kategorien
Mehr zu Data Distribution Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

