Skip to content

tkrplot Newbie

4 messages · Costas Vorlow, Jonathan Daily, Gabor Grothendieck

#
Hello,

I am trying to write a tcltk based program that plots/manipulates
xts/xoo time series objects.

I have the code I used from

## http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tkrplot.html :

##

require(quantmod)
require(tcltk)
library(tkrplot)
Sys.setenv(TZ="GMT")
getSymbols("^GSPC", from = "1960-01-01")

Myhscale <- 2.5    # Horizontal scaling
Myvscale <- 1.25    # Vertical scaling

plotFunction <- function(x)
{
    params <- par(bg="white")
      plot(x,main="A time series")
    par(params)
}


tt <- tktoplevel()
tkwm.title(tt,"Time Series")
img <- tkrplot(tt,fun=plotFunction((Cl(GSPC))),hscale=Myhscale,vscale=Myvscale)
tkgrid(img)

##


Although the output looks fine, I get the following message:

<Tcl>
Error in try(fun()) : could not find function "fun"
<Tcl>

Is this a serious problem with the code?

Thanks in advance,
Costas
#
According to documentation, tkrplot's fun parameter accepts a function
of no arguments. If you remove the arguments from your function, does
that kill the error message?
On Fri, Jun 3, 2011 at 11:42 AM, Costas Vorlow <costas.vorlow at gmail.com> wrote:

  
    
#
You mean use plot() instead of the wrapper plotFunction?


Same (I think):
[1] "GSPC"
+ {
+     params <- par(bg="white")
+       plot(x,main="A time series")
+     par(params)
+ }
<Tcl>
Error in try(fun()) : could not find function "fun"
<Tcl>

        
On 3 June 2011 22:10, Jonathan Daily <biomathjdaily at gmail.com> wrote:
#
On Fri, Jun 3, 2011 at 11:42 AM, Costas Vorlow <costas.vorlow at gmail.com> wrote:
See the last example at the bottom of the help page ?plot.zoo

You might also be interested in the playwith example in the examples
section of ?xyplot.zoo