How to edit each interval web in a spider plot for different categories?

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

Answers (2)

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!

1 Comment

I am using the spider_plot toolbox (spider_plot_R2019b) to create this graph. I cannot seem to find a way to edit the web intervals. Here is how it looks like. I will attach the rest of the code.
% Spider plot
s = spider_plot_R2019b(P,...
'AxesLabels', {'Stride Length (m)',... %1
'Postural Sway Area, ECUB',... %2
'360-degree Turn Peak Velocity (degrees/sec?)',... %3
'Sit to Stand Duration (s)',... %4
'Confidence (%)'},... %5
...
'AxesInterval', 5,... %number of sections/levels within the spider graph
'AxesPrecision', 2,...
'AxesDirection', {'normal', 'reverse', 'normal', 'reverse', 'normal'},... %THE MOST IMPORTANT LINE OF CODE 'FillOption', {'on', 'on', 'off'},... %fill option (red, black, green)
...
'Color', [.9 0 0; 0 0 0; 0 .8 0],... %(red, black, green)
...
'FillTransparency', [1, 1, 1],'AxesLimits',axesLimits); %transparency level of fill (1 is the highest) title('Data Visualization of Patient') %title
legend('Lowest Possible', 'Patient X', 'Highest Possible', 'Location', 'northwestoutside'); %legend

Sign in to comment.

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.

Categories

Find more on Graphics in Help Center and File Exchange

Products

Asked:

on 18 Jul 2023

Answered:

on 19 Jul 2023

Community Treasure Hunt

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

Start Hunting!