2D graph based on X and Y coordinates
1 次查看(过去 30 天)
显示 更早的评论
I have a data of time, X, Y and speed. firstly I'm looking for a way to draw a 2D graph with only X and Y with colorbar related to the high number of X and Y and low number of X and Y (i.e. X and Y are coordinates of people therefore the graph should be heat or density). I'm not sure if this can be done with only X and Y, so I think I need to create a function of Z that should calculate the number of people at each location, but since the coordinates are not repititive hence a range of space should be used. I couldn't perform any code that can show me anything close, I wish that someone can help me with this. Note that I have already tried the grouptransform function and found that all my data are unique.
0 个评论
采纳的回答
Cris LaPierre
2020-10-29
编辑:Cris LaPierre
2020-10-29
Sounds like a tiled histogram might be what you are looking for. If position is lat/lon, maybe a geodensityplot?
3 个评论
Cris LaPierre
2020-10-29
You can change the bin size in histogram2 using the nbins option, or by adding the BinWidth name-value pair.
histogram2(X,Y,'DisplayStyle','tile','ShowEmptyBins',"on","BinWidth",[20 10])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/396233/image.png)
更多回答(0 个)
另请参阅
类别
在 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!