[R] About graphics
Silvano
silvano at uel.br
Fri Feb 5 17:46:13 CET 2010
It was exactly what I needed, thank you.
--------------------------------------
Silvano Cesar da Costa
Departamento de Estatística
Universidade Estadual de Londrina
Fone: 3371-4346
--------------------------------------
----- Original Message -----
From: "Duncan Murdoch" <murdoch em stats.uwo.ca>
To: "Silvano" <silvano em uel.br>
Cc: <r-help em r-project.org>
Sent: Friday, February 05, 2010 1:57 PM
Subject: Re: [R] About graphics
> On 05/02/2010 10:48 AM, Silvano wrote:
>> Hi,
>>
>> I'm building a graph (barplot) in which the X axis label
>> disappears.
>> I tried to use the option mgp of par() and I could not
>> get the desired result.
>>
>> Note that want the axis labels horizontally.
>>
>> caes = c(37,20,19,16,75,103)
>> names(caes) = c("Pinscher", "Pastor \n Alemão", "Poodle",
>> "Rottweiller", "SRD", "Outros")
>> caess = sort(caes, decreasing=F)
>> par(mar=c(3, 5.7, 1, 1), mgp=c(4.5, .5, 0), las=1)
>>
>
> You've set margin 1 too small. The barplot() function
> puts the x axis label quite far from the plot, so you need
> something like
>
> par(mar=c(6.1, 5.7, 1, 1), mgp=c(4.5, .5, 0), las=1)
>
> to give room for it. I think it would look better with
> the label closer, which you can do using
>
> mtext("Frequências", side=1, line=3)
>
> (and this would work with a smaller margin, but not as
> small as 3). For example,
>
> caes = c(37,20,19,16,75,103)
> names(caes) = c("Pinscher", "Pastor \n Alemão", "Poodle",
> "Rottweiller", "SRD", "Outros")
> caess = sort(caes, decreasing=F)
> par(mar=c(4.5, 5.7, 1, 1), mgp=c(4.5, .5, 0), las=1)
> barplot(caess, cex.axis=1, cex.names=1, ylab="Raças dos
> Cães",
> xlab="", bty='l', col="LightYellow",
> horiz=T, xlim=c(0,120))
> mtext("Frequências",side=1, line=3)
> abline(v=0)
>
>
>> barplot(caess, cex.axis=1, cex.names=1, ylab="Raças dos
>> Cães",
>> xlab="Frequências", bty='l', col="LightYellow",
>> horiz=T, xlim=c(0,120))
>> abline(v=0)
>>
>> Suggestions?
>>
>> --------------------------------------
>> Silvano Cesar da Costa
>> Departamento de Estatística
>> Universidade Estadual de Londrina
>> Fone: 3371-4346
>>
>> ______________________________________________
>> R-help em r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained,
>> reproducible code.
>>
>
More information about the R-help
mailing list