此问题源于之前的question。我遇到了solution:
myBreaks <- function(x){
breaks <- c(min(as.numeric(as.character(x))),max(as.numeric(as.character(x))))
names(breaks) <- attr(breaks,"labels")
breaks
}
然后将其添加到ggplot代码中:
scale_x_discrete(breaks = myBreaks, labels = myBreaks) +
哪个有效。但是,在向函数添加median(as.numeric(as.character(x))
时,会抛出x轴乱序。有工作吗?