1
$\begingroup$

Sorry if the title is wordy. Basically, what I am asking would probably be easier if I just use an example.

Say I wanted to plot $f(x) = A\sin(x)$ and have the graph come up showing the sine function with the ticks on the $y$-axis being half-integer multiples of $A$. What I have been doing for my homework assignments is just plotting $f(x)=\sin(x)$ and then turning off the ticks and manually adding my own ticks. It would be really cool if Mathematica could do this for me.

$\endgroup$
  • $\begingroup$ I think what you ended up doing is perhaps the best way... it isn't all that complicated either. $\endgroup$ – rm -rf Nov 13 '13 at 20:44
  • $\begingroup$ What do you mean by manually? Are you using a custom tick specification as in this documentation example?: Plot[Cos[x], {x, 0, 10}, Ticks -> {{{Pi, 180 \[Degree], {0, .5}, Red}, {2 Pi, 360 \[Degree], {.5, 0}, Thick}, {3 Pi, 540 \[Degree], {0, .5}, Directive[Red, Dashed]}}, {-1, 1}}] $\endgroup$ – Mr.Wizard Nov 13 '13 at 20:48
1
$\begingroup$

See Ticks in the documentation:

Plot[Sin[x], {x, 0, 2 Pi}, 
 Ticks -> {Automatic, Table[{y, Row[{y, " A"}]}, {y, -1, 1, 1/2}]}]

Mathematica graphics

Unless you meant A to be a numeric value:

With[{A = Sqrt[2]},
 Plot[A Sin[x], {x, 0, 2 Pi}, 
  Ticks -> {Automatic, Range[-1, 1, 1/2] A}]
 ]

Mathematica graphics

(OK, A = Sqrt[2] is a bit random. :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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