hi,Brandon..
here's my sample data. Can I separate the legend boxes, I only want
the "espécie" box to be in italic..
And for some barplots, how can I just not show the NA values?
Thanks for everyone who's helping me :)
espécie<-as.factor(c(rep("A. australis",49),rep("A. tropicalis",32)))
sexo<-
as.factor(c("F","M","ind","ind","M","M","M","M","ind","M","ind","F","M","ind","ind","ind","M","F","M","ind","ind","ind","ind","ind","ind","ind","M","ind","F","M","M","M","M","ind","ind","M","M","M","M","M","M","M","M","M","M","M","M","ind","M","M","ind","M","F","M","M","ind","ind","M","M","M","M","M","ind","F","M","M","ind","ind","M","ind","ind","M","ind","M","M","M","M","M","M","F","M"))
ct<-c(95.3,89.5,NA,NA,92,NA,NA,90,NA,NA,NA,NA,87,94,91,NA,
87,NA,NA,NA,NA,NA,66,NA,84,97,NA,NA,NA,NA,
88,84,83,84,95,96.5,91,87,86,91,93,92,93,170,NA,95,96,NA,87,174.1,NA,
122.6,145,162,176,113.4,NA,156,160.1,NA,148,161.6,NA,NA,
147,NA,NA,NA,NA,NA,NA,NA,150,NA,75,99,160,88,158,120,144)
ccb<-c(165.89,164.73,196.24,NA,172.35,182.8,214.9,164.74,NA,NA,NA,NA,
164.09,NA,NA,NA,
162.17,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
158.67,161.03,166.38,164.55,166.3,170.18,NA,NA,NA,NA,175.26,NA,
170.81,NA,
163.17,223.95,148.6,186.53,188.4,217.05,220.56,182.99,221.78,224.11,221.69,168.02,210.05,222.92,NA,
210.18,214.25,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,172.66,NA,
155,220.29,NA,NA)
lr<-c(32.34,33.48,33,NA,32.04,33.1,42.18,33.31,NA,NA,NA,NA,
30.82,NA,NA,NA,
30.34,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
26.44,31.94,34.05,30.28,32.12,31.39,NA,NA,NA,NA,32.09,32.34,32.66,NA,
33.79,47.69,27.43,34.98,30.77,42.41,45.45,30.41,46.4,46.1,46.1,30.94,43.47,41.3,NA,
44.38,43.29,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,33.01,NA,30.87,46.08,NA,NA)
tab<-data.frame(espécie,sexo,ct,lr,ccb)
attach(tab)
p1<-ggplot(tab,aes(ct,ccb,colour=espécie,shape=sexo))
+geom_point(size=2.5)+scale_shape("Sexo")+labs(x="Comprimento padrão
(cm)",y="Comprimento côndilo-basal (mm)")+opts(legend.position="none")
p2<-ggplot(tab,aes(ccb,lr,colour=espécie,shape=sexo))
+geom_point(size=2.5)+scale_shape("Sexo")+labs(x="Comprimento côndilo-
basal (mm)",y="Largura rostral (mm)")+opts(legend.position="none")
legend<-ggplot(tab,aes(ccb,lr,colour=espécie,shape=sexo))
+geom_point(size=2.5)+scale_shape("Sexo")+labs(x="Comprimento côndilo-
basal (mm)",y="Largura rostral (mm)")+opts(keep="legend_box")
+opts(legend.text=theme_text(face ="italic"))
arrange(p1,p2,legend,ncol=3)
On 6 out, 14:31, Brandon Hurr <
bhiv...@gmail.com> wrote:
> If you want all of your legend labels in italics you can use legend.text in
> the options.
>
>
http://github.com/hadley/ggplot2/wiki/Legend-Attributes
>
> /shameless self-promotion
>
> #usage
> plot + opts(legend.text = theme_text(face = 'italic'))
>
> It's really hard to make out what you mean by two legends though. Usually if
> there are two legends it's because you have defined two separate scales
> (color, shape, size, linetype...). You can make them disappear, but I'm not
> sure if you can just combine legends.
>
> Brandon
>
>
>
> On Wed, Oct 6, 2010 at 18:24, Brandon Hurr <
bhiv...@gmail.com> wrote:
> > Daniele,
>
> > Can you supply us with the code you are using to make your plot and some
> > sample data?
>
> > Thanks,
>
> > Brandon
>
> > On Wed, Oct 6, 2010 at 17:31, Daniele <
danieleviga...@gmail.com> wrote:
>
> >> Hello, everyone!
> >> I have a question about the legend box in ggplot2...
> >> Can I have only one legend box with labels in italic? Because I have
> >> two boxes..
> >> And how can I eliminate the NA values from the plots?
> >> Thanks, I hope you can help me. I started with the ggplot have few
> >> days...
>
> >> Daniele Coelho Vigário
> >> Acadêmica de Oceanografia
> >> CENTRO DE ESTUDOS DO MAR - UNIVERSIDADE FEDERAL DO PARANÁ
> >> Av. Beira Mar s/nº, Pontal do Sul, Caixa-Postal: 50002, CEP: 83255-000
> >> Pontal do Paraná, PR - Brasil
> >> Tel:
+554133118613 - Laboratório de Ornitologia
> >> Cel: +554199116215
> >> email:
danieleviga...@gmail.com
> >> To unsubscribe: email
ggplot2+u...@googlegroups.com<
ggplot2%2Bunsu...@googlegroups.com >
> >> More options:
http://groups.google.com/group/ggplot2