plot y Vs. X in heat-map plot
21 次查看(过去 30 天)
显示 更早的评论
Hi all,
How can I create a scattered heat-map? I tried to find an already build function but I couldnt make it work for some reason.
2 个评论
darova
2020-3-16
Can you be more specific? Are you trying to plot color line? Can you show something?
回答(2 个)
darova
2020-3-17
Try this
x = rand(1000,1);
y = rand(1000,1);
R = 0.1; % circle radius
D = pdist2([x y],[x y]); % create combinations of distances
C = sum(D<R); % how mayn points inside circle
scatter(x,y,10,C,'fill')
colorbar
0 个评论
Cris LaPierre
2020-3-16
2 个评论
Cris LaPierre
2020-3-17
We have a geodensityplot function, but that expects lat/lon for x/y. If you have a way of representing the density numerically, you could use that number to color your data using gscatter, or to create contour levels with contour or contourf.
If you don't want to reinvent the wheel, you can also find some solutions in the file exchange. A quick search found these two:
You can also find some other approaches in this MATLAB Answer post as well as this one. It appears histogram2 or histogram3 are common solutions for this.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!