5
$\begingroup$

Plot

I want to use ms instead of s as the unit of x-axis. But frameticks seems not to work here as it cannot change the value of x-axis.

How to replace the number of x-axis 0.0001 with 1 or 0.1? Or just scale the x-axis?

$\endgroup$
2
  • $\begingroup$ Both of the answers below is working. Could I click accept to them both? Thank you guys. $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 2:25
  • $\begingroup$ However, I noticed that if we add "Frame -> True" in the program, they cannot work again. Do you have any idea to solve this? $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 2:34

2 Answers 2

7
$\begingroup$

Here is a way to do what you are asking.

Before

Plot[Sin[200 Pi t], {t, 0., .01}]

before

After

Plot[Sin[200 Pi t], {t, 0., .01},
  Ticks -> {{#, 1000 #} & /@ FindDivisions[{0., .01}, 5] // N, Automatic}]

after

Update

This update is in response to the comment made by drabus.

It's annoying but frame ticks must be specified somewhat differently from axis ticks. So if you are framing the plot, do it this way:

Plot[Sin[200 Pi t], {t, 0., .01},
  Frame -> True,
  FrameTicks ->
    {Automatic, {{#, 1000 #} & /@ FindDivisions[{0., .01}, 5] // N, Automatic}}]

framedenter image description here

$\endgroup$
10
  • $\begingroup$ However, I noticed that if we add "Frame -> True" in the program, they cannot work again. Do you have any idea to solve this? $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 2:34
  • $\begingroup$ Thanks very much. It is solved. $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 2:41
  • $\begingroup$ If you add a frame, then you need to control ticks with the FrameTicks option and drop the Ticks option. $\endgroup$
    – m_goldberg
    Mar 26, 2015 at 2:44
  • $\begingroup$ I noticed the ticks below x-axis are intergers but with a dot behind may lead mistake to readers. Can anybody remove the dots? $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 14:40
  • 1
    $\begingroup$ @m_goldberg I got it right. It has to be like this: Frame -> True, FrameTicks -> {{Automatic, None}, {{#, 1000 #} & /@ FindDivisions[{0., .01}, 5] // N, None}} $\endgroup$
    – drabus
    Jan 18, 2018 at 10:13
2
$\begingroup$
Plot[x^2, {x, .0001, .0005},
 Ticks -> {Table[{i, ToString[10000 i]}, {i, .0001, .0005, .0001}], 
   Automatic}
 ]
$\endgroup$
4
  • $\begingroup$ Thanks for you, too. Your answer help me a lot when I just want the frameticks downside the frame instead of ticks appear on both upside and downside. $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 2:52
  • $\begingroup$ I noticed the ticks below x-axis are intergers but with a dot behind may lead mistakes to readers. Do you know how to remove the dots? $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 15:09
  • $\begingroup$ @Chad Meng Sure: Ticks -> {Table[{i, Round[10000 i]}, {i, .0001, .0005, .0001}] $\endgroup$ Mar 26, 2015 at 15:37
  • $\begingroup$ Thanks a lot with your kindness. $\endgroup$
    – Chad Meng
    Mar 26, 2015 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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