4

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, ...

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
chris
  • 49
  • 1
  • This is more than adequately explained in the documentation: ref/Ticks. – dwa Apr 05 '13 at 01:43
  • I'm sorry, but I can't find the solution in the documentation you mentioned... – chris Apr 05 '13 at 01: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 05 '13 at 02:16
  • I'll use Michael E2's way...thanks anyway – chris Apr 05 '13 at 02:49

1 Answers1

7

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

Michael E2
  • 235,386
  • 17
  • 334
  • 747