Problem with SAME option TGraph

Hi guys,

I have a problem with the SAME option of TGraph. I wrote:
"TCanvas *c1 = new TCanvas(“c1”, “c1”,10,31,717,526);

g->SetTitle(“Uncoated Silica”);
g->GetXaxis()->SetTitle(“Wavelength (nm)”);


g1->SetMarkerColor(kMagenta +4);

but only the second graph is plotted. Any idea? Note that the two graphs have different ranges on the Y axis.

Please read tips for efficient and successful posting and posting code

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


Also, note that the option “SAME” does not exist for TGraph.

@couet Actually, only the "M" option does not exist ("S", "A", and "E" are there).
I’ve seen many times that people use "SAME" where it does not belong (not just for graphs, but for other “primitives”, too). Maybe adding a “protection” in all Draw methods would be a good idea so that this particular string is quietly “forgotten” (when not needed).

It is already the case:

I mean, not only for graphs but for all other “primitives”, too.

TGraph is the most obvious because it is as the “same level” as histograms.
I am not sure we want that test for TText TBox TLine etc …

Well, that’s what I mean by “other primitives” (texts, legends, graphics primitives, and so on). I saw quite a few examples of this “misbehavior”.

I also know that some people (mis)use "SAME " such as it is available everywhere. It is only available for histograms and documented only there. Do you we really want to also document the options which are NOT available ? Do we want to slow down the very basic graphics primitives with an extra test on an option they do not have ? We do that test for graphs because it takes longer to draw anyway and the error was super frequent (and, as I said, histograms and graphs are the same kind of very high level graphics objects).

So, maybe another idea … if some “primitive” is sensitive to any of “S”, “A”, “M”, or “E”, then it should be protected against “SAME”.

Makes more sense…

I just had a quick look and to not saw any obvious candidates except, maybe, TGaxis.

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