fix for multiple plots that consist of a single plot#157
Merged
Conversation
Contributor
|
tested with time series and scatter plot in descriptives and it works!!! |
Contributor
There was a problem hiding this comment.
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 whenlength(graph) == 1. - Convert
plotEditing()into an S3 generic and add methods forjaspGraphsPlotandggplot. - Register the new
plotEditingS3 methods inNAMESPACE.
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 on lines
71
to
+73
| plotEditing <- function(graph, newOptions) { | ||
| UseMethod("plotEditing", graph) | ||
| } |
| @@ -69,9 +69,20 @@ | |||
| #' | |||
| #' @export | |||
| plotEditing <- function(graph, newOptions) { | |||
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 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
reviewed
Jul 8, 2026
juliuspfadt
left a comment
Contributor
There was a problem hiding this comment.
what do you think about the comments
juliuspfadt
approved these changes
Jul 8, 2026
juliuspfadt
left a comment
Contributor
There was a problem hiding this comment.
Great work. I think @EJWagenmakers will also be very happy about this!!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes https://github.com/jasp-stats/INTERNAL-jasp/issues/3054
Requires jasp-stats/jaspBase#210