r语言 - 如何在ggplot 2上创建刻面框plot中的图例?



我如何摆脱所有重叠的x轴标签,而不是通过颜色创建一个图例和过滤器?

library(ggplot2)
#Load in the dataset
broadband = read.csv("broadbanddata.csv")
#Box plot 
ggplot(broadband) + geom_boxplot(aes(x = rsp, y = All.hour.trimmed.mean.latency)) +
labs(title="Figure 1: Average internet speed", x="Type of technology", y="Average Latency in a Day")+
facet_wrap(~technology)

试试这个:

library(ggplot2)
#Load in the dataset
broadband = read.csv("broadbanddata.csv")
#Box plot 
ggplot(broadband) + geom_boxplot(aes(x = rsp, 
y = All.hour.trimmed.mean.latency, 
fill = rsp)) +
labs(title="Figure 1: Average internet speed",
x="Type of technology",
y="Average Latency in a Day",
fill = "Average Latency in a Day")+
theme(axis.text.x = element_blank())+
facet_wrap(~technology)

最新更新