How to change the order of graphs using errorbar

1 visualizzazione (ultimi 30 giorni)
Hello,
I am trying to plot some graphs using errorbar.
Here is the part of the code and the result
quant = 1.68;
linewidth = 0.5;
alp = 0.2;
cutoff = 0.06; %0.1
coefficients1 = xlsread('data1.xlsx',specification,'C4:K4');
ses1 = xlsread('data1.xlsx',specification,'C5:K5');
coefficients2 = xlsread('data2.xlsx',specification,'C4:K4');
ses2 = xlsread('data2.xlsx',specification,'C5:K5');
coefficients3 = xlsread('data3.xlsx',specification,'C4:K4');
ses3 = xlsread('data3.xlsx',specification,'C5:K5');
horizon1 = xlsread('data1.xlsx',specification,'C2:K2');
horizon2 = horizon1 - 0.2*ones(1,length(horizon1));
horizon3 = horizon1 + 0.2*ones(1,length(horizon1));
errorbar(horizon1(h_to_plot),coefficients1(h_to_plot),quant*ses1(h_to_plot),'o','Linewidth',1.5)
hold on
errorbar(horizon2(h_to_plot),coefficients2(h_to_plot),quant*ses2(h_to_plot),'o','Linewidth',1.5)
hold on
errorbar(horizon3(h_to_plot),coefficients3(h_to_plot),quant*ses3(h_to_plot),'o','Linewidth',1.5)
line([-4,7],[0,0],'Color',black,'LineStyle','-')
hold off
legend('Baseline','1 lag, 1 lead','2 lags, 2 leads','location','southwest')
I wanted to put coefficients1 first and then 2 and 3.
But when I plot the graphs it starts with coefficients2 then 1 and 3.
How can I change this?
Thank you.

Risposta accettata

Walter Roberson
Walter Roberson il 3 Set 2021
Modificato: Walter Roberson il 3 Set 2021
pos1 = xlsread('data1.xlsx',specification,'C2:K2');
horizon1 = pos1 - 0.2*ones(1,length(pos1));
horizon2 = pos1;
horizon3 = pos1 + 0.2*ones(1,length(pos1));

Più risposte (0)

Categorie

Scopri di più su Errorbars in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by