我正在尝试使用 R 中的 Highchart 包制作一些图。我的图是 qqcomp() 和 ppcomp(),我想使用 highchart 复制它。我可以使用 ggplot2 来做到这一点,但我认为它们在 Highchart 中看起来会更好。
这是我的代码:
library(fitdistrplus)
library(highcharter)
library(ggplot2)
x <- c(164.26, 229.61, 25.07,17.82,111.71,15.33,9849.52,35.8,354.69,255.12,166.36,1371.07,362.58,4212.29,8424.57)
fit.lnorm <- fitdist(x,"lnorm",method="mle", start = NULL)
fit.gamma <- fitdist(x,"gamma", method = "mle", lower = c(0, 0))
qcomp <- qqcomp(list(fit.lnorm, fit.gamma),
xlegend = "bottomright",
xlab = "Cuantiles teóricos",
ylab = "Cuantiles empíricos",
fitlty = 1,
fitcol = c("red1","springgreen2"),
plotstyle = "ggplot",
addlegend = FALSE)
pcomp <- ppcomp(list(fit.lnorm, fit.gamma),
xlegend = "bottomright",
xlab = "Probabilidades teóricas",
ylab = "Probabilidades empíricas",
fitlty = 1,
fitcol = c("red1","springgreen2"),
plotstyle = "ggplot",
addlegend = FALSE)
qcomp <- qcomp + theme_minimal() + ggtitle("Q-Q Plot")
pcomp <- pcomp + theme_minimal() + ggtitle("P-P Plot")