[R] spacing of color key in filled.contour
Clint Bowman
clint at ecy.wa.gov
Thu Jan 20 18:10:20 CET 2011
I've gotten good results using the sine function to map colors.
For example, when plotting x, map the range(x) to (-pi/2,pi/2)
which the sine will transform to (-1,1), then add 1 and multiply by
half the desired number of colors. Now the integer values will
pick the colors and give a pleasing display.
If the "squeeze" is taking place only over one of the tails (which
sounds like your case) map the range from (0,pi/2) or (-pi/2,0) and
make the necessary scaling adjustments to cover the number of
colors desired.
Essentially, you are transforming the color mapping instead of
transforming your data.
Clint
--
Clint Bowman INTERNET: clint at ecy.wa.gov
Air Quality Modeler INTERNET: clint at math.utah.edu
Department of Ecology VOICE: (360) 407-6815
PO Box 47600 FAX: (360) 407-7534
Olympia, WA 98504-7600
USPS: PO Box 47600, Olympia, WA 98504-7600
Parcels: 300 Desmond Drive, Lacey, WA 98503-1274
On Thu, 20 Jan 2011, Jim Lemon wrote:
> On 01/20/2011 09:19 AM, claudia tebaldi wrote:
>> Hi all
>>
>>
>> I'm plotting colored contour maps using filled.contour. My levels
>> are very unevenly spaced, with, say, high resolution in the small
>> numbers but ranges that can be an order of magnitude or two larger in
>> absolute value compared to where the action takes place. Aside from
>> transforming the data, is there a way to control the color spacing in
>> the key to the right of the map? Right now I get most of the key
>> length taken up by a couple of colors and the rest all squeezed into
>> thin slices, which also creates a problem with the fourth axis labels
>> getting drawn on top of one another.
>>
> Hi Claudia,
> You can roll your own color key with the color.legend function in plotrix.
> Just specify the colors you want in "rect.col" and the labels in "legend".
>
> Jim
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list