Jonathan Blanco
Jonathan Blanco

Reputation: 1

setting labels in R

I have been trying to set the x-axis of a graph with a normal font, but it is always being created with bold font. I don't know what I'm doing wrong, could someone help me please. This is the code I'm using.

y= sample(c(0:10),51,replace=TRUE)
x=sample(c('Analista','Asistente','Auxiliar','Esp','Irre','Operario','Vendedor'),51,replace=TRUE)

data = data.frame (x,y)

boxplot(y ~ x,las=2)

boxplot(y ~ x,axes=FALSE,col=rainbow(7))

title('Dias Laborados por Cargo',font.main=1,cex.main=1)

axis(side=1,at=data$x, labels=data$x,las=2,font.axis=1,cex.lab=0.75)

Thanks

Upvotes: 0

Views: 37

Answers (1)

IRTFM
IRTFM

Reputation: 263411

The problem is not that you are printing with a bold font but that you are "over-printing". If you are old enough to remember typewriters (or maybe even daisywheel printers?) , it's as though you were banging the same key over and over with backspaces in between.... more ink gets laid down. You only have 7 locations and you are printing into those locations 7 or 8 times. Try this instead:

 axis(side=1,at=unique(data$x), labels=unique(data$x), las=2,font.axis=1,cex.lab=0.75)

Upvotes: 2

Related Questions