Skip to content

Commit

Permalink
Fetch flexplot from Descriptives (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
boutinb authored Apr 11, 2024
1 parent 91dabc2 commit 2b26dd9
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 210 deletions.
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# History files
.Rhistory
.Rapp.history

# Session Data files
.RData

# User-specific files
.Ruserdata

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# produced vignettes
vignettes/*.html
vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# R Environment Variables
.Renviron

# pkgdown site
docs/

# translation temp files
po/*~

# OSX files
*.DS_Store
Thumbs.db

# JASP analysis
state

# RStudio files
.Rproj.user/*
Rproj.user
.Rproj.user
/.Rprofile
/renv.lock
/renv
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ Website: github.com/dustinfife/flexplot
Maintainer: Dustin Fife <[email protected]>
Description: Graphically explore the dependencies between variables
License: GPL (>= 2)
Imports: flexplot, jaspBase, jaspGraphs
Imports: flexplot, jaspBase, jaspGraphs, jaspDescriptives
Remotes:
dustinfife/flexplot,
jasp-stats/jaspGraphs,
jasp-stats/jaspBase
jasp-stats/jaspBase,
jasp-stats/jaspDescriptives
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export(flexplot)
export(flexplotInternal)
export(linmod)
export(mixedmod)
export(glinmod)
4 changes: 2 additions & 2 deletions R/flexplot.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flexplot <- function(jaspResults, dataset, options) {
flexplotInternal <- function(jaspResults, dataset, options) {
return(flexplot:::flexplot_jasp2(jaspResults, dataset, options))
}
}
66 changes: 66 additions & 0 deletions R/flexplotWrapper.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#
# Copyright (C) 2013-2022 University of Amsterdam
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# This is a generated file. Don't change it

flexplot <- function(
data = NULL,
version = "0.18.3",
formula = NULL,
alpha = 0.4,
bw = FALSE,
confidence = FALSE,
dependent = "",
ghost = TRUE,
intervals = "Quartiles",
jitx = 0.1,
jity = 0,
nameCols = "",
nameLegend = "",
nameRows = "",
nameX = "",
nameY = "",
palette = "GGplot Default",
paneledVars = list(),
plotHeight = 320,
plotWidth = 480,
theme = "JASP",
type = "Loess",
variables = list()) {

defaultArgCalls <- formals(jaspVisualModeling::flexplot)
defaultArgs <- lapply(defaultArgCalls, eval)
options <- as.list(match.call())[-1L]
options <- lapply(options, eval)
defaults <- setdiff(names(defaultArgs), names(options))
options[defaults] <- defaultArgs[defaults]
options[["data"]] <- NULL
options[["version"]] <- NULL

if (!is.null(formula)) {
if (!inherits(formula, "formula")) {
formula <- as.formula(formula)
}
options$formula <- jaspBase::jaspFormula(formula, data)
}

optionsWithFormula <- c("dependent", "intervals", "palette", "paneledVars", "theme", "type", "variables")
for (name in optionsWithFormula) {
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspVisualModeling::flexplot", data, options, version))
}
1 change: 1 addition & 0 deletions inst/Description.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Description
title: qsTr("Flexplot")
qml: "Flexplot.qml"
func: "flexplot"
hasWrapper: true
}

Analysis
Expand Down
209 changes: 3 additions & 206 deletions inst/qml/Flexplot.qml
Original file line number Diff line number Diff line change
@@ -1,207 +1,4 @@
import QtQuick 2.12
import JASP.Controls 1.0
import JASP.Widgets 1.0
import JASP 1.0
import QtQuick
import jaspDescriptives

Form
{


VariablesForm
{
AvailableVariablesList { name: "allVariables" }
AssignedVariablesList {
name: "dependent" ;
title: qsTr("Dependent Variable") ;
singleVariable: true
onCountChanged: nameY.value = count > 0 ? model.data(model.index(0,0)) : ""
}
AssignedVariablesList {
name: "variables" ;
title: qsTr("Independent Variable(s)") ;
id: varlist
onCountChanged: {
nameLegend.value = count > 1 ? model.data(model.index(1,0)) : "";
nameX.value = count > 0 ? model.data(model.index(0,0)) : "";
}

}
AssignedVariablesList {
name: "paneledVars" ;
title: qsTr("Paneled Variable(s)");
id: paneledVars
onCountChanged: {
nameCols.value = count > 0 ? model.data(model.index(0,0)) : "";
nameRows.value = count > 1 ? model.data(model.index(1,0)) : "";
}

}
}

Section
{
title: qsTr("Options")

Group
{
title: qsTr("<br><strong>Point controls</br></strong>")
columns: 4
Slider
{
name: "alpha"
label: qsTr("Point transparency")
value: 0.4
vertical: true
enabled: varlist.count > 0
}
Slider
{
name: "jitx"
label: qsTr("Jitter in X")
value: .1
min: 0
max: .5
vertical: true
enabled: varlist.count > 0
}
Slider
{
name: "jity"
label: qsTr("Jitter in Y")
value: 0
min: 0
max: .5
vertical: true
enabled: varlist.count > 0
}
}
Group
{
Group
{
title: qsTr("<strong>Visual Statistics</strong>")
CheckBox
{
name:"confidence";
label: qsTr("Plot confidence bands")
enabled: varlist.count > 0
}
DropDown
{
name: "type"
values:
[
{label: qsTr("Loess"), value: "Loess"},
{label: qsTr("Regression"), value: "Regression"},
{label: qsTr("Quadratic"), value: "Quadratic"},
{label: qsTr("Cubic"), value: "Cubic"},
{label: qsTr("None"), value: "None"}
]
label: qsTr("Fitted line (scatterplots)")
enabled: varlist.count > 0
}
DropDown
{
name: "intervals"
values:
[
{label: qsTr("Quartiles"), value: "Quartiles"},
{label: qsTr("Standard errors"), value: "Standard errors"},
{label: qsTr("Standard deviations"), value: "Standard deviations"}
]
label: qsTr("Intervals (categorical predictors)")
enabled: varlist.count > 0
}
}

Group
{
title: qsTr("<br><strong>Other Plot Controls</strong>")
DropDown
{
name: "theme"
values:
[
{label: qsTr("JASP"), value: "JASP"},
{label: qsTr("Black and white"), value: "Black and white"},
{label: qsTr("Minimal"), value: "Minimal"},
{label: qsTr("Classic"), value: "Classic"},
{label: qsTr("Dark"), value: "Dark"}
]
label: qsTr("GGplot theme")
}
DropDown
{
name: "palette"
values:
[
{label: qsTr("GGplot Default"), value: "GGplot Default"},
{label: qsTr("Nature"), value: "Nature"},
{label: qsTr("AAAS"), value: "AAAS"},
{label: qsTr("Lancet"), value: "Lancet"},
{label: qsTr("JCO"), value: "JCO"},
{label: qsTr("Dark"), value: "Dark"}
]
label: qsTr("Color Palette")
}
CheckBox
{
name:"bw";
label: qsTr("Convert to grayscale");
checked: false
}

CheckBox
{
name:"ghost";
label: qsTr("Ghost lines");
checked: true
enabled: paneledVars.count > 0
}
}
}
}

Section
{
title: qsTr("Plot Labels")
Group
{
title: qsTr("<br><strong>Plot Labels</strong>")
TextField
{
id: nameX;
label: qsTr("X Axis Label");
name: "nameX";
}
TextField
{
id: nameY
label: qsTr("Y Axis Label")
name: "nameY";
value: xAxis.value
}
TextField
{
id: nameLegend
label: qsTr("Legend Label")
name: "nameLegend";
value: legend.value
}
TextField
{
id: nameCols
label: qsTr("Column Panel Label")
name: "nameCols";
value: cols.value
}
TextField
{
id: nameRows
label: qsTr("Row Panel Label")
name: "nameRows";
value: rows.value
}
}
}
}
FlexplotForm {}

0 comments on commit 2b26dd9

Please sign in to comment.