PUPAIM 패키지를 사용하여 흡착 등온선을 생성합니다 (예 : redlichpanalysis (Ce, Qe)).
예를 들어 다음 변수를 사용합니다.
install.packages("PUPAIM")
library(PUPAIM)
library(nls2)
Ce <- c(1.447071, 1.605402, 2.196297)
Co <- c(2,3,4)
Qe <- (Co-Ce)*100/0.33
redlichpanalysis(Ce,Qe)
#give immediately the statistics and basic plot as output format
그러면 플롯이 생성됩니다.
플로팅 절차를 사용자 정의하고 ggplot2와 유사한 고품질 그래픽을 얻으려면 어떻게해야합니까? (나머지 그래픽은 ggplot 2로 제작 되었기 때문에이 문제를 강조하고 있습니다).
비슷한 질문을 검색하여 ggplotify 패키지를 찾았습니다. 솔직히 말해서 정말 이해가 안 돼요. ggplot 객체에서 플롯 객체를 변경하면 어떻게 사용자 정의 할 수 있습니다. 예를 들어 "theme_bw ()"를 추가하려고했지만 실패했습니다.
축을 다시 조정하고 theme_bw ()와 유사한 레이아웃을 추가하고 적절한 단위로 축 레이블을 추가하고 아마도 회귀 자체뿐만 아니라 측정 지점의 스타일을 조정해야합니다.
주어진 기본 내장 플롯을 사용자 정의 할 수있는 방법에 대한 제안에 감사드립니다.
의 소스 코드 를 검토하면 PUPAIM::redlichpanalysis
플로팅이 간단하다는 것을 알 수 있습니다.
redlichpanalysis <- function(Ce, Qe){
x <- Ce
y <- Qe
data <- data.frame(x, y)
n<- nrow(na.omit(data))
print("NLS2 Analysis for Redlich Peterson Isotherm Model")
fit257 <- (Qe ~ (Arp*Ce)/(1+(Krp*(Ce^b))))
start <- data.frame(Arp = c(1, 100), Krp = c(1, 100), b = c(0, 1))
set.seed(511)
fit258 <- nls2(fit257, start = start, control = nls.control(maxiter = 50, warnOnly = TRUE), algorithm = "port")
#<removed irrelevant lines here>
plot(x, y, main = "Redlich Peterson Isotherm", xlab = "Ce", ylab = "Qe")
lines(x, predict(fit258), col = "black")
#<more irrelevant lines here>
}
다음과 같이 동일한 작업을 수행 할 수 있습니다 ggplot
.
library(ggplot2)
library(PUPAIM)
startfit <- (Qe ~ (Arp*Ce)/(1+(Krp*(Ce^b))))
start <- data.frame(Arp = c(1, 100), Krp = c(1, 100), b = c(0, 1))
set.seed(511)
endfit <- nls2(startfit, start = start, control = nls.control(maxiter = 50, warnOnly = TRUE), algorithm = "port")
predict(endfit)
data.frame(Ce,Qe,Predict = predict(endfit)) %>%
ggplot(aes(x=Ce, y = Qe)) +
geom_point() +
geom_line(aes(y = Predict)) +
ggtitle("Redlich Peterson Isotherm") +
theme_bw()
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다