1

When using Plot[], is it possible to have axes labeled with multiples of $\tau=2\pi$, not $\pi$?

This question is not a duplicate of (Axes labels as multiples of $\pi$). Replacing [Pi] with [Tau] doesn't help (when you define $\tau=2\pi$), as Mathematica seems to be hard-wired to label the axis with multiples of $\pi$. I want the letter $\tau$ to be rendered, not the number $2$ and the letter $\pi$. Is there a solution?

Vestoo
  • 167
  • 4

1 Answers1

3

This does not sound right to me:

"... as Mathematica seems to be hard-wired to label the axis with multiples of "

You should always share code of what you have tried so people can find and explain your errors to you. Here is 2 different ways to approach labeling in your case:

Plot[Cos[x],{x,-5Pi,5Pi},Ticks->{Range[-6Pi,6Pi,2Pi],Automatic}]

enter image description here

Plot[Cos[x],{x,-5Pi,5Pi},Ticks->{Table[{2Pi n,n ""},{n,-3,3}],Automatic}]

enter image description here

As @BobHanlon kindly noticed in the comments, String around "" is

  1. a safety mechanism against "evaluating to numerical value" if was assigned a value

  2. a flexible construct to render more complex things for Ticks as Style can be applied, etc.

This is explained well in the doc page.

Vitaliy Kaurov
  • 73,078
  • 9
  • 204
  • 355
  • I tried using [Tau] (with a backslash at the front) but it didn't work. It seems that writing does the job. Thanks. – Vestoo Mar 26 '23 at 17:43
  • 3
    @Vestoo - if you have previously given \[Tau] a value, the symbol [Tau] will never appear in the output since its value will always be substituted. That is why the string must be used for it to appear. – Bob Hanlon Mar 26 '23 at 17:51