Skip to content

fix for multiple plots that consist of a single plot#157

Merged
vandenman merged 2 commits into
jasp-stats:masterfrom
vandenman:fix/single_multiplots
Jul 8, 2026
Merged

fix for multiple plots that consist of a single plot#157
vandenman merged 2 commits into
jasp-stats:masterfrom
vandenman:fix/single_multiplots

Conversation

@vandenman

Copy link
Copy Markdown
Contributor

@juliuspfadt

Copy link
Copy Markdown
Contributor

tested with time series and scatter plot in descriptives and it works!!!
Amazing :)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates jaspGraphs’ plot-editing entry points to correctly handle jaspGraphsPlot objects that wrap exactly one subplot, enabling editing for “single-plot multi-plots” while still rejecting true multi-figure composites.

Changes:

  • Make getPlotEditingOptions.jaspGraphsPlot() delegate to the single contained subplot when length(graph) == 1.
  • Convert plotEditing() into an S3 generic and add methods for jaspGraphsPlot and ggplot.
  • Register the new plotEditing S3 methods in NAMESPACE.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
R/plotEditingOptions.R Allows editable-options extraction for jaspGraphsPlot when it contains a single subplot.
R/plotEditing.R Introduces S3 dispatch for plot editing; adds jaspGraphsPlot wrapper logic for the single-subplot case.
NAMESPACE Registers plotEditing S3 methods for ggplot and jaspGraphsPlot.

Comment thread R/plotEditing.R
Comment on lines 71 to +73
plotEditing <- function(graph, newOptions) {
UseMethod("plotEditing", graph)
}
Comment thread R/plotEditing.R
@@ -69,9 +69,20 @@
#'
#' @export
plotEditing <- function(graph, newOptions) {
Comment thread R/plotEditing.R
Comment on lines +76 to +81
plotEditing.jaspGraphsPlot <- function(graph, newOptions) {
if (length(graph) > 1L)
stop2("This plot cannot be edited because it consists of multiple smaller figures.")

if (!is_ggplot(graph))
stop2("graph should be a ggplot2")
graph[[1L]] <- plotEditing(graph[[1L]], newOptions)
return(graph)
Comment thread R/plotEditingOptions.R Outdated
Comment on lines 85 to 88
if (length(graph) > 1L)
return(plotEditingOptionsError(gettext("This plot cannot be edited because it consists of multiple smaller figures.")))
return(getPlotEditingOptions(graph[[1L]]))
}

@juliuspfadt juliuspfadt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about the comments

@juliuspfadt juliuspfadt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. I think @EJWagenmakers will also be very happy about this!!!

@vandenman vandenman merged commit dd69465 into jasp-stats:master Jul 8, 2026
11 checks passed
@vandenman vandenman deleted the fix/single_multiplots branch July 8, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Edit plots that are part of multiple smaller figures

3 participants