我正在使用ggplot来绘制一些数据.它工作正常,但我想控制绘制区域的形状,并删除灰色背景.
这是我现在使用的代码:
ggplot(data.melted, aes(x = Year, y = value, colour = variable)) +
geom_line() +
scale_x_continuous("Year") +
scale_y_continuous("Fraction of papers") +
scale_colour_discrete("Topics")
Run Code Online (Sandbox Code Playgroud)
这是它产生的输出:
ggplot(data.melted, aes(x = Year, y = value, colour = variable)) +
geom_line() +
scale_x_continuous("Year") +
scale_y_continuous("Fraction of papers") +
scale_colour_discrete("Topics") + theme(panel.background = element_blank())
Run Code Online (Sandbox Code Playgroud)
在保存绘图时指定尺寸.请参阅?ggsave其他选项.
ggsave(p1, file = "plot.png", width = 5, height = 5)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5758 次 |
| 最近记录: |