How to boxplot already determined statistics with whiskers
Show older comments
I have the mean, min, max, and std. values for many processed excel files. Each file has a date associated with it and I am try to plot these values in a box plot. The x-axis = the dates that I have carried around and are displayed with xticklabel and y-axis = the data including mean, min, max, and std. Right now I have plotted them into a scatter plot but need to have it in a box plot.
[num, text] = xlsread('5V.xls','PDU_OP');
mean = num(:,1);
min = num(:,3);
max = num(:,4);
[a, ~] = size(mean);
x = linspace(1,a,a);
figure(4)
scatter(x, max, 'b', 'MarkerFaceColor','b')
hold on
scatter(x, mean, 'r', 'MarkerFaceColor','r')
scatter(x, min, 'g', 'MarkerFaceColor','g')
set(gca,'XTick',1:a,'XTickLabel', text(:,1));
legend('max','mean','min','location','southeast');
title('PDU\_OP')
xlabel('Date/Time')
ylabel('Voltage');
grid on
My code reads a sheet on an excel file consisting of the dates (text, which is sized and formated to the plot to account for the exact number of data rows in the excel file and are assigned to my xticklabel as text(:,1)) and mean, min, max, std. values (num, which are assigned separately because scatter plots won't allow multiple data plotting only plot overlaying, done by 'hold on')
It being a scatter plot I cannot show the std. but it would be num(:,2). I would like to take the 4 details for each date of data and plot them with a box plot.
Accepted Answer
More Answers (0)
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!