Search code examples
rggplot2graph

How to erase x label(11-28~12-02) in R ggplot


E = ggplot(km_data_person, aes(x = date, y = km,fill = "")) +
    theme_minimal() + 
    geom_bar(stat = "identity") +
    scale_fill_brewer(palette ="Paired") +
    xlab("") + 
    ylab("") +
    theme(axis.text.y = element_text(size = 18)) +
    theme(legend.text = element_text(size = 20)) + 
    theme(axis.text.x = element_text(size = 11)) +
    geom_line(data = km_data_all,
              aes(date, 기관평균, color = "기관평균"), 
              linetype = "solid",
              size = 1, group = 1) +
    scale_color_manual(values = c('기관평균' = '#0066CC')) + 
    labs(color = '') +
    theme(legend.position = "bottom") +
    guides(fill = guide_legend(title = "")) + 
    guides(fill = "none") 

The following graph is drawn from the above R code.

If I want to erase the x label how should the code change to?

enter image description here


Solution

  • E = ggplot(km_data_person,aes(x=date, y=km,fill="")) +
    theme_minimal()+  
    geom_bar(stat="identity") +
    geom_line(data=km_data_all,
    aes(date,기관평균,color="기관평균"),
    linetype = "solid",
    size=1,
    group=1)+
    scale_fill_brewer(palette ="Paired")+
    xlab("") + 
    ylab("")+
    theme(axis.text.y  = element_text(size = 18),
    legend.text=element_text(size=20),
    axis.text.x  = element_blank(),
    legend.position = "bottom")+
    scale_color_manual(values = c('기관평균' = '#0066CC')) + labs(color = '') +
    guides(fill="none")