1
$\begingroup$

This question already has an answer here:

I am plotting a list using the following command:

ListPlot[Table[f[x], {x, 0.01, 1.5, 0.015}]]

In the plot, the x-axis ranges from 0 to 100, which is the total number of points. How can I change the x-axis scale as to show the range of the variable x instead?

$\endgroup$

marked as duplicate by Mr.Wizard plotting Feb 25 '17 at 21:34

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.

2
$\begingroup$

You need the option DataRange:

f = Sin;
ListPlot[Table[f[x], {x, 0.01, 1.5, 0.015}], DataRange -> {0.01, 1.5}]

Mathematica graphics

Alternatively, as suggested in a comment by @tchronis,

ListPlot[Table[{x, f[x]}, {x, 0.01, 1.5, 0.015}]] 
$\endgroup$
  • 1
    $\begingroup$ ListPlot[Table[{x, f[x]}, {x, 0.01, 1.5, 0.015}]] will work too. This can help you work with parametric function too like ListPlot[Table[{x[t], y[t]}, {t, 0.01, 1.5, 0.015}]] $\endgroup$ – tchronis Feb 25 '17 at 20:55

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