2017-09-03 2 views
0

선 그래프를 그릴 때 x 축에 문제가 있습니다. 아래 그래프에서 알 수 있듯이 라벨이 너무 많습니다. x 축을 ggplot2로 축척합니다.

Line graph

내가 seq()를 사용하여 일부 레이블을 포함하여 솔루션을 해결하기 위해 노력하지만, 나는이 오류에 걸쳐 올 것

:

ggplot(df, aes(x = date, y = measure, group = 1)) + 
    geom_line() + 
    theme_bw() + 
    theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) + 
    xlab("X-Axis") + 
    ylab("Y-Axis") + 
    scale_x_continuous(breaks = round(seq(min(df$date), max(df$date), by = 221.2), 1)) 

#> Error in seq.default(min(df$date), max(df$date), : 
#> 'from' must be a finite number 
#> In addition: Warning message: 
#> In seq.default(min(df$date), max(df$date), : 
#> NAs introduced by coercion 

어떤 제안이? 도움이된다면 df$date은 문자로 간주됩니다. 아마, 그것을 숫자 또는 datetime으로 변환해야합니까?

+1

이 플롯을 생산하는 데 사용하여'df'와를 제공하십시오 – useR

답변

관련 문제