데이터 :지정 사용자 정의 색상 그라데이션
g1 <- ggplot(df1, aes(x=Index, y=Duration, color=Duration))+
geom_point()+
geom_line()+
scale_y_datetime(labels=date_format("%M:%S"))
를이 그래프 색상은 기본 "검은 색으로 설정되어, 지금처럼 다음과 같이
df1 <- structure(list(Index = 1:11, Duration = structure(c(1487577655,
1487577670, 1487577675, 1487577680, 1487577685, 1487577680, 1487577700,
1487577705, 1487577695, 1487577700, 1487577680), class = c("POSIXct",
"POSIXt"), tzone = "")), .Names = c("Index", "Duration"), class = "data.frame", row.names = 3:13)
가 지금은 그래프를 구성 "파란색"그라데이션.
문제는 데이터에 사용자 그라디언트를 할당하는 중 오류가 발생한다는 것입니다.
비 POSIXct 객체의 경우:
scale_color_gradient("Duration",low="#D80427", high="#07a0ff",space="Lab")
작품,하지만 난 설명 변수로 POSIXct 객체 df1$Duration
다음과 같은 오류가 발생합니다 :
다른 구배 (SECURITY) 기능을 비활성화 있는가 POSIXct 객체를 그래프로 나타낼 때 사용해야합니까?Ops.POSIXt 오류 ((X (-))의 [1])에서 DIFF '/' "POSIXt"를 개체 정의되지
'color = as.numeric (Duration)) 시도' – zx8754