0
$\begingroup$

I want to label X and Y axes as multiples of some constant "a" like a,2a,3a etc. How to do that?

$\endgroup$
1
$\begingroup$
α = Pi/2;
β = 1/2;
Plot[Sin[2 x], {x, -1, 10}, 
 Ticks -> {
   Table[{n*α, Style[n "α", Red, Bold, FontSize -> 15]}, {n, -1, 6}],
   Table[{n*β, Style[n "β", Blue, Bold, FontSize -> 12]}, {n, -2, 2, 1}]
 }, PlotStyle -> Directive[Thick, Darker@Green, Dashed]]

ticks

Ticks are not shown at the origin because of this: https://wolfram.com/xid/0mrac6-sxo0e

$\endgroup$
0
$\begingroup$

Use Ticks. In the code below the first set is for the x-axis, and the second, y-axis. Note how I can use Style to change color, size, appearance, etc.

Not sure why if I specify a tick mark at origin such as {0,Style["t0",Purple,18} it's not shown on the plot. Maybe someone can fix this.

Plot[Sin[x], {x, 0, 2 Pi}, 
 Ticks -> {{{0.2, Style["t0", Purple, 18]}, {1, "t2"}, {2, 
     Style["t3", Red]}},
   {{1/4, Style["t5", Blue, 16]}, {1/2, 
     Style["t6", Black, Bold, 18]}}}]

enter image description here

$\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.