-1

When I changed the scale, the box on the left got messed up.

boxplot((dados$Turbidez..ppm.~dados$Período*dados$Estado), xaxt= "n",yaxt="n",type ="b", log="y", ylim=c(0.1,1000),
        ylab = "Turbidez [ppm]",range=0,col=c("yellow","orange","red","yellow","orange","red"),
        xlab = "Regiões")
axis(2, at=10^(0:6), labels=formatC(10^(0:6),format="f", digits=0),cex.axis=0.8,las=2 )
axis(1, at = seq(2, 5, by = 3), labels=c("PB","RN"))

Look at the boxplot below:

enter image description here

Dan
  • 515
  • 6
  • 20
  • 1
    Welcolme to SO! You need to post a minimal reproducible example (https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example-aka-mcve-minimal-complete-and-ver) – Barbara Nov 29 '17 at 14:00
  • Do you have zero values? The scale looks logarithmic, which would kill the bottom of the box (presumably zeroes). – user2602640 Nov 29 '17 at 14:01
  • post the code you have used to get the BOXPLOTS, post your data with `dput(yourData)` – Andre Elrico Nov 29 '17 at 14:14
  • Yes, I have zeros. – Bruna Carvalho Nov 29 '17 at 14:29
  • Then you either can't use a y log scale or you have to remove the zeroes. – user2602640 Nov 29 '17 at 14:48
  • how can I remove the zeros without changing my dataframe? Do you have any command for this when plotting the boxplot? – Bruna Carvalho Nov 29 '17 at 14:50
  • You can subset: boxplot((dados[dados$Turbidez..ppm. > 0,]$Turbidez..ppm.~dados[dados$Turbidez..ppm.> 0,]$Período*dados$Estado). Also, try reading up about plotting in R - there are more elegant ways of coding for boxplots :) – user2602640 Nov 29 '17 at 15:04

1 Answers1

0

See if this works for you

boxplot(Turbidez..ppm. ~ Período*Estado, 
   data = dados[dados$Turbidez..ppm. > 0,], 
   xaxt= "n",yaxt="n",type ="b", log="y", ylim=c(0.1,1000), 
   ylab = "Turbidez [ppm]",range=0,
 col=c("yellow","orange","red","yellow","orange","red"), 
 xlab = "Regiões") 

axis(2, at=10^(0:6), labels=formatC(10^(0:6),format="f", 
   digits=0),cex.axis=0.8,las=2 ) 
axis(1, at = seq(2, 5, by = 3), labels=c("PB","RN"))
user2602640
  • 640
  • 6
  • 21
  • If it worked, consider accepting the answer - click the grey "V" mark to the left of the answer. And you're welcome :-) – user2602640 Nov 29 '17 at 16:38