How to edit each interval web in a spider plot for different categories?
4 views (last 30 days)
Show older comments
Is there a way I can edit the intervals of each of the 5 categories. They are all not spaced out the same nor evenly. For example 0, 20, 40, 60, 80, 100 for one category, then <0.85, 1.00, 1.20, 1.30, >1.35 for the next, etc for the next three categories?
D1 = [0.828 0.187 000.0 3.710 25.00]; %Min Values
D2 = [1.260 0.171 142.0 1.190 75.00]; %Data Points
D3 = [1.50 0.046 180.5 0.250 100.0]; %Max Values
P = [D1; D2; D3];
axesLimits = [0.828 0.046 000.0 0.250 25.00; %minimum values for spider graph
1.50 0.187 180.5 3.710 100.0]; %maximum values for spider graph
0 Comments
Answers (2)
Menika
on 18 Jul 2023
Hi,
xticks and xticklabels functions in MATLAB to customize the intervals and labels for each category. You can define custom intervals for each 5 categories and then use xticks to set the tick positions on the x-axis and xticklabel functions to set corresponding labels respectively.
This example might be helpful
D1 = [0.828 0.187 000.0 3.710 25.00]; % Min Values
D2 = [1.260 0.171 142.0 1.190 75.00]; % Data Points
D3 = [1.50 0.046 180.5 0.250 100.0]; % Max Values
P = [D1; D2; D3];
% Define the custom intervals for each category
intervals = {[0, 20, 40, 60, 80, 100], ...
[0.85, 1.00, 1.20, 1.30, 1.35], ...
% Define custom intervals for the remaining categories
% ...
};
% Define the labels for each interval
labels = {'Category 1', 'Category 2', 'Category 3', 'Category 4', 'Category 5'};
% Plot the spider graph
theta = linspace(0, 2*pi, size(P, 2)+1);
theta = theta(1:end-1);
figure;
polarplot(theta, P(1,:), '-o');
hold on;
polarplot(theta, P(2,:), '-o');
polarplot(theta, P(3,:), '-o');
thetaticks(rad2deg(theta));
thetaticklabels(labels);
Hope it helps!
Menika
on 19 Jul 2023
Hi,
You can modify the 'AxesInterval' parameter. In the above code, it is set to 5, which means there are 5 sections/levels within the spider graph. You can adjust this value to change the number of intervals.
0 Comments
See Also
Categories
Find more on Polar Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!