1
$\begingroup$

I have a list of data,

data={1.61,37.23,61.83,73.14,79.36,83.88,94.06,96.60,97.73,98.86,99.43,100};

aa=ListPlot[data]

which looks like the following,

enter image description here

is there any way that the plot shape remain the same but start from 2 and end at 49 (the x axis remain the same as well 0 to 12, so change in the y axis values from 2 to 49?

I am trying to find a way from interpolation but I am not sure though,

and we can interpolate the function as,

ListInterpolation[data, InterpolationOrder -> 2]

that looks like the following,

enter image description here

$\endgroup$
3
  • $\begingroup$ Have you tried PlotRange? $\endgroup$
    – bmf
    Mar 7 at 9:08
  • $\begingroup$ PlotRange won't work. $\endgroup$
    – a019
    Mar 7 at 9:43
  • 2
    $\begingroup$ I don't understand, really, why you want to change the apparent data values in your plot, but this does what you say you want: ListPlot[Rescale[data, MinMax@data, {2, 49}]] $\endgroup$
    – Michael E2
    Mar 7 at 16:01

2 Answers 2

2
$\begingroup$

I hope I understand your question correctly. You want to rescale the y data. This can be done with the function "Rescale". We first need to determine the max and min of the original data:

{mi, ma} = MinMax[data]

Then we can rescale the data using "Rescale":

data1 = Rescale[data, {mi, ma}, {2, 49}];
ListPlot[data1]

enter image description here

$\endgroup$
2
$\begingroup$

You can choose the domain on the second argument of ListInterpolation:

f = With[{xs = Range[Length[data]]},
      ListInterpolation[data, {Rescale[xs, MinMax[xs], {2, 49}]}]];
Plot[f[x], {x, 2, 49}]

$\endgroup$
1
  • $\begingroup$ I want to change the values of y from y 49 to 2 with same plotshape, not the x range. I think, my question is not clear enoguh. I'll eidt. $\endgroup$
    – a019
    Mar 7 at 9:52

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.