0
틱 . 그게 내가 사용 :변경 x 축 내가 내 데이터 프레임 <code>d</code> (아래 제공)을 플롯하려면 다음 코드를 사용하고 ggplot2
ggplot(data=d, aes(x=d$ID, y=d$Value)) +
geom_line() +
scale_x_discrete(breaks=1:8,
labels=c("05/11", "29/11", "11/12", "23/12",
"04/01", "16/01", "28/01", "09/02"))
그러나 결과는 예상대로되지 않습니다. x 축 틱은 전혀 없습니다.
내 데이터 프레임 d
:
> str(d)
'data.frame': 10 obs. of 4 variables:
$ Value : num 0.021 0.0436 0.0768 0.0901 0.1128 ...
$ Statistic: Factor w/ 1 level "Variable": 1 1 1 1 1 1 1 1 1 1
$ ID : int 1 2 3 4 5 6 7 8 9 10
$ Variable : chr "Mean_Sigma0_VV" "Mean_Sigma0_VV" "Mean_Sigma0_VV" "Mean_Sigma0_VV" ...
> dput(d)
structure(list(Value = c(0.021008858735161, 0.0435905957091736,
0.0767780373205124, 0.0901182900951117, 0.11277978896612, 0.0990637045976107,
0.118897251291308, 0.10604101636234, 0.121525916187773, 0.104460360304768
), Statistic = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), class = "factor", .Label = "Variable"), ID = 1:10, Variable = c("Mean_Sigma0_VV",
"Mean_Sigma0_VV", "Mean_Sigma0_VV", "Mean_Sigma0_VV", "Mean_Sigma0_VV",
"Mean_Sigma0_VV", "Mean_Sigma0_VV", "Mean_Sigma0_VV", "Mean_Sigma0_VV",
"Mean_Sigma0_VV")), .Names = c("Value", "Statistic", "ID", "Variable"
), row.names = c(NA, -10L), class = "data.frame")
_ "이제 x 축의 값을 변경하고 싶습니다"_는 매우 모호합니다. 'scale_x_discrete'가 아닌'scale_x_continuous'를 사용하고 싶을 것입니다. – Axeman
나는 고맙다. 고맙다. 비슷한 데이터를 가진 다른 코드에서'scale_x_discrete'을 사용하고 있었고 작동 중이었습니다. – GCGM
'aes()'문에서'$ '연산자를 사용할 때마다 코드가 손상 될 가능성이 있음을 지적하고 싶습니다. 작동한다고해도 그것이 잘못되었습니다. –