From b698001473eead9994268aa98efc2a9dbab4fda3 Mon Sep 17 00:00:00 2001 From: jranke Date: Fri, 11 Oct 2013 21:54:47 +0000 Subject: Some more plotting experiments git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@112 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- inst/GUI/simple.R | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'inst') diff --git a/inst/GUI/simple.R b/inst/GUI/simple.R index eb238005..62cdeced 100644 --- a/inst/GUI/simple.R +++ b/inst/GUI/simple.R @@ -1,6 +1,7 @@ # Simple gWidgetsWWW2 GUI for mkin # Set the GUI title and create the parent frame {{{1 -require("mkin") +require(mkin) +require(canvas) GUI_title <- "Simple Browser based GUI for kinetic evaluations using mkin" w <- gwindow(GUI_title) sb <- gstatusbar("Powered by gWidgetsWWW2 and Rook", cont = w) @@ -174,8 +175,25 @@ size(m.gtable) <- list(columnWidths = c(40, 200)) # Section for selecting datasets and model dsmsel <- gvbox(cont = dsm) ds_plot_handler <- function(h, ...) { - #galert("test", parent = w) - # TBD + ds.sel <- svalue(ds.gtable) + n.ds.sel <- length(ds.sel) + for (i in 1:n.ds.sel) { + prows[[i]] <- ggroup(cont = pfv) + d <- ds[[ds.sel[[i]]]] + + f <- tempfile() + canvas(f, width = 500, height = 350) + plot(0, type = "n", + xlim = c(0, max(d$data$time, na.rm = TRUE)), + ylim = c(0, max(d$data$value, na.rm = TRUE)), + main = d$title) + for (obs_var in d$observed) { + points(subset(d$data, name == obs_var, c(time, value))) + } + dev.off() + plots[[i]] <- gcanvas(f, cont = prows[[i]], width = 500, 350) + } + } dsplot <- gbutton("Plot selected datasets", cont = dsmsel, handler = ds_plot_handler) @@ -444,7 +462,12 @@ update_m_editor <- function() { # 3}}} # 2}}} -# Fit the models to the data {{{1 +# Plots and fitting {{{1 +pf <- gframe("Plots and fitting", cont = g) +pfv <- gvbox(cont = pf) +prows <- plots <- list() + +# Show the fits {{{1 #mf <- gnotebook(cont = g) #fits <- s <- s.gt <- list() #override <- function(d) { -- cgit v1.2.1