[R] Scale y-labels based on a value with 'lattice'

K. Elo maillists at pp.inet.fi
Sun May 29 10:30:29 CEST 2016


Hi!

Many thanks to Duncan and Jim for their quick replies.

27.05.2016, 01:08, Jim Lemon wrote:
> Hi Kimmo,
> par(mar=c(5,7,4,2))
> dotchart(kedf$x)
> mtext(kedf$Group.2,side=2,at=1:6,line=0.5,
>  las=2,cex=log(abs(kedf$Freq))+1)
>
> Jim

This 'dotchart' solution worked fine and I got what I wanted :) However, 
I still wonder why the same idea does not work with lattice (e.g. using 
'scales=list(y=list(cex=log(abs(kedf$Freq))+1))'

27.05.2016, 08:51, Duncan Mackay wrote:
> Hi
>
> If you want to change the cex of the labels see
>
> library(lattice)
>  ?yscale.components.default

Seem a bit more complex, but I'll give it a try.

> Possibly an easier way is to size the symbols
>
> I will use Jims data.frame to plot with lattice
> dotplot(Group.2 ~ x, data = kedf,
>                  scales = list(y = list(labels = kedf[,"Group2"], cex = = kedf[,"Freq"])))
> [...}
> Regards
>
> Duncan

This is also a nice idea to scale the dots. Thanks for pointing this out.

Best,
Kimmo



More information about the R-help mailing list