Skip to content
Back to formatted view

Raw Message

Message-ID: <f7795dc5-a7bb-2e18-78d3-cca5fc6c5b1f@pp.inet.fi>
Date: 2016-05-29T08:30:29Z
From: K. Elo
Subject: Scale y-labels based on a value with 'lattice'
In-Reply-To: <000001d1b7db$c67481a0$535d84e0$@bigpond.com>

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