ERROR: The "x" line break is not justifying left

Asked

Viewed 59 times

1

I made a line break in the title of the "x" axis using the " n" and the break did not respect the horizontal justification on the left.

Follow the data:

> dput(PCLstack)
structure(list(Grupo = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L), .Label = c("TEPT", "TA", "TOC", "Controle"), class = "factor"), 
    ClusterB = c(9, 10, 12, 11, 17, 19, 11, 19, 16, 12, 14, 19, 
    13, 15, 14, 19, 18, 14, 14, 14, 15, 9, 14, 18, 14, 12, 14, 
    11, 18, 15, 18, 11, 13, 15, 20, 10, 15, 15, 9, 17, 18, 14, 
    14, 15, 15, 16, 15, 15, 16, 14, 13, 20, 11, 16, 15, 19, 15, 
    12, 18, 10, 19, 14, 14, 15, 18, 20, 13, 14, 16, 20, 14, 16, 
    18, 10, 16, 11, 2, 3, 6, 6, 6, 6, 2, 2, 6, 5, 7, 6, 4, 3, 
    5, 3, 8, 3, 8, 5, 6, 6, 2, 6, 6, 6, 6, 3, 5, 2, 5, 3, 4, 
    3, 3, 3, 5, 6, 1, 2, 4, 2, 6, 5, 4, 6, 5, 2, 4, 6, 3, 5, 
    6, 2, 3, 5, 5, 3, 5, 4, 3, 6, 1, 5, 6, 5, 5, 3, 4, 5, 4, 
    5, 3, 6, 6, 3, 3, 5, 9, 9, 9, 9, 9, 9, 9, 9, 8, 4, 5, 3, 
    3, 5, 3, 4, 5, 2, 4, 4, 4, 5, 5, 2, 5, 3, 5, 4, 6, 4, 8, 
    5, 6, 5, 4, 3, 3, 2, 6, 4, 3, 1, 4, 5, 3, 4, 6, 2, 1, 5, 
    5, 7, 3, 8, 5, 0, 4, 4, 6, 4, 3, 5, 8, 3, 5, 7, 6, 3, 5, 
    3, 5, 6, 5, 6, 1, 2, 6, 1, 2, 5, 1, 1, 6, 5, 6, 5, 6, 1, 
    2, 1, 5, 2, 2, 2, 5, 6, 5, 5, 5, 2, 5, 6, 5, 4, 1, 6, 6, 
    6, 2, 6, 1, 2, 2, 1, 5, 5, 6, 2, 6, 5, 5, 1, 5, 2, 5, 1, 
    5, 2, 2, 6, 6, 2, 5, 5, 2, 6, 6, 2, 6, 6, 2, 5, 5, 2)), row.names = c(NA, 
-298L), class = "data.frame")
> 

I used the following lines:

    require(ggplot2)
    require(ggpubr)
    require(ggsignif)

compar = list(c("TEPT","TA"),c("TEPT","TOC"),c("TEPT","Controle"),
              c("TA","TOC"),c("TA","Controle"),c("TOC","Controle"))

sigs <- c("p < 0,05","p < 0,01","p < 0,001","ns","ns","ns")

cores <- scale_fill_manual(values = c("red","yellow","#007eff","green"))

boxBstack <- ggplot(PCLstack, aes(Grupo, ClusterB),color = "black") +
  stat_boxplot(geom = "errorbar", size = 0.5, width = 0.1) +
  geom_boxplot(aes(fill = Grupo), show.legend = F) +
  labs(title = "Intrusão",
       x = expression(paste("Welch = 229,769; gl = 3, sig. = p < 0,001;\n", eta^2,"= 0,808")),
       y = "Escores") +
  theme(axis.text.x = element_text(size = 10, face = "bold", color = "Black"),
        axis.text.y = element_text(size = 10, color = "black"),
        plot.title = element_text(size = 12),
        axis.title.y = element_text(size = 10, face = "bold"),
        axis.title.x = element_text(size = 10,hjust = 0, vjust = 0)) +
  geom_signif(comparisons = compar,
              textsize = 2.8,
              margin_top =  c(.1,.2,.3,-.2,-.3,-.4),
              tip_length = c(0.1,0.03,
                             0.03,0.1,
                             0.1,0.03,
                             0.03,0.03,
                             0.03,0.03,
                             0.03,0.03),
              annotations = format(x = sigs)) +
  scale_y_continuous(limits = c(0,30),breaks = seq(0,30,5)) + cores

boxBstack

Watch the line break as it goes:

inserir a descrição da imagem aqui

Where is the error?

  • From the help page ?plotmath: "Control characters (e.g., n) are not Interpreted in Character strings in plotmath, Unlike normal plotting."

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.