N.B
N.B

Reputation: 15

Removing the white bar in barplot with ggplot2

Im trying to remove the white bar on the right of this barplot, but i cannot understand how. Here is the graph:

Here is the code i used:

library(ggplot2)    
ggplot(data = df2, aes(x=`neighbourhood`, y="1", fill=`room_type`)                                                                    
 geom_bar(position="fill", stat="identity") +
 coord_flip() +
 scale_fill_brewer(palette = 14) +
 labs(title = "Tipi di stanze per quartiere", y = "Quantità", x = "Quartiere", fill = "Tipo di stanza")

Upvotes: 1

Views: 359

Answers (1)

Lucca Nielsen
Lucca Nielsen

Reputation: 1884

Try removing the y = "1" and the stat = "identity", like this:

library(ggplot2)    
    ggplot(data = df2, aes(x=`neighbourhood`, fill=`room_type`)                                                                    
     geom_bar(position="fill") +
     coord_flip() +
     scale_fill_brewer(palette = 14) +
     labs(title = "Tipi di stanze per quartiere", y = "Quantità", x = "Quartiere", fill = "Tipo di stanza")

Upvotes: 3

Related Questions