Re: How to rebase a List of Values?

• To: mathgroup at smc.vnet.net
• Subject: [mg6908] Re: [mg6852] How to rebase a List of Values?
• From: Xah Lee <xah at best.com>
• Date: Fri, 25 Apr 1997 14:00:38 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

At 2:44 AM -0400 4/24/97, Patrick Kopitz wrote:
>Say I have one List containing values from 1000 to 5000 and a second from
>30 to 70.
>I want to rebase those lists at 100 so the two will show on a graphic with
>the same scale.

You can rescale your data using this formula (dataPoint-min)/(max-min).
This will put all dataPoint between 0 and 1. (Did I misunderstand the
problem?)

You can implement it in mma using a pure function and Map. Example:

myList1= Table[Random[Integer,{1000,5000}], 100];
myList2= Table[Random[Integer,{30,70}], 100];

myNewList1 = ( (#-5000)/(5000-1000)& /@ myList1);
myNewList2 = ( (#-30)/(70-30)& /@ myList2);

Show[Graphics[{ Hue[0], First@ ListPlot[myNewList1], Hue[.7], First@
ListPlot[myNewList2]}],AspectRatio->Automatic];

The last line also answers a recent query on how to put two two ListPlot
into one with different color.

Warning: I have not tested the code above, but it should work.

Xah
xah at best.com
http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
Mountain View, CA, USA
"Morality abets evil"

• Prev by Date: Re: Several plots with same colour in same square?
• Next by Date: Re: Gaussian Matrix Elimination
• Previous by thread: Re: How to rebase a List of Values?
• Next by thread: Re: How to rebase a List of Values?