How to eliminate Labels and x-axis on an inverted bar chart?

Asked

Viewed 43 times

-2

I’d like to know how to delete Labels and the X axis line from the following inverted bar graph. grafico de barras invertido.

Because I think you have redundant information. dice Hi Lucas, thanks for the reply. Follow the data,

L log se padj Sig sigpositiv signegativ PZC75086 0.934 0.237 0.00 0
XP_021188570 0.336 0.155 0.22 0
XP_021191392 0.709 0.226 0.03 0
XP_021194193 0.739 0.000 0.01 0
XP_021194353 -0.367 0.166 0.20 0
XP_021195235 0.689 0.178 0.00 0
XP_021197617 1.303 0.794 0.45 0
XP_021200097 0.847 0.237 0.01 0
XP_021201453 0.678 0.243 0.06 0
XP_021201454 0.787 0.248 0.02 0
XP_021201455 0.540 0.248 0.21 0
XP_021201456 0.814 0.305 0.08 0
XP_021201457 2.026 0.948 0.23 0
XP_021201458 1.190 0.427 0.06 0
XP_021201459 1.957 0.999 0.30 0
XP_021201460 2.408 1.276 0.34 0
XP_021201465 1.570 1.680 0.77 0
XP_021201466 -0.382 0.309 0.64 0
XP_021201493 0.397 0.195 0.27 0
XP_021201494 0.667 0.236 0.06 0
XP_021201495 0.869 0.286 0.03 0
XP_021201514 0.713 0.319 0.19 0
XP_021201515 -0.005 0.173 1.00 0
XP_021201516 0.443 0.167 0.08 0
XP_021201518 0.277 0.327 0.81 0
XP_021201552 1.414 0.789 0.38 0
XP_021191406 1.665 0.344 6.64E-05 1 *
XP_021191399 2.322 0.724 0.020938003 1 *
XP_021190221 0.869 0.308 0.057657776 0
XP_021189544 -0.537 0.164 0.017594595 0
,

I have the following code

ggplot(dt, aes(L, log, label = L, hjust = hjust)) + 
  geom_text(aes(y = 0),size=3, colour=colour1) + 
  geom_text(aes(label = sigpositiv, y = log+se+0.5), size = 3.0, 
            position = position_dodge(width = 0.2))+
  geom_text(aes(label = signegativ, y = log-se-0.5), size = 3.0, 
            position = position_dodge(width = 0.2))+
  labs(x="", y="")+
  geom_col(aes(fill = colour1),  position = "dodge")+
  geom_errorbar(aes(ymin=log-se, ymax=log+se), width=.2)+
  scale_fill_manual(labels= c("ns", "*Significat level \n Fold-Change> 1 or < -1"),
                    values= c("black", "blue"))+
  coord_flip() +
  labs(x = "", y = "Log2 Fold-Change",
       fill=  expression(paste(italic("p<"),"0.05")), 
       position = position_dodge(width = 0.2))+
  theme_classic()

[![insert image description here][2][2]

1 answer

-2

Guys, I got it, just add in the middle and change from Theme:
scale_x_discrete(breaks = NULL) + Theme(element_line(color = "white"), panel.background = element_rect(Fill = "white"))

ggplot(dt, aes(L, log, label = L, hjust = hjust)) + geom_text(aes(y = 0),size=3, Colour=colour1) + geom_text(aes(label = sigpositiv, y = log+se+0.5), size = 3.0, position = position_dodge(width = 0.2))+ geom_text(aes(label = signegativ, y = log-se-0.5), size = 3.0, position = position_dodge(width = 0.2))+ Labs(x="", y="")+ scale_x_discrete(breaks = NULL) + geom_col(aes(Fill = colour1), position = "Dodge")+ geom_errorbar(aes(ymin=log-se, Ymax=log+se), width=.2)+ scale_fill_manual(Labels= c("ns", "*Significat level n Fold-Change> 1 or < -1"), values= c("black", "blue"))+ coord_flip() + Labs(x = "", y = "Log2 Fold-Change", Fill= Expression(Paste(Italic("p<"),"0.05"), position = position_dodge(width = 0.2))+ Theme(element_line(color = "white"), panel.background = element_rect(Fill = "white"))

Browser other questions tagged

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