2

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?

Vaggelis_Z
  • 8,740
  • 6
  • 34
  • 79

1 Answers1

4
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

eldo
  • 67,911
  • 5
  • 60
  • 168