DeaR UseRs,

I have the following code (see below).
It is working as expected although I have two problems/questions:
- how can I set the size of the graph? It may sound silly, but I couldnt figure that out
- is it possible to export this small "interactive aplication" to html or a latex document, or maybe pdf?

Thank you for your attentions.

Best wishes:
Daniel

the code:
library("tkrplot")
library("relax")

dirfelulet <- function (a1 = 1, a2 = 1, a3 = 1){
  x1 <- x2 <- seq(0, 1, by=.01)

  dirf <- function(x1, x2){
    term1 <- gamma(a1+a2+a3)/(gamma(a1)*gamma(a2)*gamma(a3))
    term2 <- x1^(a1-1)*x2^(a2-1)*(1-x1-x2)^(a3-1)
    term3 <- (x1 + x2 < 1)
    term1 * term2 * term3
  }

  f <- outer(x1, x2, dirf)
  f[f<=0] <- NA
  f[is.infinite(f)] <- NA

  persp(x1, x2, f,
        zlim = c(0, max(f, na.rm = TRUE)+1),
        main = bquote(paste("Dirichlet eloszlás, ", alpha ,"=(",.(a1),",",.(a2),",",.(a3),")")),
        col = "lightblue",
        theta = 50,
        phi = 20,
        r = 50,
        d = 0.1,
        expand = 0.5,
        ltheta = 90,
        lphi = 180,
        shade = 0.75,
        ticktype = "detailed",
        nticks = 5)
}

plot.dirichlet<-function(){
  refresh.code<-function(...){
    a1<-slider(no=1); a2<-slider(no=2); a3<-slider(no=3)
    type=  slider(obj.name="type")
    dirfelulet(a1,a2,a3)
  }
  slider(obj.name="type",obj.value="l")
  gslider(refresh.code,sl.names=c("a1","a2","a3"),
          sl.mins=c(1,1,1),sl.maxs=c(10,10,10),sl.deltas=c(.1,.1,.1),sl.defaults=c(1,1,1))
}
plot.dirichlet()


	[[alternative HTML version deleted]]

