使用ggplot2删除barplot中的白色条
Removing the white bar in barplot with ggplot2
我正在尝试删除此条形图右侧的白色条,但我不明白如何操作。
这是图表:
这是我使用的代码:
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")
尝试删除 y = "1"
和 stat = "identity"
,如下所示:
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")
我正在尝试删除此条形图右侧的白色条,但我不明白如何操作。 这是图表:
这是我使用的代码:
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")
尝试删除 y = "1"
和 stat = "identity"
,如下所示:
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")