Multiple SetPaintTextFormat with 'text same' SOLVED

Hello,

I am trying to draw two TH2D and I would like to draw both
of them on the same canvas with the option ‘text’, but with
different formattings, e.g.

canvas.cd()
pad_master.Draw('axis')
ROOT.gStyle.SetPaintTextFormat(".2f")
h1.Draw('text same')
ROOT.gStyle.SetPaintTextFormat(".0f")
h2.Draw('text same')

However, when I change the text format for h2, h1 also gets updated.
Is there a way to prevent this behaviour?

Thank you,

Davide

That’s an expected behaviour. gStyle settings are global.

Thank you, Olivier.
I added a loop and drawn the text with the desired formatting “by hand”.

Cheers,

Davide