2
$\begingroup$

This question already has an answer here:

When I set

Plot[Sin[x], {x, -2, -1}, Frame -> True, Axes -> False, 
    FrameTicks -> {{Automatic, Automatic}, {Range[-2, -1, 0.2], 
    Automatic}}]

I get on the x-axes {-2., -1.8, -1.6, -1.4, -1.2, -1.}. It seems that somehow function N is not recognized inside Range. How can I get {-2.00, -1.80, -1.60, -1.40, -1.20, -1.00}, so as every number to has two decimal digits?

$\endgroup$

marked as duplicate by C. E., Teake Nutma, Öskå, ubpdqn, m_goldberg Sep 28 '14 at 10:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4
$\begingroup$
PaddedForm[Range[-2, -1, 0.2], {3, 2}]

enter image description here

Plot[Sin[x], {x, -2, -1},
 Frame -> True,
 Axes -> False,
 FrameTicks -> {{Automatic, Automatic},{Transpose[{#, Map[PaddedForm[#, {3, 2}] &, #]}] &
     [Range[-2, -1, 0.2]], Automatic}}]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ As standalone it works but I need Range inside FrameTicks and PaddedForm is not compatible there. See the Edit. $\endgroup$ – Vaggelis_Z Sep 28 '14 at 8:14
  • $\begingroup$ @Vaggelis_Z See update $\endgroup$ – eldo Sep 28 '14 at 8:28
  • $\begingroup$ Now everything is OK. Many thanks! $\endgroup$ – Vaggelis_Z Sep 28 '14 at 8:43

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