1
$\begingroup$

When the data

a = Table[Sin[x], {x, 1, 20, 0.1}];
ListPlot[0.1 *a]

is plotted, one finds that the range of x-axes is labeled as 0 to 200:

enter image description here

How can one reset the calibration so that the axis shows the range only up to 20?

$\endgroup$
1
  • 1
    $\begingroup$ You have 200 data points, and so ListPlot gives you that axis. You want to have 2D points: ListPlot[Transpose[{Range[1, 20, .1], a}]]. This gives you a list of {x, y} pairs instead of a single list of values. $\endgroup$
    – Carl Lange
    Commented May 9, 2019 at 19:39

1 Answer 1

2
$\begingroup$

You can use the DataRange option:

ListPlot[0.1 a, DataRange -> {1, 20}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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