2
Plot[x, {x, -1, 1}, Frame -> True, ImageSize -> 300, AspectRatio -> 1,
  LabelStyle -> {FontFamily -> "LM Roman 12", Black, FontSize -> 26}]    

enter image description here

How can I make space the same?

MMA13
  • 4,664
  • 3
  • 15
  • 21

1 Answers1

2

This is not an answer but rather an explanation what the cause of the problem is and why I think it can be regarded as a bug in styling of text.

As can be seen on the image bellow after adding Background -> Red we can see that spacing above and bellow of tick labels are added in the plot however when the same style is used on ordinary text/string the spacing above and below are 0 so therefore I take it as a bug.

Plot[x, {x, -1, 1}, Frame -> True, ImageSize -> 400, AspectRatio -> 1,
  LabelStyle -> {FontFamily -> "LM Roman 12", Black, FontSize -> 20, 
   Background -> Red}]

Style["-1.0", {FontFamily -> "LM Roman 12", Black, FontSize -> 20, Background -> Red}]

enter image description here

azerbajdzan
  • 15,863
  • 1
  • 16
  • 48
  • 1
    The extra vertical space is from the internal Inset, which your second example does not include. Here is a more accurate example of what is going on... Graphics[{Style[Inset@"-1.0", {FontFamily -> "LM Roman 12", Black, FontSize -> 20, Background -> Red}]}] It could be a bug, it might not. Hard for me to say without spending more time researching this. – ihojnicki Nov 15 '22 at 14:04