Plotting dx error bars intead of dy error bars

Dear Colleagues,
Thanks for all the previous questions. This one relates to how to plot an n-tuple with error bars. I borrowed from this earlier post to write the attached code. The key lines are these:

     Long64_t N =  ndepth_dose_4MVV_all_8cm->Draw("B:RMD_sub:RMD_sub_error","","goff"); 
     TGraphErrors *gr1 = new TGraphErrors (N,ndepth_dose_4MVV_all_8cm->GetV1(),ndepth_dose_4MVV_all_8cm->GetV2(),ndepth_dose_4MVV_all_8cm->GetV3()); 

The problem is that it is giving me error bars on ‘dx’ when I would like error bars ‘dy’. I think it should be easy to correct, though I can’t quite see the solution myself. Any help would be appreciated.

RLdedao_8cm_error1.C (2.3 KB) Varian_4MV_Total_8cm.root (16.5 KB)

Long64_t N = ndepth_dose_4MVV_all_8cm->Draw("B:RMD_sub:RMD_sub_error", "", "goff"); 
TGraphErrors *gr1 = new TGraphErrors(N, ndepth_dose_4MVV_all_8cm->GetV1(), ndepth_dose_4MVV_all_8cm->GetV2(), ((Double_t*)0), ndepth_dose_4MVV_all_8cm->GetV3()); 

Thanks @Wile_E_Coyote, your code worked.