x 축의 배율 순서에 문제가 있습니다.
내 입력 파일은 두 데이터 프레임을 병합하고 일치시킨 후 올바른 순서를 갖습니다.
#data
Eisenberg <- data.frame(scale_hyd = c(0.62, 0.29, -0.9, -0.74, 1.19, 0.48, -0.4,
1.38, -1.5, 1.06, 0.64, -0.78, 0.12, -0.85,
-2.53, -0.18, -0.05, 1.08, 0.81, 0.26),
aa = c('A','C','D','E','F','G','H','I','K','L','M','N',
'P','Q','R','S','T','V','W','Y'))
hydroph <- data.frame(position_aa = c("-10", "-9", "-8", "-7", "-6", "-5", "-4",
"-3", "-2", "-1", "0", "1", "2", "3", "4",
"5", "6", "7", "8", "9", "10", "11", "12",
"13", "14"),
aa = c("C","V","Q","W","K","N","A","Y","A","L","C","W","L",
"D","C","I","L","S","A","L","V","H","S","E","E"))
#combining data
res <- merge(Eisenberg, hydroph)
res1 <- res[match(hydroph$position_aa, res$position_aa), ]
view(res1)
#visualisation of data
ggplot(res1, aes(x=position_aa, y=scale_hyd)) +
geom_boxplot() +
labs(x="Amino acid position", y="Eisenberg scale", title="Hydrophobicity") +
theme_bw() +
theme(legend.position="none") +
geom_dotplot(binaxis="y", stackdir="center", fill="black")
x 축에 position_aa의 올바른 순서를 지정하는 데 도움을 주시면 감사하겠습니다.
-10-9-8 ... 14
대신 : -1 -10 -2 ...
내가 추가 한 제안대로 res1$position_aa <- as.numeric(res1$position_aa)
이상하게도 패키지는 우리가 무엇을 하든지간에 어떻게 든 가치를 캐릭터로 되 돌리는 것 같습니다.
대신 기본 R 플롯을 시도해 볼 수 있습니다. 먼저 "factor"
숫자 순서가 지정된 변수 가 필요 합니다.
res$position_aa <- factor(res$position_aa, levels=-10:14)
그런 다음 우리 가 제공 한 수준에 따라 적절하게 정렬 된 plot
사용 graphics:::plot.factor
방법 을 사용합니다 . 그 후 우리는 추가 points
및 사용하여 그리드를 만들 abline
. 그게 다야.
with(res, plot(position_aa, scale_hyd, main="Hydrophobicity",
xlab="Amino acid position",
ylab="Eisenberg scale"))
with(res, points(position_aa, scale_hyd, pch=16, cex=1.5))
.col <- rgb(0, 0, 0, .25) ## alpha .25 for transparency
abline(h=axTicks(2), lty=3, col=.col)
abline(v=seq(-10:14), lty=3, col=.col)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다