Extra space in axis titles

Dear experts,

My question in pyroot, I don’t know if it is the right place to ask.

I’m using pyroot to produce some plots, When I write the axes titles, I have extra spaces as shown in the attached figure1. The x axis has space between cm and 2 , the y-axis has extra space between bracket [ and micro. Here is what I wrote to define the axes titles using latex.

grI.GetXaxis().SetTitle("Integrated charge  [mC/cm^{2}]")
grI.GetYaxis().SetTitle("Current density [#muA/cm^{2}]")

where grI is a graph.

I tried to remove the extra spaces with some characters but another problem appear that the font style changed and micro symbol in y-axis don’t appear probably, shown in attached figure2. Here what I used:

grI.GetXaxis().SetTitle("Integrated\,charge\, [mC/cm^{\,\!2}]")
grI.GetYaxis().SetTitle("Current\, density \, [uA/cm^{\!2}]")

Do you have any suggestions to remove those extra space without changing the font style.


Please read tips for efficient and successful posting and posting code

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


I do not wee the problem with C++:

root [0] TLatex t(.5,.5,"Integrated charge  [mC/cm^{2}]")
(TLatex &) Name:  Title: Integrated charge  [mC/cm^{2}]
root [1] t.Draw()

Screenshot 2020-04-28 at 09.18.10

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