From h.wickham at gmail.com  Thu May 21 21:11:06 2009
From: h.wickham at gmail.com (hadley wickham)
Date: Fri, 22 May 2009 07:11:06 +1200
Subject: [Rd] Colour Schemes
In-Reply-To: <d8ad40b50905211053p3ced543fy7bcc03d7ba19946a@mail.gmail.com>
References: <d8ad40b50905210444q406e1a2ak8313d495975d1919@mail.gmail.com>
	<OFDAD6BC3C.A2BA778D-ON802575BD.004783B8-802575BD.00491507@hsl.gov.uk>
	<d8ad40b50905210712k128ecfa2vff2dd178f946680d@mail.gmail.com>
	<eb555e660905210929l13c59870v13c4e17cafa7f90f@mail.gmail.com>
	<d8ad40b50905211053p3ced543fy7bcc03d7ba19946a@mail.gmail.com>
Message-ID: <f8e6ff050905211211r1ad7ce3ak356f753785030bca@mail.gmail.com>

> ?Yes, but these things are all at the wrong conceptual level. What you
> are constructing here is a function that maps value to colour, but
> keeping it as breaks and cut values and colours instead of
> representing it as a function. Wouldn't it be nicer to build a real
> function object and have that to pass around?

This is basically what ggplot2 does behind the scenes, with the slight
addition that scales also know how to be "trained", so that the domain
can be learned from the data:

sc <- scale_colour_gradient()
sc$train(1:10)
sc$map(1:10)

Hadley

-- 
http://had.co.nz/



[Rd] Colour Schemes
hadley wickham