I have a series of data and Ive ploted them by mathematica.how can I change the x-axis scale?for example instead of "x" being between 0-300, I want to plot my data between 0-2 scale. this is my code:

data = Import["Desktop/kmc final result.txt", "List"];
bb = SmoothKernelDistribution[data];
cc = SmoothKernelDistribution[data];
h[y_] = ((1/207) PDF[bb, y])*(PDF[cc, y]);
time = 100;
J[y_] := -1/time Log[h[y]];
plt1 = Plot[J[y], {y, 0, 300}, Frame -> True, 
  PlotStyle -> {Blue, PointSize[0.004]}, PlotRange -> All]
  • $\begingroup$ Though this is fairly simple issue it is always good practice to provide some way to access your data or to generate some appropriate data for the problem so that we have something to work with. $\endgroup$ – Andy Ross Sep 5 '14 at 0:15

Use DataRange:

ListLinePlot[Range[100], DataRange -> {0, 2}]

enter image description here

| improve this answer | |
  • $\begingroup$ I can't listlineplot my result!There would be some errors. $\endgroup$ – sara kaviani Sep 5 '14 at 5:00

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.