Marking a graph in steps of pi

Possible duplicate:
How to choose the numbers shown on the axes of the graph in mathematics?

How can I create a graph of a function in which the scale will show things in terms of pi (or any other constant, for that matter)?

i.e. under ticks along the axis 0, pi / 2, pi / 4, etc. will be displayed.

+6
source share
2 answers

Example:

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

enter image description here

+8
source

What you mean by labeling and scaling is indeed a Ticks option for Plot. You can specify them manually or use the table to create the values ​​you want to use.

 Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi}, Ticks -> {Table[x, {x, 0, 2 Pi, Pi/4}], {-1, 0, 1}}] 

enter image description here

+4
source

Source: https://habr.com/ru/post/906446/


All Articles