[R] tkrplot Newbie

Costas Vorlow costas.vorlow at gmail.com
Fri Jun 3 21:28:33 CEST 2011


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


Same (I think):

> ##
> require(quantmod)
> require(tcltk)
> library(tkrplot)
> Sys.setenv(TZ="GMT")
> getSymbols("^GSPC", from = "1960-01-01")
[1] "GSPC"
>
> 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")
<Tcl>
> img <- tkrplot(tt,fun=plot(Cl(GSPC)),hscale=Myhscale,vscale=Myvscale)
Error in try(fun()) : could not find function "fun"
> #img <- tkrplot(tt,fun=plotFunction((Cl(GSPC))),hscale=Myhscale,vscale=Myvscale)
> tkgrid(img)
<Tcl>
>


On 3 June 2011 22:10, Jonathan Daily <biomathjdaily at gmail.com> wrote:
> 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:
>> 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>
>>> img <- tkrplot(tt,fun=plotFunction((Cl(GSPC))),hscale=Myhscale,vscale=Myvscale)
>> Error in try(fun()) : could not find function "fun"
>>> tkgrid(img)
>> <Tcl>
>>
>> Is this a serious problem with the code?
>>
>> Thanks in advance,
>> Costas
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> ===============================================
> Jon Daily
> Technician
> ===============================================
> #!/usr/bin/env outside
> # It's great, trust me.
>



More information about the R-help mailing list