03-09课后练习

探索labs()函数:增加标题,更改坐标名称用。

p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point()
p
p + labs(colour = "Cylinders")#颜色标签改名
p + labs(x = "New x label")#X轴改名

#主副坐标在图左上方显示
p + labs(title = "New plot title")
p + labs(title = "New plot title", subtitle = "A subtitle")

# The caption appears in the bottom-right, and is often used for
# sources, notes or copyright
p + labs(caption = "(based on data from ...)")

# The plot tag appears at the top-left, and is typically used
# for labelling a subplot with a letter.
p + labs(title = "title", tag = "A")

# If you want to remove a label, set it to NULL.
p + labs(title = "title") + labs(title = NULL)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容