Skip to content

Commit

Permalink
Fix mapping of vertical line from addLine
Browse files Browse the repository at this point in the history
  • Loading branch information
pchelle committed Oct 21, 2021
1 parent 4a22f4b commit 2726689
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/atom-plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ addScatter <- function(data = NULL,
data <- data.frame(data, check.names = FALSE)
}

dataMapping <- dataMapping %||% XYGDataMapping$new(x = x, y = y, data = data)
dataMapping <- dataMapping %||% XYGDataMapping$new(x = "x", y = "y", data = data)
plotConfiguration <- plotConfiguration %||% PlotConfiguration$new(data = data, metaData = metaData, dataMapping = dataMapping)
# Update plotConfiguration if user defined aesthetics
eval(parseVariableToObject("plotConfiguration$points", c("color", "shape", "linetype", "size"), keepIfNull = TRUE))
Expand Down Expand Up @@ -254,7 +254,7 @@ addLine <- function(data = NULL,
data <- data.frame(data, check.names = FALSE)
}

dataMapping <- dataMapping %||% XYGDataMapping$new(x = x, y = y, data = data)
dataMapping <- dataMapping %||% XYGDataMapping$new(x = "x", y = "y", data = data)
plotConfiguration <- plotConfiguration %||% PlotConfiguration$new(data = data, metaData = metaData, dataMapping = dataMapping)
# Update plotConfiguration if user defined aesthetics
eval(parseVariableToObject("plotConfiguration$lines", c("color", "shape", "linetype", "size"), keepIfNull = TRUE))
Expand Down
4 changes: 2 additions & 2 deletions R/utilities-mapping.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ smartMapping <- function(data) {

# Names of data.frame variables
variableNames <- names(data)
# If one column, set as y
if (ncol(data) == 1) {
# If one column, set as y unless name is "x"
if (ncol(data) == 1 & !(variableNames[1] %in% "x")) {
mapping$y <- variableNames[1]
}
# If 2 columns, set as x, y
Expand Down

0 comments on commit 2726689

Please sign in to comment.