How to plot something like this plot?

1 view (last 30 days)
BN
BN on 19 Apr 2020
Commented: BN on 21 Apr 2020
Hello
I want to show the following data:
Jan = 5
Feb = 10
March = 5
April = 1
May = 14
June = 12
July = 0
August = 3
September = 5
October = 7
November = 10
December = 16
Winter = 15
Spring = 12
Summer = 3
Autumn = 1
Annual = 6
Here is an example plot that I need that I found from the Internet: (green line and black lines, not blue and violet liens because it seems it was plotted for 3 data sets)
I searched a lot but found not so much, I see there a function named on the polar plot but I don't know how to plot something like this using it. So maybe there is a better function than a polar plot exists for plotting my data in this way.
I want to ask you If you please tell me how can I do to plot my data like this.
Thank you so much

Accepted Answer

Adam Danz
Adam Danz on 19 Apr 2020
Edited: Adam Danz on 19 Apr 2020
Here's a demo. I've chosen to use radians but you can use degrees with a few changes.
See inline comments for detail.
% For 12 months, compute 13 equally spaced angles where the
% first and last values will wrap to the same value.
theta = linspace(0,2*pi,13); % 12 equally spaced angles (13 points)
% Vector of radii values
r = randi(15,1,12); % 12 radii values
% Get month name abbreviations
monthNames = month(datetime(1, 1:12, 1), 's');
% Create polar plot
ax = polaraxes();
polarplot(ax, theta, r([1:end,1]), 'g-', 'LineWidth', 2)
% Set the polar axes units to radians, define the theta ticks
% and theta labels.
set(ax, 'ThetaAxisUnits', 'radians', 'ThetaTick', theta(1:end-1),...
'ThetaTickLabel', monthNames)
You can make further changes to the plot as needed suchs as putting January on top and making dotted reference lines. See polaraxes properties.
  1 Comment
BN
BN on 21 Apr 2020
I really appreciate you. It was quite helpful.

Sign in to comment.

More Answers (0)

Categories

Find more on Polar Plots in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!