Skip to content
Snippets Groups Projects
Commit fb32fb91 authored by Deepankar Chakroborty's avatar Deepankar Chakroborty
Browse files

skip.steps works as expected

skip.steps = 1, now skips 1 observation.
parent 00a8bbcf
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,14 @@
# # - the tick amount
# # - skip.steps (if any) = number of labels to skip
# # (i.e. show tick but no label)
# # e.g.
# # ggplotBreaks(c(0,150), tick =10, skip.steps = 1) # gives
# # $breaks
# # 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150
# #
# # $labels
# # "0" " " "20" " " "40" " " "60" " " "80" " " "100" " "
# # "120" " " "140" " "
# #
# #<---------------------------->
......@@ -31,7 +39,7 @@ ggplotBreaks <- function(range,tick,skip.steps=0){
labels <- as.character(breaks)
} else {
tmp <- c()
labels <- unlist(lapply(breaks[seq(from = 1,to = length(breaks),by = skip.steps)],function(x) c(tmp,c(x,rep(" ",skip.steps-1)))),use.names = F)
labels <- unlist(lapply(breaks[seq(from = 1,to = length(breaks),by = skip.steps+1)],function(x) c(tmp,c(x,rep(" ",skip.steps)))),use.names = F)
rm(tmp)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment