-
Notifications
You must be signed in to change notification settings - Fork 1
Fix inconsistent legend aesthetics #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,7 @@ plotTimeProfile <- function(data = NULL, # nolint | |
| geomErrorbarAttributes = getDefaultGeomAttributes("Errorbar"), | ||
| geomLLOQAttributes = getDefaultGeomAttributes("LLOQ"), | ||
| groupAesthetics = c("colour", "fill", "shape")) { | ||
|
|
||
| groupAesthetics <- ggplot2::standardise_aes_names(groupAesthetics) | ||
| .validatePlotTimeProfileInputs( | ||
| data = data, | ||
|
|
@@ -185,7 +186,7 @@ plotTimeProfile <- function(data = NULL, # nolint | |
| is.null(listMappedData$mapSimulatedAndObserved) && | ||
| all(c("colour", "shape") %in% groupAesthetics)) { | ||
| plotObject <- plotObject + | ||
| scale_shape(guide = "none") | ||
| guides(shape = "none") | ||
| } | ||
|
|
||
| return(plotObject) | ||
|
|
@@ -375,7 +376,7 @@ plotTimeProfile <- function(data = NULL, # nolint | |
| #' @param commonLimits common limits for simulated and observed data | ||
| #' @param y2ScaleArgs list with arguments for secondary y-axis | ||
| #' @param requireDualAxis boolean if TRUE secondary axis is needed | ||
| #' @param yScaleArgs list with y2scale arguments | ||
| #' @param yScaleArgs list with yScale arguments | ||
| #' | ||
| #' @return list with | ||
| #' `simMappedData` adjusted object of class `MappedDataTimeprofile` for simulated data | ||
|
|
@@ -541,7 +542,7 @@ plotTimeProfile <- function(data = NULL, # nolint | |
| plotObject <- plotObject + | ||
| scale_discrete_manual(aesthetic, | ||
| values = mapSimulatedAndObserved[[aesthetic]], | ||
| guide = guide_legend(order = 1, title = "Simulated") | ||
| guide = guide_legend(order = 2, title = "Simulated") | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -573,8 +574,12 @@ plotTimeProfile <- function(data = NULL, # nolint | |
| # to separate simulated and observed legend entries and start again with default colors | ||
| if (!is.null(mapSimulatedAndObserved)) { | ||
| for (aesthetic in groupAesthetics) { | ||
| guidesList <- stats::setNames( | ||
| list(guide_legend(title = "Simulated", order = 2)), | ||
| aesthetic | ||
| ) | ||
| plotObject <- plotObject + | ||
| guides(aesthetic = guide_legend(title = "observed", order = 1)) + | ||
| guides(!!!guidesList) + | ||
|
Comment on lines
+577
to
+582
|
||
| ggnewscale::new_scale(new_aes = aesthetic) | ||
|
Comment on lines
+577
to
583
|
||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary blank line added at the beginning of the function body. This adds no value and should be removed to maintain clean code formatting.