3
$\begingroup$

I'm trying to separate frame ticks from the vertical axes and so far I've found a solution to that end by adding the following command inside the "Plot" main command

FrameTicks -> {{{{0.2, "0.2 "}, {0.4, "0.4 "}, {0.6, "0.6 "}, {0.8, 
     "0.8 "}, {1, "1.0 "}, {1.2, "1.2 "}}, None}, {Automatic, None}}

Notice that there is a space after calling the tick's label i.e. "0.1_". My question is: How can I separate frame ticks from the vertical axes automatically, with out specifying all ticks and its labels?

$\endgroup$
1
  • 1
    $\begingroup$ Welcome to the Mathematica Stack Exchange. Kindly present a minimal working example; i.e., enough Mathematica code to replicate your problem. The code should be in copy-paste-able form so that respondents can experiment with it. The code snippet you have included so far does not evaluate. $\endgroup$
    – Syed
    Commented Apr 27, 2022 at 16:17

1 Answer 1

6
$\begingroup$
Plot[x, {x, 0, 1}, Frame -> True, 
 FrameTicks -> {{{#, 
       Framed[#, FrameMargins -> 17, FrameStyle -> None]} & /@ 
     Range[0, 1.2, 0.2], None}, {Automatic, None}}]

oneway

More examples for illustrative purposes

Table[Plot[x, {x, 0, 1}, Frame -> True, 
  FrameTicks -> {{{#, 
        Framed[#, FrameMargins -> position, FrameStyle -> None]} & /@ 
      Range[0, 1.2, 0.2], None}, {Automatic, None}}], {position, 0, 
  21}]

two

$\endgroup$
2
  • $\begingroup$ Thank you for the answer. $\endgroup$ Commented Apr 28, 2022 at 17:11
  • $\begingroup$ @JasonPeña you're very welcome. Glad I was able to help. Thanks for the accept! $\endgroup$
    – bmf
    Commented Apr 28, 2022 at 17:14

Your Answer

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

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