Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to know how can I make a real-valued plot tick pad with a zero to the right of the decimal point on integer values. This is what I have:

 Plot[0, {x, 8.5, 9.3}, 
    PlotRange -> {{7.9, 11}, {0, 0}}, 
    Axes -> {True, False}, 
    Ticks -> {Range[0.0, 11.0, N[0.2, 4]]}, 
    PlotStyle -> {Red, Thickness[0.02]}]

The ticks are displayed as 8., 8.2, 8.4, ..., 9., ...; I want to see them displayed as 8.0, 8.2, 8.4, ..., 9.0, ...

share|improve this question
    
This is more than adequately explained in the documentation: ref/Ticks. –  dwa Apr 5 '13 at 1:43
    
I'm sorry, but I can't find the solution in the documentation you mentioned... –  chris Apr 5 '13 at 1:53
    
Assuming 9.0.1 ....Open Function Navigator. Type "ticks" in the search bar. Scroll down to where it says "Scope" and click the triangle. The first item is "Ticks position and labelling". The third entry is titled "Draw ticks at specified positions". –  dwa Apr 5 '13 at 2:16
    
I'll use Michael E2's way...thanks anyway –  chris Apr 5 '13 at 2:49

1 Answer 1

NumberForm can be used to control the number of decimal places.

Plot[0, {x, 8.5, 9.3}, PlotRange -> {{7.9, 11}, {0, 0}}, 
 Axes -> {True, False}, 
 Ticks -> {({#, NumberForm[N@#, {Infinity, 1}]} & /@ 
     Range[0, 11, 1/5]), {}}, PlotStyle -> {Red, Thickness[0.02]}]

Output of Plot

share|improve this answer

Your Answer

 
discard

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.