have change values for x axis
Afficher commentaires plus anciens
THe code I have is below. I am trying to get the x axis to read something different for each box plot. Right now they say 1,2,3,4 I would like them to say (MISTY, rater one, rater two, rater three)How would I change this????
data = readcell('ratings.csv');
% Collect the participant numbers
participants = cell2mat(data(2:end, 1));
participants = unique(participants);
% Iterate through each participant, calculating the accuracy of each rater
accuracies = zeros(length(participants), 3);
for i = 1:length(participants)
rows = [false; cell2mat(data(2:end, 1)) == participants(i)];
participant_data = data(rows, :);
ground_truth = cell2mat(participant_data(:, 8));
misty = cell2mat(participant_data(:, 4));
ayan = cell2mat(participant_data(:, 5));
deandre = cell2mat(participant_data(:, 6));
naomi = cell2mat(participant_data(:, 7));
accuracies(i, 4) = sum(misty == ground_truth) / length(ground_truth);
accuracies(i, 1) = sum(ayan == ground_truth) / length(ground_truth);
accuracies(i, 2) = sum(deandre == ground_truth) / length(ground_truth);
accuracies(i, 3) = sum(naomi == ground_truth) / length(ground_truth);
end
figure
boxchart(accuracies)
title('Accuracy');
ylabel('Rating')
Réponses (1)
Since you're using a matrix of ydata values, you'll need to replicate the vector of labels to match the size of the matrix.
accuracies = rand(100,4);
labels = ["MISTY", "rater one", "rater two", "rater three"];
cats = categorical(labels,labels);
cats = repmat(cats,height(accuracies),1);
boxchart(cats(:),accuracies(:))
Catégories
En savoir plus sur Linear Predictive Coding dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
