On 7/9/08, David Afshartous <[EMAIL PROTECTED]> wrote:
>
>
>  All,
>
>  I'm plotting points and lines for various groups.
>  I'd like subsequent plots done on subsets to maintain the color assignments
>  from the original plot.  This works fine, but the key for the subset doesn't
>  maintain the correspondence.  One solution is to reprint the entire key, but
>  this is undesirable since then the key has more elements than the groups in
>  the plot.  Reproducible example below.

Well, the ideal solution would have been for auto.key to magically
omit the levels of 'groups' that are omitted by the application of
'subset', but there is not enough information available to it for this
to happen. One option is to

1. subset the data beforehand, and drop unsed levels with Group[drop=TRUE]

2. supply colors, etc. explicitly through 'par.settings'.

The other option is to construct your own key (i.e., use the 'key'
argument, not 'auto.key', to specify the legend). It should be simple
to write a function that constructs a suitable 'key' argument given
the levels that are to be omitted/retained.

-Deepayan

______________________________________________
R-help@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.

Reply via email to