1

How can i split my y-axis in bar plot while plotting in R.

Sample data:

   Name     Freq
  PRIM2      310
 NBPF20       45
  NBPF1       12
   CD24       11
 SEC22B        7
 ZNF718        7

The code I am using to plot this:

d <- read.table("Sample.txt", header=TRUE)
barplot(d$Freq, names.arg=d$Name, col='red', cex.axis=0.8, cex.names=0.7, las=3)

Thank you

Angelo
  • 4,829
  • 7
  • 35
  • 56

1 Answers1

3
df <- data.frame(
  Name=c("PRIM2", "NBPF20", "NBPF1", "CD24", "SEC22B", "ZNF718"),
  Freq=c(310, 45, 12, 11, 7, 7)
  )

library("plotrix")
gap.barplot(df$Freq, c(50,300), df$Name)

http://www.inside-r.org/packages/cran/plotrix/docs/gap.barplot

speendo
  • 13,045
  • 22
  • 71
  • 107