fit_3d_show <-
function(dframe, paras, lengths, adjust,
dotcol="lightblue", surcol="red"){
if (max(lengths)>(ncol(dframe)+adjust-1) | min(lengths)<= adjust){
warning("Some of the picked length is not within data length range, thus they are automatically deleted")
lengths <- lengths[lengths<=(ncol(dframe)+adjust-1) & (lengths> adjust)]
}
minutes <- 1:max(lengths)
simulated_surface <- expand.grid(minutes, lengths)
simulated_surface$fitted <-
weibull.surface(simulated_surface[,1], simulated_surface[,2],
paras[1], paras[2], paras[3], paras[4],
paras[5], paras[6], paras[7], paras[8])
names(simulated_surface)<-c("minutes", "lengths", "fitted")
dframe_mat <- as.matrix(dframe)[minutes,lengths+1]
simulated_surface$true <- c(dframe_mat)
plot3d(x=simulated_surface$minutes,
y=simulated_surface$lengths,
z=simulated_surface$true, col=dotcol,
xlab="Minutes", ylab="Length", zlab="Purity", viewport=c(600,600))
rgl.surface(x=minutes, y=matrix(simulated_surface$fitted,
nrow=length(minutes), ncol=length(lengths)),
z=lengths,
color=surcol, back="lines",
coords=c(1,3,2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.