4
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ This is more than adequately explained in the documentation: ref/Ticks. $\endgroup$ Commented Apr 5, 2013 at 1:43
  • $\begingroup$ I'm sorry, but I can't find the solution in the documentation you mentioned... $\endgroup$ Commented Apr 5, 2013 at 1:53
  • $\begingroup$ 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". $\endgroup$ Commented Apr 5, 2013 at 2:16

1 Answer 1

7
$\begingroup$

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

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.