Switching style functions

Hi,

I made a few functions to be able to change the drawing style on the fly. Each of these functions contain a series of command like:

gStyle->SetFrameFillColor(1); gStyle->SetFrameLineColor(0); gStyle->SetPadColor(1); gStyle->SetLabelColor(0,"XYZ"); gStyle->SetAxisColor(0,"XYZ"); ...

When I call one of these functions before drawing anything (say an histogram) it works. But if I call one of these functions after drawing the histogram, only a few attributes are changed. For example, gStyle->SetAxisColor() has no effect. Redrawing the histogram or updating the Pad does not help.
Any idea?

Usually you set the Style and then Draw.
It could be that some attributes are not working when you do it after.
Do you have the list ?

may be gROOT->ForceStyle(1); might help …

Hi,

I’m re-opening this post because I’m still having problem controlling the style of my plots. I prepared an example of my problem:

TGraph g(10000); for (int i=0; i<10000; ++i) g.SetPoint(i, gRandom->Rndm(), gRandom->Rndm()); g.SetMarkerStyle(20); g->Draw("AP"); gPad->UseCurrentStyle();

The last command cancels the marker style that I set. My question is what default setting makes that happen? In other words, which function (“gStyle->???”) should I use so that the marker attributes are not changed with gPad->UseCurrentStyle().
Thank you

What about doing:

gPad->UseCurrentStyle();
TGraph g(10000);
for (int i=0; i<10000; ++i) g.SetPoint(i, gRandom->Rndm(), gRandom->Rndm());
g.SetMarkerStyle(20);
g.Draw("AP");

This is not what I want to do… Let me give more details:

Once a Graph is plotted, I’d like to be able to switch from one style to another one using TStyle functions. for example I want to change the Pad color from green to yellow to red… For this I need to use gPad->UseCurrentStyle() everytime I want to move to another style.
When I do this, I also modify the graph attributes (marker size…) and I don’t want that.

So how can use UseCurrentStyle() after plotting the graph without affecting the graph style? Is there a TStyle function to fix the graph atttributes?

thank you