Re: [R] Interactive plot

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun, 29 Jun 2008 13:30:50 -0400

In ?playwith the third example seems pretty close to what you want. Here it is changed to correspond to your setup.

Remove the barplot line from calc since we don't want calc to do any plotting and then try this:

library(lattice)
playwith(barchart(seq_along(result) ~ result,

	data = data.frame(result = calc(mat, c(alpha, vary[2])))),
	parameters = list(alpha = seq(2000, 3000, by = 10)))



On Sun, Jun 29, 2008 at 1:07 PM, Ron Michael <ron_michael70_at_yahoo.com> wrote:
> Hi all R users. I already done through some of the examples given with playwith packages and feel nowhere they are matching with my requirement. Can amyone please suggest me how to create my desired interactive plot with "tkrplot" ?
>
> I want following. Let look at following codes :
>
> mat = cbind(c(0.000059710430,0.000023057380), c(0.000023057380, 0.00005971089)) set.seed = 1000 vary = runif(dim(mat)[1], 2000, 3000) calc = function(mat, vary)

> {
> result = vector(length = (length(vary)+1))
> result[1] = sqrt(t(vary) %*% vary)
> for (i in 1 : length(vary))
> {
> result[(i+1)] = sum(vary)*sum(vary*mat[,i])
> }
> barplot(result)
> return(result)
> }
>
> Now I want to put a slider in the plot where user move the slider for the 1st element of the vector "vary" and automatically this result will be reflected at the plot window. Can anyone please tell me how to do that with tkrplot or TeachingDemos ?

>
>
>
>
> --- On Sun, 29/6/08, Ron Michael <ron_michael70_at_yahoo.com> wrote:
>
> From: Ron Michael <ron_michael70_at_yahoo.com>
> Subject: Re: [R] Interactive plot
> To: "Gabor Grothendieck" <ggrothendieck_at_gmail.com>
> Cc: r-help_at_stat.math.ethz.ch
> Date: Sunday, 29 June, 2008, 11:48 PM
>
> Hi, whenever I try to load the playwith package I am getting following warning :
>
>> library(playwith)
> Loading required package: lattice
> Loading required package: grid
> Warning message:
> In namespaceImportFrom(self, asNamespace(ns)) :
> replacing previous import: addhandler
>
> Can anyone please tell me why I am getting that warning?
>
> --- On Sun, 29/6/08, Gabor Grothendieck <ggrothendieck_at_gmail.com> wrote:

>
> From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
> Subject: Re: [R] Interactive plot
> To: ron_michael70_at_yahoo.com
> Cc: r-help_at_stat.math.ethz.ch
> Date: Sunday, 29 June, 2008, 8:18 PM
>
> Install the GTK runtime:
>
> http://www.ggobi.org/rgtk2/
>
> On Sun, Jun 29, 2008 at 9:06 AM, Ron Michael <ron_michael70_at_yahoo.com>
> wrote:
>> whenever I try to load "playwith" package I get following error
> :
>>
>>> library(playwith)
>> Loading required package: lattice
>> Loading required package: grid
>> Error in inDL(x, as.logical(local), as.logical(now), ...) :
>> unable to load shared library
> 'C:/PROGRA~1/R/R-27~1.1/library/RGtk2/libs/RGtk2.dll':
>> LoadLibrary failure: The specified module could not be found.
>>
>> Error: package/namespace load failed for 'playwith'
>>
>> What to do?
>>
>> --- On Sun, 29/6/08, Liviu Andronic <landronimirc_at_gmail.com> wrote:

>>
>> From: Liviu Andronic <landronimirc_at_gmail.com>
>> Subject: Re: [R] Interactive plot
>> To: "Ron Michael" <ron_michael70_at_yahoo.com>
>> Cc: r-help_at_stat.math.ethz.ch
>> Date: Sunday, 29 June, 2008, 7:46 PM
>>
>> On 6/29/08, Ron Michael <ron_michael70_at_yahoo.com> wrote:
>>> Now I want to present the plot in some interactive manner. I want to
> put
>> a slider in the plot where user move the slider for the 1st element of the
>> vector "vary" and automatically this result will be reflected at
> the
>> plot window.
>>>
>> playwith: A GUI for interactive plots using GTK+ ? [1]
>>
>> [1] http://cran.at.r-project.org/web/packages/playwith/index.html
>>
>> Send instant messages to your online friends http://uk.messenger.yahoo.com
>> [[alternative HTML version deleted]]
>>
>>
>> ______________________________________________
>> 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.
>>
>>
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> [[alternative HTML version deleted]]______________________________________________
> 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.
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>



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. Received on Sun 29 Jun 2008 - 17:34:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 29 Jun 2008 - 18:31:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive