add vertical line on a plot for Confidence intervalle.

2 visualizzazioni (ultimi 30 giorni)
Hello, here is my situation,
I have a plot with lines, data points and I would like to add on the data point the confidence intervalle (vertical line with ymin and ymax max for each x values)
but when I try to plot, the CI on the data point, it is a horizontale line and not a verticale line for each x value.
Here is my code (simplified for easier explanation)
hold on
%model lines
p1=plot([1 2 3 4],[1 0.8 0.7 0.6],'g','LineWidth',1); % plot model line (I index the plot for legend latter)
p2=plot([1 2 3 4],[1 0.5 0.3 0.2],'b','LineWidth',1); % plot model line 2
%data points
plot([1 2 3 4],[1 0.75 0.65 0.5],'.','MarkerSize',30,'Color','g'); %plot data point
plot([1 2 3 4],[1 0.6 0.25 0.18],'.','MarkerSize',30,'Color','b'); %plot data point 2
%and plot the CI on data points, HERE IS THE ISSUE, I would like vertical line as errorbar with the specified ymin and ymax values
%but I got 2 lines instead of vertical lines for each x values
plot([[1 2 3 4] [1 2 3 4]],[[1 0.8 0.7 0.6] [1 0.7 0.6 0.45]],'g'); %should be error vertical line arround datapoint
plot([[1 2 3 4] [1 2 3 4]],[[1 0.65 0.3 0.2] [1 0.56 0.22 0.15]],'b'); %should be error vertical line arround datapoint
hold off
Thank you in advance for your answer
Kind regards,
Sylvain

Risposta accettata

Philippe Lebel
Philippe Lebel il 27 Nov 2019

Più risposte (0)

Tag

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by