Lazy loaded imageggthemr:为 ggplot2 一键换肤

type
status
date
slug
summary
tags
category
icon
password
comment
简介
ggthemr 是一个为 ggplot2 提供主题和调色板的 R 包,可以加载预设风格,也能自定义任意色板,轻松为所有图表统一“皮肤”。

1. 安装与加载


2. 应用预设主题

  • 预设主题包括 "fresh""pale""flat""dust" 等十余种。

3. 自定义色板

  • swatch:离散色板
  • gradient:数值映射时使用的渐变色

4. 示例对比


5. 主题速查

主题名
说明
ggthemr("fresh")
清新配色
ggthemr("dust")
淡雅灰尘感
ggthemr("pale")
柔和浅色
ggthemr("flat")
扁平化风格
ggthemr_reset()
恢复 ggplot2 默认

小结
  • ggthemr 不仅提供多种预设主题,还能通过 define_palette() 自由定义色板
  • 一旦设置,后续所有 ggplot2 绘图都会自动套用该主题;
  • 完成图形后别忘了用 ggthemr_reset() 恢复默认,避免影响其他可视化。
Prev
ggplot2 点形状(shape)
Next
ggthemes 常用主题
Loading...
Article List
Evan の Logbook
✨ Updates
🎨 Style Guide
🧠 Creative Resources
🗒️ Mind Notes
🧭 Knowbase
📘 SOPs
🩺 Medical Research
🛠️ Tech Chronicles
💰 Fortune Blueprint
📈 R Visionary
📊 Statistics
🖼️ BioVis