Create plot with shaded standard deviation, but ...
Afficher commentaires plus anciens
Hello,
I have tried searching on the internet about this issue, but I haven't found what I needed, so I'm here.
I am trying to create a plot that looks like this:

There are some important things that I need to say. The standard deviation will be different in each of the points. To be more specific, I will show you my data that I actually want to plot.
data = readmatrix("data.xlsx") % matrix with 3 columns
Each column contains numbers. From these numbers, an average value will and standard deviation will be calculated. Three columns, so only three values on the X axis.
Basic plot without these standard deviations would look like so:
% columns 2 and 3 are shorter, so i ignore NaN values
avg_data = [mean(data(:,1)), mean(data(~isnan(data(:,2)),2)), mean(data(~isnan(data(:,3)),3))]
std_data = [std(data(:,1)), std(data(~isnan(data(:,2)),2)), std(data(~isnan(data(:,3)),3))]
plot(1:3, avg_data)
I have all the data, but I am not aware how to create pretty plot with shaded areas. Other Mathworks Answers were usually using only one std for all the X values, but I have different std value for every X value.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Measurements and Feature Extraction 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!

