1
$\begingroup$

I have asked this question previously and I didn’t get a satisfactory answer. Then I posted a comment and didn’t receive any replies. So I thought to elaborate my issue. I have:

Plot[{Sin[t]^2}, {t, 0, 3000}, Background -> White]

Then I get cc

Plot[{Sin[t]^2}, {t, 0, 3000}, Background -> White, Ticks -> {{#, 1/902*Pi/4 #} & /@ FindDivisions[{0., 3000}, 6] // N, Automatic}]

Then I get: bhj

When you compare two figures, I rescaled the x axis in second figure without altering y axis with new ticks. But actually when you look you can see that second plot can be written in terms of Pi multiples. But I don’t know how. Any way?

$\endgroup$
7
  • $\begingroup$ Just remove // N? $\endgroup$
    – kglr
    May 31, 2021 at 11:30
  • $\begingroup$ @kglr That’s great. But it not as standard notation as 0,Pi/4,Pi/2,3pi/4 , Pi! $\endgroup$
    – Jasmine
    May 31, 2021 at 11:48
  • $\begingroup$ does Ticks -> {Transpose[{Rescale[#, {0, Pi}, {0, 3000}], #} &@ FindDivisions[{0, Pi, Pi/16}, 8, Method -> {}]], Automatic} give what you need? $\endgroup$
    – kglr
    May 31, 2021 at 11:57
  • $\begingroup$ @kglr It’s working. But I am not sure where did you incorporate 1/902*Pi/4. $\endgroup$
    – Jasmine
    May 31, 2021 at 12:06
  • 1
    $\begingroup$ if you want the horizontal range to go from 0 to 3000 Pi /902/4 (as x goes from 0 to 3000) try Ticks -> {Transpose[{Rescale[#, {0, 3000 Pi/902/4}, {0, 3000}], #} &@ FindDivisions[{0, 3000 Pi/902/4, Pi/16}, 8, Method -> {}]], Automatic} $\endgroup$
    – kglr
    May 31, 2021 at 12:29

1 Answer 1

1
$\begingroup$
xticks = Transpose[{4 # 902 / Pi, #}] &@
  FindDivisions[{0, 3000 Pi/902/4, Pi/16}, 8, Method -> {}]

Plot[Sin[t]^2, {t, 0, 3000}, Ticks -> {xtikcs, Automatic}]

enter image description here

$\endgroup$
0

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.