When working with histograms I can call the method TH1::SetOption to fix the default option when the histogram are drawn. I wonder which method I can use to achieve the same purpose when using TGraph/TGraphError objects. I tried this:
Thank you @couet, Is there any chance to implement SetOption on the TGraph Class? I’m not sure about how to implement your suggestion in this context (returning a pointer to a TGraph object). For instance Test.C (278 Bytes) produces a “Break Illegal construction message” I guess it is because I don’t have a TCanvas and I don’t want to create a canvas in the GetGraph function.
I believe the point here is to avoid drawing the graph. You would like to have a generator function that creates the graph and sets the default draw options.
Yes because calling Draw() without option means “use default option” . So if we do what you are looking for I am afraid some unwanted side effects may quickly show because the meaning of “not specifying the option” will change … So that change has to be checked carefully . May be you can open a Jira Ticket with it to not lose track ?
I think the default behavior should be looked closely to not break existing macros.
But surely something can be done … For instance if the default option set by SetDrawOption is not empty then we use it instead of the default option . I guess that should fulfil the requirement.