# Specify values for X-axis and Y-axis ticks and control their format

I have following problem:

I want to set the values for the X-and Y axis by myself, but the values (e.g. 0.800) are not plotted as I defined them (see image 0,8), mathematica removes the zeros.

Data = {{58.771, 0.792}, {53.532, 0.801}, {48.083, 0.795}, {57.343,0.794524}};
AxisY = {0.795, 0.800};
AxisX = {48, 53, 58};
ShowLegend[
Show[
{ListPlot[Data]},
Frame -> {True, True, False, False},
FrameTicks -> {{AxisY, Automatic}, {AxisX, Automatic}}
],
{{{Graphics[{Blue, Disk[{0, 0}, 1]}], "ABC"}}}
] I tried to solve this problem with NumberForm, but that does't work, the Y-axis disappears. SetPrecision doesn't work in my case, because I don't want to set total positions, I want to set positions after decimal point. Have someone an idea to solve this problem with an easy way?

ShowLegend[
Show[
{ListPlot[Data]},
Frame -> {True, True, False, False},
FrameTicks -> {{NumberForm[#, {4, 2}] &@{Axisy}, Automatic}, {Axisx,Automatic}}
],
{{{Graphics[{Blue, Disk[{0, 0}, 1]}], "ABC"}}}
]

• Which version are you using? – Nasser Sep 8 '13 at 12:42
• I am using Mathematica 9.0 – Jacccy Sep 8 '13 at 12:59
• Your way will not work because NumberForm is not a Number. But if you take a closer look at Details & Options for Ticks you will see that the fast fix would be to put there {#, NumberForm[#, {4, 3}]} & /@ AxisY. – Kuba Sep 8 '13 at 13:38
• Oh man, thank you a lot!! – Jacccy Sep 8 '13 at 14:08

You can force these ticks as follows

Needs["PlotLegends"];
ticksy[min_, max_] := {{0.795, "0.795"}, {0.800, "0.800"}};
ticksx[min_, max_] := {{48, "48"}, {53, "53"}, {58, "58"}};
Data = {{58.771, 0.792}, {53.532, 0.801}, {48.083, 0.795}, {57.343,0.794524}};
ShowLegend[Show[{ListPlot[Data]}, Frame -> {True, True, False, False},
FrameTicks -> {{ticksy, Automatic}, {ticksx,
Automatic}}], {{{Graphics[{Blue, Disk[{0, 0}, 1]}], "ABC"}}}] or can use a formatting function instead of string like this

Needs["PlotLegends"];
padIt2[v_, f_] := AccountingForm[v, f, NumberSigns -> {"", ""}, • You can also use NumberForm as the second argument (second list position or w/e) instead of string. – C. E. Sep 8 '13 at 13:00