标准方法是使用比例函数来更改组的显示标签。您可以更换您的ggplot
打电话给
ggplot(data, aes(grp, fill=outcome)) + geom_bar() +xlab("group") +
ylab("number of subjects") +
scale_fill_discrete("Serologic response",
breaks=c("(10.1,79.9]","(79.9,150]"),
labels=c("double negative", "positive for a and/or b"))
请注意,量表的标题已合并到scale_fill_discrete
称呼。如果您愿意,也可以使用轴来完成此操作
ggplot(data, aes(grp, fill=outcome)) + geom_bar() +
scale_x_discrete("group") +
scale_y_continuous("number of subjects") +
scale_fill_discrete("Serologic response",
breaks=c("(10.1,79.9]","(79.9,150]"),
labels=c("double negative", "positive for a and/or b"))