[R] Scaling X axis from -1 to 1

Yihui Xie xieyihui at gmail.com
Sun Sep 14 16:22:05 CEST 2008


2 * (x - min(x))/(max(x) - min(x)) - 1

On Sun, Sep 14, 2008 at 10:13 PM, Gundala Viswanath <gundalav at gmail.com> wrote:
> Hi,
>
> I have a density plot in which the x axis
> ranged from 0 to 2000.
>
> How can I scale the data so that the x-axis
> is scaled in -1 to 1 form?
>
> - Gundala Viswanath
> Jakarta - Indonesia
>


-- 
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



More information about the R-help mailing list