2
$\begingroup$
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?

$\endgroup$
5
  • $\begingroup$ Try to play with the value of the option AspectRatio. I guess the intervals will be equal at the value 0.7 to 0.8. $\endgroup$ Nov 14, 2022 at 13:49
  • $\begingroup$ This is the y-tick measurement rotated and colored green and it fits perfectly inside the x-tick box. I would say it is an illusion. $\endgroup$
    – Syed
    Nov 14, 2022 at 13:52
  • $\begingroup$ @Syed what I meant is the space between ticks and frame?! I don't understand how that can be an illusion, or did u mean something else? $\endgroup$ Nov 14, 2022 at 13:54
  • $\begingroup$ @AlexeiBoulbitch, it seems that space is independent of AspectRatio $\endgroup$ Nov 14, 2022 at 13:56
  • $\begingroup$ Similar to 29505. $\endgroup$
    – Syed
    Nov 14, 2022 at 14:27

1 Answer 1

2
$\begingroup$

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

$\endgroup$
1
  • 1
    $\begingroup$ 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. $\endgroup$
    – ihojnicki
    Nov 15, 2022 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.