great-northern-diver / loon Goto Github PK
View Code? Open in Web Editor NEWA Toolkit for Interactive Statistical Data Visualization
Home Page: http://great-northern-diver.github.io/loon/
License: GNU General Public License v2.0
A Toolkit for Interactive Statistical Data Visualization
Home Page: http://great-northern-diver.github.io/loon/
License: GNU General Public License v2.0
I am working with marketing data and the spend of some advertisements may be over 100,000. Can you change the default max and min that is allowed in the parallel coordinate serial axes plots to be unlimited?
Again, a long-standing tcl problem.
In some instances the graph-switch produces an error which seems ignorable.
Here are a variety of results take from the l_help()
NOTE that graph switching on the scagnostics seems to work perfectly.
This is not the case for all the rest.
This email contains all examples. (seven different)
These are all taken from l_help()
on learn:displays:graphs:
NOTE THAT I HAVE FIXED SOME ERRORS IN THE “website”
Please use mine http://rwoldford.github.io/loon/
ZERO: graph switch
Restarting R session...
library(loon)
tt <- tktoplevel()
tktitle(tt) <- paste("Loon graph example with a graph switch")
g <- l_graph.default(parent=tt)
gs <- l_graphswitch(activewidget=g, parent=tt)
tkpack(g, side='left', fill='both', expand=TRUE)
tkpack(gs, side='left', fill='y')
G1 <- completegraph(LETTERS[1:4])
G2 <- loongraph(nodes=c('a','b','c'), from=c('a','a'),
to=c('b','c'), isDirected=FALSE)
G3 <- linegraph(G1)
G4 <- loon::complement(G3)
idG1 <- l_graphswitch_add(gs, G1, label='G1')
idG2 <- l_graphswitch_add(gs, G2, label='G2')
# switch to G2 — Generates TCL popup ERROR
invalid command name "0"
invalid command name "0"
while executing
"0"
("uplevel" body line 1)
invoked from within
"uplevel #0 [$activewidget scaleto world]"
(class "::loon::classes::Graphswitch" method "TreeviewToActivewidget" line 11)
invoked from within
"my TreeviewToActivewidget $id"
(class "::loon::classes::Graphswitch" method "TreeviewSelectEvent" line 5)
invoked from within
"::oo::Obj354::my TreeviewSelectEvent"
(command bound to event)
G3 <- linegraph(G1)
G4 <- loon::complement(G3)
idG1 <- l_graphswitch_add(gs, G1, label='G1')
idG2 <- l_graphswitch_add(gs, G2, label='G2')
# switch to G2
idG3 <- l_graphswitch_add(gs, G3, label='G3=linegraph(G1)')
idG4 <- l_graphswitch_add(gs, G4, label='complement(G4)')
# EVERY SWITCH produces the same ERROR
> l_graphswitch_set(gs, idG3)\
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
[tcl] invalid command name "0”.
TRACEBACK:
4. structure(.External(.C_dotTclObjv, objv), class = "tclObj")
3. .Tcl.objv(.Tcl.args.objv(...))
2. tcl(widget, "set", id) at l_graphswitch.R#265
1. l_graphswitch_set(gs, idG3)
FIRST: l_navgraph
Restarting R session...
library(loon)
ng <- l_navgraph(iris)
# switch to 4d transition graph
TCL error window pops containing the following details:
invalid command name "0"
invalid command name "0"
while executing
"0"
("uplevel" body line 1)
invoked from within
"uplevel #0 [$activewidget scaleto world]"
(class "::loon::classes::Graphswitch" method "TreeviewToActivewidget" line 11)
invoked from within
"my TreeviewToActivewidget $id"
(class "::loon::classes::Graphswitch" method "TreeviewSelectEvent" line 5)
invoked from within
"::oo::Obj354::my TreeviewSelectEvent"
(command bound to event)
SECOND: l_ng_ranges
Restarting R session...
library(loon)
library(scagnostics)
oliveAcids <- olive[,-c(1,2)]
scags <- scagnostics(oliveAcids)
nav <- l_ng_ranges(measures=scags, data=oliveAcids, color=olive$Area)
# switch to Skewed
# no problem
# switch to 4d
# nothing happened
# switch to 3d & 4d
# nothing happens
# THE GRAPHS CHANGE once the slider is moved. NO ERROR
THIRD: l_ng_plots
Restarting R session...
library(loon)
library(scagnostics)
oliveAcids <- olive[,-c(1,2)]
scags <- scagnostics(oliveAcids)
nav <- l_ng_plots(measures=scags, data=oliveAcids, color=olive$Area)
# single node; switching to 4d
# nothing happened (which is correct), switch back to 3d
# nothing happened (again is correct), now select a few plots in the scatteplot matrix
# need to have missing edges.
# switch to 4d
# worked perfectly
# switch to 3d & 4d
# worked perfectly
FOURTH: “Arbitrary measures”
Restarting R session...
library(loon)
set.seed(3212341)
n <- 100
dat <- data.frame(
A = rnorm(n), B = rnorm(n), C = rnorm(n),
D = rnorm(n), E = rnorm(n)
)
m2d <- data.frame(
cor = with(dat, c(cor(A,B), cor(A,C), cor(B,D), cor(D,E), cor(A,E))),
my_measure = c(1, 3, 2, 1, 4),
row.names = c('A:B', 'A:C', 'B:D', 'D:E', 'A:E')
)
nav <- l_ng_ranges(measures=m2d, data=dat, separator=':')
# graph has two nodes A:E and B:D
# no edge between
# select 4d
# nothing happens
# select 3d & 4d
# nothing happens
# switch back to 3d and nothing happens
# Going to drag bottom slider to get a graph
# At -0.047833 we get three nodes B:D, and A:E connected to A:C
# switch to 4d
# seems to have switched but the slider bottom goes back to 0.0092858
# So only two nodes A:E connected to B:D
# switch to 3d
# nothing happens, same graph until we move the lower, then it corrects itself.
FIFTH: “Closures of measures”
Restarting R session...
library(loon)
iqr <- function(x) { diff(quantile(x, probs=c(0.75, 0.25))) }
kurtosis <- function(x) { mean((x-mean(x))^4)/mean((x-mean(x))^2)^2 - 3 }
skewness <- function(x) { mean((x-mean(x))^3)/sd(x)^3 }
s_oliveAcids <- scale(oliveAcids)
m1dc <- measures1d(data=s_oliveAcids, separator='+',
median = median,
irq = iqr,
kurtosis = kurtosis,
skewness = skewness)
nav <- l_ng_ranges(measures=m1dc, color=Area)
Error in l_ng_ranges.default(measures = measures(), data = measures("data"), :
object 'Area' not found
nav <- l_ng_ranges(measures=m1dc)
# which produced the plots.
# single node, move bottom slider to 0.017407
# switch to 4d, slider changes back as before.
SIXTH: 2d scagnostics measures
Restarting R session...
library(loon)
library(scagnostics)
oliveAcids <- olive[,-c(1,2)]
scags2d <- scagnostics2d(oliveAcids)
nav <- l_ng_plots(measures=scags2d, color=olive$Area)
# switching does nothing ... correct only one node.
# select a few plots.
# switching WORKS PERFECTLY AND IMMEDIATELY
Same with title
There are several minor issues with CTRL P printing.
Describe the bug
Doing a package require loon
after downloading the 1.3.8 loon release from github returns 1.2.3
as the package version, not 1.3.8
. Is this expected behavior?
To Reproduce
See above.
Expected behavior
Expected to see 1.3.8
as the package version.
Screenshots
N/A
Desktop (please complete the following information):
I'm not a developer, but I'll do my best here. While I was working with spline functions I discovered this fabulous loon package, followed the vignette, and had a lot of fun. Loon apparently calls Xquartz(), and Xquartz() and asked me to install/upgrade the package, so I did at the end of my session. When I tried to start up again, loon would no longer work. It hangs RStudio and you have to force RStudio to quit otherwise it will just sit there waiting for something until hell freezes over.
Steps to reproduce:
library(loon)
Loading required package: tcltk
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Note that it worked just fine before the upgrade - nothing hung, and everything ran beautifully.
I would like to make a 3d scatterplot in tcl, that I can attach to a loon inspector. I have been researching all across the internet if you can even do a 3d scatterplot in loon, but I haven't found anything. Is a 3d scatterplot possible in tcl tk? Or, is it possible to attach a loon inspector to the 3d plotting that R has, through the package rgl?
Thanks,
Chris
The problem here is with 1.1.1 and long standing
library(loon)
Loading required package: tcltk
p <- l_plot(iris)
::.l0.plot is already in configuration
states intended to configure: selected
turn this message off with .Tcl('set ::loon::Options(printInConfigurationWarning) FALSE')
The temporary solution I have is … turn the messaging off in onLoad.R
in
devtools::install_github('rwoldford/loon', ref = "8f18f6e", subdir = "R")
Should l_layer_printTree() print to stdout? Or should it print inside the application (i.e. R or Python)
Closing the inspector can cause trouble. Again, this is long standing and I believe entirely in tcl.
Here is an example in R
Restarting R session...
library(loon)
Loading required package: tcltk
p <- l_plot(quakes$long, quakes$lat)close inspector
layer switch default
library(maps)
NZFijiMap <- map("world2", regions=c("New Zealand", "Fiji"), plot=FALSE)
l_layer(p, NZFijiMap,
label = "New Zealand and Fiji",
color = "forestgreen",
index = "end”)
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
[tcl] invalid command name "::oo::Obj230::my".
TRACEBACK:
structure(.External(.C_dotTclObjv, objv), class = "tclObj”)
.Tcl.objv(.Tcl.args.objv(...))
tcl(widget, "layer", type, ...) at l_layer.R#150
structure(as.character(tcl(widget, "layer", type, ...)), widget = as.vector(widget),
class = c(paste0("l_layer_", type), "l_layer", "loon")) at l_layer.R#150
l_layer_add(widget, "polygons", x = l_Rlist2nestedTclList(x),
y = l_Rlist2nestedTclList(y), color = color, linecolor = linecolor,
linewidth = linewidth, label = label, parent = parent, index = index,
...) at l_layer.R#291
l_layer_polygons(widget, xlist, ylist, color = color, linecolor = linecolor,
linewidth = linewidth, tag = map$names, label = label, parent = parent,
index = "end") at l_layer_map.R#150
l_layer.map(p, NZFijiMap, label = "New Zealand and Fiji", color = "forestgreen",
index = "end") at l_layer.R#119
l_layer(p, NZFijiMap, label = "New Zealand and Fiji", color = "forestgreen",
index = "end")
I was trying to look up the cran documentation online and it said that loon is now archived. Is this true?
Hello,
I can easily see how to change the color palette for plots. How do we change the default 'selected' color from pink for when I select certain points on a plot? I have looked through the documentation but have not found anything.
Describe the bug
In a loon plot with a single point, after adding the polygon glyph, the coordinates of the polygons are missing. Problems should be in the tcl file.
For example,
x_star <-
c(-0.000864304235090734, 0.292999135695765, 0.949870354364736,
0.474503025064823, 0.586862575626621, -0.000864304235090734,
-0.586430423509075, -0.474070872947277, -0.949438202247191,
-0.29256698357822)
y_star <-
c(-1, -0.403630077787381, -0.308556611927398, 0.153846153846154,
0.808556611927398, 0.499567847882455, 0.808556611927398,
0.153846153846154, -0.308556611927398, -0.403630077787381)
p <- l_plot(1,1)
gl <- l_glyph_add_polygon(p,
x = list(x_star),
y = list(y_star))
p['glyph'] <- gl
> gl['x']
[[1]]
[1] NA
> gl['y']
[[1]]
[1] NA
To l_glyph_add_pointrange
documentation, argument showArea
is missing
Hey again,
Can you direct me to the source code of how the function loon_inspector_factory creates an l_plot inspector? I have looked through inspectors.R, but I am in need of the code for what loon_inspector_factory does on the back end. Specifically, how are the plot, select, and modify portions of an l_plot_inspector coded? Is this strictly in tcl, or is it in R?
As well, is there more back end code for loon_plot_factory?
I am trying to create my own type of plot, and want to create my own inspector with loon_inspector_factory, as well as use loon_plot_factory to create my plot but with certain features from different inspectors.
Thanks,
Chris Beckett
Update:
I found the tcl source code.
Please remove Tcl/Tk from your dependency list of installed packages and resubmit this to CRAN.
Tcl/Tk is now included in Base R and is not downloadable as a package. Because you have it listed as a dependency, people can't download loon now.
The package called rfviz has just been submitted to CRAN and has been accepted. It uses loon as a dependency. As a result, my package automatically tries to install dependencies for loon. Since tcl/tk is an un-needed dependency, users cannot install my package from CRAN. Please fix this as soon as possible.
Thanks,
Chris Beckett
The TCL plot function fails when given a single point to plot.
For example in R,
l_plot(x = 1, y = 1)
Produces
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
[tcl] key "" not known in dictionary.
(the above happens in Python call too), plus R adds
Error: $ operator is invalid for atomic vectors
This appears to be a bug in the loon tcl code.
Hi @waddella,
I followed code on the cran documentation to create a 4x4 grid with all of the plots linked, as well as the example of building in an inspector for a single plot. I am having trouble figuring out how to build in the inspector with a 4x4 grid. I think this would be useful, because then people can view the plots externally and not have to click back and forth between the plots and the inspector if they have more than one plot linked. Can you help me know where to look to build in an inspector attached to a grid?
Thank you,
Chris Beckett
Trying to install from RStudio running in rocker/verse image 0f53987ba185 fails with message
.onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/library/tcltk/libs/tcltk.so':
libtcl8.6.so: cannot open shared object file: No such file or directory
Error : package ‘tcltk’ could not be loaded
ERROR: lazy loading failed for package ‘loon’
I can find tcltk.so in /usr/local/lib/R/library/tcltk/libs/tcltk.so but nowhere tcltk8.6.so. I maybe a an installation script not precise enough - or a symlink needed?
Describe the bug
Attaching {loon} produces warning about a partial argument match.
To Reproduce
withr::with_options(list(warn = 1), {
library(loon)
})
Leads to:
Warning in utils::packageDescription(pkg = pkgname, field = "Version") :
partial argument match of 'field' to 'fields'
loon Version 1.4.0.
To learn more about loon, see l_web().
Expected behavior
No warnings produced.
Hey there,
Here is a small example of what code I have done, and I just need to somehow place the loon inspector that rotates with what graph you select on, on the bottom right of my grid, where the empty space is, or on the right of the 2x2 grid, already built-in so users don't need to reposition it themselves. How do I do this???
tt <- tktoplevel()
p1 <- with(mtcars,
l_plot(parent=tt, x=mpg, y=hp, color=gear, title="mtcars",
useLoonInspector=TRUE)
)
p2 <- with(mtcars,
l_plot(parent=tt, x=mpg, y=hp, color=gear, title="mtcars",
useLoonInspector=TRUE)
)
p3 <- with(mtcars,
l_plot(parent=tt, x=mpg, y=hp, color=gear, title="mtcars",
useLoonInspector=TRUE)
)
tkgrid(p1, row=0, column=0, sticky="nesw")
tkgrid(p2, row=0, column=1, sticky="nesw")
tkgrid(p3, row=1, column=0, sticky="nesw")
tkgrid.columnconfigure(tt, 0, weight=1)
tkgrid.columnconfigure(tt, 1, weight=1)
tkgrid.rowconfigure(tt, 0, weight=1)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.