plot errorbars on graph for selected points

3 visualizaciones (últimos 30 días)
Mandy de Graaf
Mandy de Graaf el 6 de Nov. de 2019
Respondida: Nikhil Sonavane el 23 de Dic. de 2019
Hi! I want to plot a graph of my datapoints with some errorbars. However, since i have 600 datapoints, i get 600 errorplots. That looks very messy. I wrote a script that enables selection of specific points by clicking on it. A parameter is generated which consists of zeros and only standard deviation values on the clicked datapoints. However when I plot this, it still looks messy because the bars for a standard deviation with value 0 is still displayed. Does anyone know how to get rid of these? Thanks!
This is my script:
(C_av_smooth1 containes my 600 datapoints and std_dev1 containes the standard deviation of each of these points.)
% plot graph and select the points where you want the errorbars
figure;
plot(C_av_smooth1,"LineWidth", 1)
bar_points=int16(getpts());
% list of zeros as long as the amount of data points
stdtest=zeros(1,length(std_dev1));
for i=1:length(stdtest)
for j=1:length(bar_points)
if i==bar_points(j)
stdtest(i)=std_dev1(i);
i=i+1;
end
end
end
% plot graph with errorbars on desired place
figure;
errorbar(C_av_smooth1,stdtest)

Respuestas (1)

Nikhil Sonavane
Nikhil Sonavane el 23 de Dic. de 2019
You can use a for loop to scan your data and neglect data whose standard deviation is zero for plotting error bars.

Categorías

Más información sobre Errorbars en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by