[R] Assign value to plot variable name (make.group functions)

Bert Gunter bgunter.4567 at gmail.com
Mon Jun 13 18:16:45 CEST 2016


Mark:

I do not understand what you mean by plot labels, which generally mean
the x and y axis labels that can be given with xlab and ylab
parameters in the xyplot call. Clearly, however, this is not what you
mean. If you mean the labels in the key for the groups, you should
create the grouping factor with the level names you want and they will
be used in the key IIRC (you may have to explicitly create the key and
use its "text" component, as explained in the "key" portion of the
xyplot Help page) . If you want to put text labels of some sort in the
plot, then you should use a panel function that plots the data and
adds a panel.text() call to put text in the plot where you want it.

If none of these, maybe someone with better understanding than I can help.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Jun 13, 2016 at 1:47 AM, Mark Fingerle
<mark.fingerle at brainlab.com> wrote:
> Dear all,
>
> In order to create plots comparing two measurements I am using the "xyplot" and "make.groups" functions (see script example below).
> Now I would like to assign a value to the variable names in the plot. Meaning: In the beginning of my script I assign a name(value) to a variable (for example:  ID1 <- Name1). Now I would like to use this variable to name the plot variables.
>
> Maybe easier to understand using an example:
>
> Script:
>
> pdf("REP_Chess.pdf")
> scChess1=xyplot( x = ObjErrorX~Image, data=make.groups("ID1"=Chess1, "ID2"=Chess2),
>              pch=16 ,main="Chess - Object Error X [mm]", auto.key=T, groups=which, scales=list(relation="free",
>                                                                               y=list(rot=0), x=list(rot=45), abbreviate = TRUE),
>
> print(scChess1, split=c(1,1,1,1), more=False)
> dev.off()
>
> I would like to assign a value to ID1, so that this value is shown on the plot labels after it is printed.
> Something like : ID1 <- Name1 , and Name1 is shown in the plots.
>
>
> Thank you very much in advance.
>
> Cheers
> Mark Fingerle
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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