Andrewjohnclose
2008-Aug-02 09:48 UTC
[R] Lattice: Changing the names of conditional variables in strips to mathematical expressions
Hi,
I know this has come up before, but I am having a hard time getting any of
the solutions I have found to work!
I am trying to change the conditioning variable names in my xyplot from the
default names as they appear from the data table - see following:
X=densityplot(~density|type,data=Query,plot.points="jitter",ref=TRUE,width="sj",
panel=function(x, ...){
panel.grid(h=-1, v=-1)
panel.densityplot(x, ...)
})
X
to
dimnames(X)[[1]] <- expression((sqrt(Gower^{1})),(sqrt(Kulczynski))
X
The key issue is gaining the square root symbols and superscript position of
the "1" ...
As an aside, it is possible to vary the font type within expression? Say
setting the text to italics but leaving the superscript "1" as ariel?
Suggestion would be greatly appreciated
Thank you
Andrew
http://www.nabble.com/file/p18787745/Query.csv Query.csv
--
View this message in context:
http://www.nabble.com/Lattice%3A-Changing-the-names-of-conditional-variables-in-strips-to-mathematical-expressions-tp18787745p18787745.html
Sent from the R help mailing list archive at Nabble.com.
Mark Difford
2008-Aug-02 10:15 UTC
[R] Lattice: Changing the names of conditional variables in strips to mathematical expressions
Hi Andrew,
This does it as part of the call. I have increased the height of the strip
and added italic for the second name only.
densityplot(~density|type,data=Query,plot.points="jitter",ref=TRUE,width="sj",
panel=function(x, ...){
panel.grid(h=-1, v=-1)
panel.densityplot(x, ...) },
par.strip.text=list(lines=1.5), ## incr. line height
strip=strip.custom(factor.levels=c(expression((sqrt(Gower^{1}))),
expression((sqrt(italic(Kulczynski)^{1}))))))
HTH, Mark.
Andrewjohnclose wrote:>
> Hi,
>
> I know this has come up before, but I am having a hard time getting any of
> the solutions I have found to work!
>
> I am trying to change the conditioning variable names in my xyplot from
> the default names as they appear from the data table - see following:
>
>
X=densityplot(~density|type,data=Query,plot.points="jitter",ref=TRUE,width="sj",
> panel=function(x, ...){
> panel.grid(h=-1, v=-1)
> panel.densityplot(x, ...)
> })
>
> X
>
> to
>
> dimnames(X)[[1]] <- expression((sqrt(Gower^{1})),(sqrt(Kulczynski))
>
> X
>
> The key issue is gaining the square root symbols and superscript position
> of the "1" ...
>
> As an aside, it is possible to vary the font type within expression? Say
> setting the text to italics but leaving the superscript "1" as
ariel?
>
> Suggestion would be greatly appreciated
>
> Thank you
>
> Andrew
>
> http://www.nabble.com/file/p18787745/Query.csv Query.csv
>
--
View this message in context:
http://www.nabble.com/Lattice%3A-Changing-the-names-of-conditional-variables-in-strips-to-mathematical-expressions-tp18787745p18787895.html
Sent from the R help mailing list archive at Nabble.com.