在患者护理期间,我有一系列在房间内接触过的表面。
dput(sequence_contacts)
structure(list(value = structure(c(1L, 1L, 2L, 3L, 2L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 1L, 4L, 1L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L), .Label = c("FarPatient", "Patient", "Equipment", "HygieneArea",
"Out"), class = "factor"), x = 1:25), row.names = c(NA, -25L), class = c("tbl_df",
"tbl", "data.frame"))
我正在尝试使用连接的阶梯图在x轴上绘制接触序列,在y轴上绘制表面名称。 但是我无法获得积分。为什么不呢?
ggplot()+
geom_step(data= sequence_contacts, mapping=aes(x=x, y=value)) +
geom_step(data= sequence_contacts, mapping=aes(x=x, y=value), direction="vh", linetype=3) +
geom_point(data= sequence_contacts, mapping=aes(x=x, y=value, colour=x)) +
scale_color_gradient(low="blue", high="red")+
scale_x_continuous("Contact Number")+
scale_y_discrete("Surface Category")