Skip to content

Commit

Permalink
utilizes the order of x whensorting = "none" #223
Browse files Browse the repository at this point in the history
  • Loading branch information
kassambara committed Jun 10, 2020
1 parent f659e42 commit ed3b80d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

## Minor changes

- Sorting can be now disabled in `ggdotchart()` using the option `sorting = "none"` (#115).
- Sorting can be now disabled in `ggdotchart()` using the option `sorting = "none"` (#115, #223).
- New argument `weight` added in `gghistogram()` for creating a weighted histogram (#215)
- Now `ggscaterhist()` takes into account the argument `position` in `margin.params` when marginal plot is a histogram (#286).
- `ggbarplot()` enhanced to better handle the creation of dodged bar plots combined with jitter points ([@aherholt, #176](https://github.com/kassambara/ggpubr/issues/282))
Expand Down
4 changes: 2 additions & 2 deletions R/ggdotchart.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ ggdotchart_core <- function(data, x, y, group = NULL,

if(rotate & sorting == "descending") sorting <- "ascending"
else if(rotate & sorting == "ascending") sorting <- "descending"

if(sorting != "none"){
if(is.null(group)){
if(sorting == "descending")
Expand All @@ -176,9 +175,10 @@ ggdotchart_core <- function(data, x, y, group = NULL,
else if(sorting == "ascending")
data <- arrange(data, !!!syms(c(group, y)))
}
data[, x] <- factor(data[, x], levels = unique(as.vector(data[, x])))
}

data[, x] <- factor(data[, x], levels = unique(as.vector(data[, x])))
if(!is.factor(data[, x])) data[, x] <- as.factor(data[, x])

p <- ggplot(data, create_aes(list(x = x, y = y)))

Expand Down

0 comments on commit ed3b80d

Please sign in to comment.