Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question about adjusting the number of horizontal tick marks on a 2D plot.


f[x_] := 4*Sin[4*x]

Plot[{f[x]}, {x, -10, 10}, Ticks -> {Table[Pi n, {n, -5, 5}]}]

Gives the following plot:

enter image description here

How would I go about adding more ticks so I could change the range (in terms of pi) to fractional values of pi?

Say -pi/10 to pi/10 increments of pi/2....or pi/4?

The "Plot" command I am using is one I found from the help because I couldn't figure out how to make the ticks in terms of pi. I'm still learning some of the basics, but I'm quite stuck on changing the # of ticks.

Anyone have some ideas please?


share|improve this question
Take a look at Table[Pi n, {n, -5, 5}]. What does it output? What do you need to change to have multiples of Pi/2? – Szabolcs Feb 11 '14 at 17:40
To be honest I don't know what it does. I thought it merely set the number of labels that show on the 'x-axis', but per your post, which I just did not think of, changing those values to -5/2 and 5/2 gives what I'm looking for. Is there an easier ay to accomplish this however? – fiz Feb 11 '14 at 17:55
Then please start by reading up on Table and understanding what it does and how to use it. Use the documentation. Table is one of the most fundamental constructs in Mathematica and it is quite easy to understand. – Szabolcs Feb 11 '14 at 17:58
Yes, for sure. Up to now it had not come up, but I will look the documentation. Now, your having said that, I asked if there were any other ways to accomplish this task. Is this just one way of doing it, or the easiest? Insight? – fiz Feb 11 '14 at 18:10
Yes, it's the easiest. For more complex tick arrangements the CustomTicks package is easier, but not for simple ones like what you described. – Szabolcs Feb 11 '14 at 18:12
up vote 3 down vote accepted
Plot[4*Sin[4*x], {x, -10, 10}, 
Ticks -> {Table[Pi/2 n, {n, -15, 15}], Automatic}]

enter image description here

share|improve this answer
Thank you santosh. I see what you have done. I thought I tried that and got an error, but I like your method. I will look at it again. – fiz Feb 11 '14 at 19:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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