-2

I want to remove "Antarctica" from my ggplor bar, I tried using na.rm and na.omit but I still see Antarctica bar in my graph. Data and output attached here. Can someone please help Input Data is attached Here

1

Bar1<- 
ggplot(ContinentMaster,aes(x=ContinentMaster$Continent,y=NoOfcountries,
    fill=NoOfcountries,label = NoOfcountries,na.rm = TRUE))

Bar1+  geom_bar(stat = "identity",color="Blue",fill="LightGreen",size=0.5)+
geom_text(size=3, position = position_stack(vjust = 1.05))+
xlab(" ")+
ylab("No Of Countries")+
scale_y_continuous(limits=c(0, 60),breaks=c(0,10,20,30,40,50,60))+
scale_x_discrete(labels = function(x) str_wrap(x, width = 10))+
theme_bw()+
theme(panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.border = element_blank(),
    axis.line = element_line(colour = "black"))

Output Graph

2

Marco Sandri
  • 23,289
  • 7
  • 54
  • 58
Ravindar G
  • 17
  • 6
  • 2
    Welcome to StackOverflow! Please make your example [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), don't attach images of your data. – Thomas K Jul 09 '17 at 20:39

1 Answers1

1

This line of code will subset your data frame, keeping only the rows that have a value for ContinentMaster$NoOfcountries (i.e. are not NA):

ContinentMaster <- ContinentMaster[!is.na(ContinentMaster$NoOfcountries), ]

I hope that is helpful for you.

Jeff
  • 209
  • 1
  • 10