Giter Site home page Giter Site logo

great-northern-diver / loon Goto Github PK

View Code? Open in Web Editor NEW
48.0 5.0 16.0 42.06 MB

A Toolkit for Interactive Statistical Data Visualization

Home Page: http://great-northern-diver.github.io/loon/

License: GNU General Public License v2.0

Makefile 0.05% R 24.50% Tcl 52.70% CSS 0.10% Shell 0.02% HTML 16.20% Perl 0.04% Python 6.38% Batchfile 0.02%
loon interactive-visualizations statistical-analysis high-dimensional-data tcl-extension tk data-visualization statistical-graphics exploratory-data-analysis exploratory-analysis

loon's People

Contributors

gauchm avatar jasonblais avatar pw2wang avatar rwoldford avatar waddella avatar z267xu avatar zehaosardine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

loon's Issues

Cannot plot a singleton point with plot in Tcl

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.

Tcl package version shows as 1.2.3 in 1.3.8 download

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):

  • Windows 10, Tcl 8.6.11

Can you do a 3d plot in tcl tk?

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

Cran Documentation Gone

I was trying to look up the cran documentation online and it said that loon is now archived. Is this true?

Inspectors Source Code

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.

upgrading Xquartz breaks loon package

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:

  1. Upgrade Xquartz
  2. load loon library and get ready for fun
  3. R hangs indefinitely during the load, giving the following message:

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.

Screen Shot 2021-04-11 at 11 04 27 PM

CTRL-P printing issues

There are several minor issues with CTRL P printing.

  1. Background guides do not seem to show in output when on (showGuides = TRUE)
  2. l_compound plots do not print (e.g. l_pairs) ... presumably because these are outside tcl
  3. Inspectors do not print ... (never have)

TCL 1. selectBy error message problem narrowed down.

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")

TCL 3. graphs and switching graphs

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

tcltk dependency for loon

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

installation on verse docker image fails

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?

TCL 2. closing the inspector

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:

  1. structure(.External(.C_dotTclObjv, objv), class = "tclObj”)

  2. .Tcl.objv(.Tcl.args.objv(...))

  3. tcl(widget, "layer", type, ...) at l_layer.R#150

  4. 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

  5. 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

  6. 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

  7. l_layer.map(p, NZFijiMap, label = "New Zealand and Fiji", color = "forestgreen",
    index = "end") at l_layer.R#119

  8. l_layer(p, NZFijiMap, label = "New Zealand and Fiji", color = "forestgreen",
    index = "end")

Invalid domain for l_serialaxes

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?

Partial argument match of 'field' to 'fields'

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.

2x2 Grid, with 3 plots and one interactive inspector

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)

polygon glyph

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

Highlight Color is pink

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.

Four by Four Grid with Built-in Inspector

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.