plot errorbars on graph for selected points
1 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
回答(1 个)
Nikhil Sonavane
2019-12-23
You can use a for loop to scan your data and neglect data whose standard deviation is zero for plotting error bars.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Errorbars 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!