Construct a 'Bubble Plot' from a matrix
显示 更早的评论
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.
采纳的回答
更多回答(1 个)
Andres
2021-6-8
0 个投票
4 个评论
Himanshu Saxena
2021-6-9
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
2021-6-11
Andres
2021-6-12
Thanks for your reply. Maybe you can give a small example of such a matrix and describe how the bubble plot should look like.
类别
在 帮助中心 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

