[R] changing cex pointwise in lattice

Peter Ehlers ehlers at ucalgary.ca
Sat Jul 21 15:50:09 CEST 2012


I'm sorry I misunderstood your original request. You're right, use
subscripts for panel-specific argument values.

Peter Ehlers

On 2012-07-20 19:35, "José M. Blanco Moreno" wrote:
> Sorry about that, when I asked before I meant that I had tried your
> proposed syntax. That has a problem, and it is that it uses the same set
> of values for the character expansion *for both groups*, and it is not
> what I wanted to do. If you plot the data (now a reduced set! sorry!)
> you'll see that both plots are exactly the same: I have data on the same
> positions, but the values that I want to represent with cex are
> different for each group. The intention is to take advantage of the fact
> that (I think that) lattice will use the same scaling on both plots.
>
> I think I have found it...
> # This is just to make sure that a group has a value of 1 and the other of 2
> dd$z <- (1:50)%%2 + 1
>
> xyplot(y~x|group, panel=function(x,y,subscripts){panel.xyplot(x,y,
> cex=dd$z[subscripts])}, data=dd)
>
> Cheers,
>
> José M. Blanco
>
> El 20/07/2012 21:34, Peter Ehlers escribió:
>> Sorry, I had meant to include the following line:
>>
>> Try: xyplot(y~x|group,cex=dd$z,data=dd)
>>
>> Peter Ehlers
> structure(list(y = c(3L, 3L, 3L, 3L, 9L, 9L, 9L, 9L, 38L, 38L,
> 38L, 38L, 44L, 44L, 44L, 44L, 38L, 38L, 38L, 38L, 44L, 44L, 44L,
> 44L, 38L, 38L, 38L, 38L, 44L, 44L, 44L, 44L, 54L, 54L, 54L, 54L,
> 60L, 60L, 60L, 60L, 54L, 54L, 54L, 54L, 60L, 60L, 60L, 60L, 54L,
> 54L), x = c(3.25, 3.25, 9.75, 9.75, 3.25, 3.25, 9.75, 9.75, 16.25,
> 16.25, 22.75, 22.75, 16.25, 16.25, 22.75, 22.75, 29.25, 29.25,
> 35.75, 35.75, 29.25, 29.25, 35.75, 35.75, 42.25, 42.25, 48.75,
> 48.75, 42.25, 42.25, 48.75, 48.75, 3.25, 3.25, 9.75, 9.75, 3.25,
> 3.25, 9.75, 9.75, 16.25, 16.25, 22.75, 22.75, 16.25, 16.25, 22.75,
> 22.75, 29.25, 29.25), group = structure(c(2L, 1L, 2L, 1L, 2L,
> 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L), .Label = c("B",
> "A"), class = "factor"), z = c(2, 0, 8, 3, 3, 4, 5, 4, 14, 11,
> 4, 2, 37, 7, 6, 5, 4, 3, 14, 5, 9, 3, 3, 1, 9, 4, 9, 7, 4, 2,
> 9, 1, 9, 2, 9, 1, 5, 2, 10, 1, 13, 5, 14, 4, 21, 6, 16, 3, 0,
> 1)), .Names = c("y", "x", "group", "z"), row.names = c(NA, 50L
> ), class = "data.frame")
>
> --
> ---------------------------------------
> José M. Blanco-Moreno
> Dept. de Biologia Vegetal (Botànica)
> Facultat de Biologia
> Universitat de Barcelona
> Av. Diagonal 643
> 08028 Barcelona
> SPAIN
> ---------------------------------------
> phone: (+34) 934 039 863
> fax: (+34) 934 112 842
> ---------------------------------------
>
>
> The best argument against democracy is
> a five-minute conversation with the
> average voter. -Winston Churchill, statesman,
> military and author (1874-1965)
>
>
>
> Aquest correu electrònic i els annexos poden contenir informació confidencial o protegida legalment i està adreçat exclusivament a la persona o entitat destinatària. Si no sou el destinatari final o la persona encarregada de rebre’l, no esteu autoritzat a llegir-lo, retenir-lo, modificar-lo, distribuir-lo, copiar-lo ni a revelar-ne el contingut. Si heu rebut aquest correu electrònic per error, us preguem que n’informeu al remitent i que elimineu del sistema el missatge i el material annex que pugui contenir. Gràcies per la vostra col·laboració.
>
> Este correo electrónico y sus anexos pueden contener información confidencial o legalmente protegida y está exclusivamente dirigido a la persona o entidad destinataria. Si usted no es el destinatario final o la persona encargada de recibirlo, no está autorizado a leerlo, retenerlo, modificarlo, distribuirlo, copiarlo ni a revelar su contenido. Si ha recibido este mensaje electrónico por error, le rogamos que informe al remitente y elimine del sistema el mensaje y el material anexo que pueda contener. Gracias por su colaboración.
>
> This email message and any documents attached to it may contain confidential or legally protected material and are intended solely for the use of the individual or organization to whom they are addressed. We remind you that if you are not the intended recipient of this email message or the person responsible for processing it, then you are not authorized to read, save, modify, send, copy or disclose any of its contents. If you have received this email message by mistake, we kindly ask you to inform the sender of this and to eliminate both the message and any attachments it carries from your account. Thank you for your collaboration.
>



More information about the R-help mailing list