MATLAB Answers

How to plot something like this?

1 view (last 30 days)
Behzad Navidi
Behzad Navidi on 30 Jul 2020
Commented: Behzad Navidi on 31 Jul 2020
Hello everyone,
Assume that I have this 3 datasets (A, B, C) and I want to have a plot like this (please kindly ignore the white space in the southwest of it because I want a full polar plot)
So I tried to make it using this script:
clear; clf; close; clc;
A = [19,6,13,4,20,12,5,17,3,8,16,9,1,10,2,18,15];
B = [11,13,12,8,19,14,18,20,7,1,6,15,4,10,17,16,3];
C = [2,7,11,17,3,16,14,5,19,10,12,20,1,4,6,13,8];
figure
ax = polaraxes();
polarhistogram(A,18,'FaceColor','b')
hold on
polarhistogram(B,18,'FaceColor','r')
hold on
polarhistogram(C,18,'FaceColor','g')
theta = linspace(0,2*pi,18); % 17 equally spaced angles (18 points)
ax.ThetaDir = 'clockwise'; %make january first
ax.ThetaZeroLocation = 'top'; %make january first
monthNames = {'Jan.' 'Feb.' 'Mar.' 'Apr.' 'May' 'Jun.' 'Jul.' 'Aug.' 'Sep.'...
'Oct.' 'Nov.' 'Dec.' 'Winter' 'Spring' 'Summer' 'Autumn' 'Annual'};
set(ax, 'ThetaAxisUnits', 'radians', 'ThetaTick', theta(1:end-1),...
'ThetaTickLabel', monthNames);
Also, I can see the amount that presented in the r-axis not present the amount of my data; for instance, in Annual (17th in C) the value of C In my data is 8 but in the figure, it seems to is 2. So I want to ask you please guide me on how to have a plot like this?
Also, the amount of January does not show directly in front of it, but it shows between January and February and I don't know how to fix it.
An extra description is the value of each data set A, B, and C represents the data for January to December and Winter, Spring, Summer, Autumn, and Also annual value (12 months + 4 seasons + 1 annual = 17).
In case if they are overlapped it's no matter what color showing in the plot just one of them is good.
Thank you so much...
  2 Comments

Sign in to comment.

Answers (0)

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!