In ROOT, the axes are always set at the border of the pad, as a bounding box. This is fine for most cases, but in one case I would like to have the axes centered on the “0” value and not in the border, like the attached example.
{
TCanvas *c = new TCanvas("c","c",0,0,500,500);
c->Draw();
c->Range(-10,-10,10,10);
TF1 *f = new TF1("f","x*x",-10,10);
f->Draw("same");
ox = new TGaxis(-10,0,10,0,-10,10,510,"");
ox->Draw();
oy = new TGaxis(0,-10,0,10,-10,10,510,"");
oy->Draw();
}
Thanks, this works, but it’s not very convenient: many options like SetGridx() etc. are disabled, and it is not so simple to manipulate the Canvas. Isn’t there a way to create a style such that I would call it via something like:
I was just an idea … now to make it look nicer we should play with the TGaxis options. The style cannot act on this kind of plot, because it is done using low level functionalities outside the style scope. Do you want me to work a bit more on the macro to make it look nicer or are you willing to do it yourself ?