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. thank you very much in advance Claudia
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
Hi again thank you to those who replied. I actually figured out a simple way (which does entail transforming the data, oh well...) and I thought I throw it out there just in case someone needs to solve a similar problem. Apologies if it is in fact obvious. Once the right levels for the contouring have been identified (for example using the quantile function), just use "cut()" on your data with those as the breaks, and the argument labels=F. This will return your data in the form of integers, with a unique integer associated to all the values that fall in a given interval identified by your levels. Use filled.contour on your new data, and work on the key.axes={axes(4,at=...,labels=...)} argument to print the right values besides the color key. For what is worth. And thanks again Jim and Clint Claudia