我有这个数据框,称为测试。它有 3 列,DATE
, USED_CORES
, RELATIVE_PERCENT
。我想创建一个 ggplot 图,我想DATE
在 x 轴、y 轴RELATIVE_PERCENT
和y 轴USED_CORES
右侧显示。
这是我的数据框:
dput(head(test,30))
structure(list(DATE = structure(c(1364359560, 1364359590, 1364359620,
1364359650, 1364359680, 1364359710, 1364359740, 1364359770, 1364359800,
1364359830, 1364359860, 1364359890, 1364359920, 1364359950, 1364359980,
1364360010, 1364360040, 1364360070, 1364360100, 1364360130, 1364360160,
1364360190, 1364360220, 1364360250, 1364360280, 1364360310, 1364360340,
1364360370, 1364360400, 1364360430), class = c("POSIXct", "POSIXt"
), tzone = ""), USED_CORES = c(2.4, 2.4, 2.4, 2.4, 2.4, 2.4,
2.4, 2.4, 2.4, 2.4, 2.4, 2.4, 2.24, 2.4, 2.4, 2.4, 2.4, 2.4,
2.24, 2.4, 2.4, 2.4, 2.4, 2.4, 2.4, 2.4, 2.4, 2.4, 2.4, 2.56),
RELATIVE_PERCENT = c(15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 14, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 16)), .Names = c("DATE", "USED_CORES",
"RELATIVE_PERCENT"), row.names = c(NA, 30L), class = "data.frame")
我可以这样做以DATE
在 xaxis 和 yaxisRELATIVE_PERCENT
上显示:
ggplot(test, aes(DATE, RELATIVE_PERCENT)) +
geom_point(colour="blue", size=1) + theme_bw()
如何USED_CORES
在 y 轴的右侧显示?