plot errorbars on graph for selected points

4 views (last 30 days)
Mandy de Graaf
Mandy de Graaf on 6 Nov 2019
Answered: Nikhil Sonavane on 23 Dec 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
plot(C_av_smooth1,"LineWidth", 1)
% list of zeros as long as the amount of data points
for i=1:length(stdtest)
for j=1:length(bar_points)
if i==bar_points(j)
% plot graph with errorbars on desired place

Answers (1)

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


Community Treasure Hunt

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

Start Hunting!