"stacked" polar plot

9 次查看(过去 30 天)
Peter Franks
Peter Franks 2023-5-24
I have a time series of velocities (speed and direction). I would like to do a polar plot where:
• The radial distance from the center is the speed of a given time point
• The angle is the vector angle of that time point
That part is easy. But I would like to do histograms, with the data binned by radial distance (i.e., binned by speed), and by angle, with the color of the bin proportional to the number of points in that bin.
So the plot would potentially have multiple sectors at different radial bins within an angle range, and each sector would have a color given by the number of points in that sector/radial bin.
Basically, it would be doing a histogram of data in a regular polarplot of the data (individual points), but the histogram would be in radial/angular bins, with each bin colored by the number of points in that bin.
Note: this is NOT the same as the radial distance giving the frequency of occurrence of that angle (i.e. polarhistogram). I need the radial distance to be the speed (in bins, stacked with greater speeds being at larger radii).
Thanks for your help!
  3 个评论
Cris LaPierre
Cris LaPierre 2023-5-25
Can you share your data as well as the code you have written? It is much easier if you provide something to work with.
Peter Franks
Peter Franks 2023-5-25
编辑:Peter Franks 2023-5-25
The data are pretty simple: speed varies from 0 to something, and angle goes between 0 and 360 degrees (2pi radians). Here's some code to generate reasonable values.
speed = rand(1,1000);
vangle=rand(1,1000)*pi*2;
I have not written any code because I'm stumped as to how to make stacked plots (like the figure I included above, which I downloaded from the web).
I'll point out that wind roses (like the one in my previous post) are standard plots in many fields, and there are MATLAB programs to make them. I'm trying to do something different: basically switching the speed and the frequency. The speed will be binned radially, and the frequency will be the color of the bin. I don't know how to do this!
Existing code for wind roses:
I can't figure out how to hack the code to get what I want...

请先登录,再进行评论。

回答(1 个)

Adeline
Adeline 2023-8-18
I understand that you are trying to plot a wind rose diagram with your data of speed and angle. You want the data to be binned by speed but color coded by frequency. Using the windrose function referenced in the comments, you can bin the data by speed. Since the data is binned by speed in this function, you can color code them only based on speed.
The following example illustrates the above description:
speed = randi(25,1,1000);
vangle=randi(360,1,1000);
wind_rose(vangle,speed);
Note: If radius is speed and the bin is color coded by frequency (i.e., the number of points in a each speed bin) then the chart would look like a multi-level pie chart as shown below. This cannot be achieved using a polar histogram. As the histogram plot would require one axis to be defined by the number of points in the bins.
  3 个评论
Saurav
Saurav 2024-1-3
Hi, I am also stuck in the situation same as Peter. Could you tell me which function/ code you used in order to get the plot as this?
And if possible, could you please tell me if you could plot the probability of the data instead of the count?
Thank you.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

产品


版本

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by