Missing geombars ggplot2

16 views Asked by At

I am using ggplot2 to plot SPI values. However, i have noticed that there are some missing values in the plot which is visible as gaps. I have checked my data and it is correct.

How to clear the missing values in the plot?

My SPI Plot using ggplot2

enter image description here

My code

ggplot(df)+
  geom_bar(aes(x=tperiod, y=SPI_rrP, fill=sign), stat = "identity")+
  scale_fill_manual(values=c("pos"="darkblue","neg"="red"))+
  scale_y_continuous(limits=c(-4,4), breaks = seq(-4, 4, 0.5))+
  scale_x_continuous(expand=c(0,0), breaks=seq(1971,2020,4))+
  labs(y="Plaisance RR Station (SPI-12)", x="Month/Year")+
  theme(axis.title = element_text(face="bold.italic", size=8),
        axis.title.y =element_text(face="bold.italic", size=8),
        axis.text.x = element_text(size=8,color = "#000000",hjust=0.6),
        axis.text.y = element_text(size=8, color="#000000"),
        axis.line = element_line(size=0.2,color="#000000"),
        plot.title = element_text(vjust=-10,hjust=0.01,size=10),
        legend.position = "none")

My data link via google drive

0

There are 0 answers