p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point() p + labs(colour = "Cylinders") p + labs(x = "New x label") # The plot title appears at the top-left, with the subtitle # display in smaller text underneath it 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)
require(tidyverse)
data <- diamonds %>%
sample_n(1000)
ggplot(data = data) +
geom_point(aes(x = carat, y = price, color =price))+
labs(title = "AThis is title",
subtitle = "BThis is subtitle",
caption = "CThis is caption",
tag = "DThis is a tag",
x = "Enew x label",
y = "FNew y label")
p+labs(title = "New plot title", subtitle = "A subtitle",caption = "(based on data from ...)", tag = "A")
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· Blazor Hybrid适配到HarmonyOS系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 解决跨域问题的这6种方案,真香!
· 一套基于 Material Design 规范实现的 Blazor 和 Razor 通用组件库
· 数据并发安全校验处理工具类