1

I am trying to add a tick on my y-axis upper section so that the viewer of my can appreciate how high the outlier is. How can I add a Y gradation at 194000 on the y-axis?

This is the code I used using the package on .

sample.size<- c(642,315,379,373,653,392,235,102,297,403,194530,300,231,130,145,9298,317,
                19896,60,9883,642,238,1005,149,281,61,150,280,600,79,155,149,70,135,522,33,
                61,235,369,808,2209,84,1917,1502,102, 332,1238,47,63) 

department <-c(1,3,3,1,3,3,1,1,3,1,1,2,2,1,1,NA,3,3,NA,1,NA,1,3,1,3,1,2,3,NA,1,1,1,1,2,1,
               NA,2,1,2,3,3,3,3,2,3,2,2,1,1)

working <- data.frame(sample.size, department)

gap.boxplot(working$sample.size ~ working$department, gap=list(top=c(21000,190000),
            bottom=c(NA,NA)), axis.labels=T, col = rainbow(3), ylim = c(0, 196000))

enter image description here

Kate Orlova
  • 3,225
  • 5
  • 11
  • 35
Martin
  • 31
  • 4
  • 1
    Can you provide some data, so that we can try reproducing it? see [https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example] for example. – massisenergy Feb 21 '20 at 19:34
  • @massisenergy here is a subset of the data you can use to reproduce perhaps. sample.size<- c(642,315,379,373,653,392,235,102,297,403,194530,300,231,130,145,9298,317,19896,60,9883,642,238,1005,149,281,61,150,280,600,79,155,149,70,135,522,33,61,235,369,808,2209,84,1917,1502,102, 332,1238,47,63) department <-c(1,3,3,1,3,3,1,1,3,1,1,2,2,1,1,NA,3,3,NA,1,NA,1,3,1,3,1,2,3,NA,1,1,1,1,2,1,NA,2,1,2,3,3,3,3,2,3,2,2,1,1) – Martin Feb 21 '20 at 20:26
  • 2
    @Martin I just edited your post by adding your example data. It is always a good idea to provide a reproducible example so that people can run your code by copying and pasting the code to their R console. I hope you will do the same next time. – www Feb 21 '20 at 20:34
  • maybe don't use a gap - it's visually very misleading. A possibly better option may be to use e.g. logarithmic scales. – tjebo Feb 22 '20 at 15:20

0 Answers0