Call TMultiGraph in a macro

Hello Root family,

I want to call a TMultiGraph that I have in a root file, but when I run the macro it does not plot anything, just the white Canvas

   TFile *fileD = TFile::Open("outdiffractive_1.root");
   TMultiGraph *grD1 = (TMultiGraph*)fileD->Get("finv2err;1");
   TCanvas *canvas1 = new TCanvas("canvas1","canvas1", 1000,1000);
   grD1->Draw();
   canvas1->Draw();

this is a ss of the objects in the root file

image

Someone know how to solve this?


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


grD1->Draw("AP");

Thank you! @Wile_E_Coyote

Another question is if you know how to change the color of the markers in a TMultiGraph, the normal command of SetMarkerColor is not working
"
error: no member named ‘SetMarkerColor’ in ‘TMultiGraph’
"

Every graph has its own colors, so you need to loop over them and change the colors for each one.

How can I loop over each graph?

TMultiGraph::GetListOfGraphs

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.