# Axes labels as multiples of $\pi$

I have a list as containing seven elements:

list={0,
Cos[t/4] + Cos[(3 t)/4] + I (Sin[t/4] -  Sin[(3t)/4]),
0,
-Cos[t/4] - Cos[(3 t)/4] + I (Sin[t/4] +  Sin[(3t)/4]),
0,
+Cos[5t/4] - Cos[(3 t)/4] + I (Sin[5t/4] +  Sin[(3t)/4]),
Cos[5t/4] - Cos[(3 t)/4] + I (Sin[5t/4] -  Sin[(3t)/4])
}


I want to plot Abs[list[[2]]*list[[4]]], Abs[list[[2]]*list[[6]]], Abs[list[[2]]*list[[7]]] from {t,0,8 pi} just in one plot.

I used

Plot[{Abs[list2[[2]]*list2[[3]]], Abs[list2[[2]]*list2[[5]]],
Abs[list2[[2]]*list2[[9]]]}, {t, 0, 8 π}
]


but the problem is: my favorite situation is scaling the 'x' axes with multiple of pi, for example: pi/6, pi/4, pi/3, pi/2, 5pi/6, 3pi/4, 2pi/3, pi and ... 8 pi.

However, they are not in the similar interval (Pi/6-0 != pi/4-pi/6) and I want to show them with the symbol of pi (Esc pi Esc) on the x axes. Has anyone had an experience with this?

Try this:

    list = {0, Cos[t/4] + Cos[(3 t)/4] + I (Sin[t/4] - Sin[(3 t)/4]),
0, -Cos[t/4] - Cos[(3 t)/4] + I (Sin[t/4] + Sin[(3 t)/4]),
0, +Cos[5 t/4] - Cos[(3 t)/4] + I (Sin[5 t/4] + Sin[(3 t)/4]),
Cos[5 t/4] - Cos[(3 t)/4] + I (Sin[5 t/4] - Sin[(3 t)/4])};

Plot[Abs[list[[2]]*list[[4]]], {t, 0, 8 \[Pi]},
Ticks -> {{\[Pi]/6, 3 \[Pi]/4, 2 \[Pi], 4 \[Pi], 6 \[Pi], 8 \[Pi]},
Automatic}]


yielding

Have fun!

I found the solution I was looking for at https://stackoverflow.com/questions/8936579/labeling-a-plot-in-increments-of-pi.

example:

Plot[Sin[x], {x, -Pi, Pi}, Ticks -> {Range[-Pi, Pi, Pi/4], Automatic}]


Credits go to Nasser.

• "Credits go to Nasser": you get a +1 nevertheless for sharing this elegant solution with us here as well. :-) Feb 15, 2019 at 16:58

You could join lists of tick positions:

ticks = Union @@ Table[Range[0, 8 Pi, dt], {dt, {Pi/6, Pi/4}}];


For such a long interval, this does not produce legible ticks:

Plot[{
Abs[list2[[2]]*list2[[3]]],
Abs[list2[[2]]*list2[[5]]],
Abs[list2[[2]]*list2[[7]]]},
{t, 0, 8 π},
Ticks -> {ticks, Automatic}, PlotRange -> All]


You could pick a set of larger values for dt in the Table above. You could also use Solve to mark interesting features, but in this case, the numbers make unwieldy tick labels:

ticks = t /. Solve[0 < t <= 8 Pi && list2[[2]]*list2[[7]] == 0, t];
(*
{4 π, 8 π, -8 ArcTan[1 - Sqrt[2]],
8 π + 8 ArcTan[1 - Sqrt[2]], 8 π - 8 ArcTan[1 + Sqrt[2]],
8 ArcTan[1 + Sqrt[2]]}
*)

• besides thanks to your post, as I said to Alexei, I can't use of this numbers when I use Frame-> True, I mean when I have Frame for my plot I can't show numbers. But I need necessary to have frame!! Sep 14, 2015 at 12:14
• @Ackaran Ticks are for Axes, FrameTicks are for Frame. Look them up in the docs. They basically work the same way. BTW, why is there nothing about Frame in your question?? Indeed you explicitly mention axes! Sep 14, 2015 at 12:31
• You are right, I had checked FrameTicks, but because I did not use correct command for that I was not able to see them. But based on your comment, I just used and paid more attention to have desired case, it is which I wanted, Thanks a bunch. Sep 14, 2015 at 12:44
• @Ackaran You're welcome. Sep 14, 2015 at 12:45