riviverma at iisermohali.ac.in
2015-Feb-10 05:41 UTC
[R] Breaking y- axis using gap.barplot
Hello all I am trying to plot histogram with break in y-axis for my data by following various posts on R- help but none seems solving my problem. My data looks like:> hdata$breaks [1] 0 5 10 15 20 25 30 35 40 45 50 $counts [1] 16311 108 24 8 1 3 0 1 6 3 on using: gap.barplot(hdata$counts, gap=c(26,108), xlab="RMSD", ytics=c(0,25,110), ylab="Frequency", xtics=hdata$breaks) the plot does not seems correct. Please help.
Hi reviverma, I think your problem is that you have chosen the wrong gap, as it cuts out all of the small bars. Try this: gap.barplot(hdata$counts, gap=c(120,15900), xlab="RMSD", ytics=c(0,100,16000,16100,16200,16300),ylab="Frequency", xtics=hdata$breaks) Note that you have one more "breaks" than you do "counts" in your example - I corrected this. Jim On Tue, Feb 10, 2015 at 4:41 PM, <riviverma at iisermohali.ac.in> wrote:> Hello all > > I am trying to plot histogram with break in y-axis for my data by > following various posts on R- help but none seems solving my problem. My > data looks like: > >> hdata > $breaks > [1] 0 5 10 15 20 25 30 35 40 45 50 > > $counts > [1] 16311 108 24 8 1 3 0 1 6 3 > > on using: gap.barplot(hdata$counts, gap=c(26,108), xlab="RMSD", > ytics=c(0,25,110), ylab="Frequency", xtics=hdata$breaks) > > the plot does not seems correct. > > Please help. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
riviverma at iisermohali.ac.in
2015-Feb-11 06:01 UTC
[R] Breaking y- axis using gap.barplot
Thank you for the reply. Can I have a gap starting from 50 instead of 120 so that the values with lower frequency can show up more predominantly?> Hi reviverma, > I think your problem is that you have chosen the wrong gap, as it cuts > out all of the small bars. Try this: > > gap.barplot(hdata$counts, gap=c(120,15900), xlab="RMSD", > ytics=c(0,100,16000,16100,16200,16300),ylab="Frequency", > xtics=hdata$breaks) > > Note that you have one more "breaks" than you do "counts" in your > example - I corrected this. > > Jim > > On Tue, Feb 10, 2015 at 4:41 PM, <riviverma at iisermohali.ac.in> wrote: >> Hello all >> >> I am trying to plot histogram with break in y-axis for my data by >> following various posts on R- help but none seems solving my problem. My >> data looks like: >> >>> hdata >> $breaks >> [1] 0 5 10 15 20 25 30 35 40 45 50 >> >> $counts >> [1] 16311 108 24 8 1 3 0 1 6 3 >> >> on using: gap.barplot(hdata$counts, gap=c(26,108), xlab="RMSD", >> ytics=c(0,25,110), ylab="Frequency", xtics=hdata$breaks) >> >> the plot does not seems correct. >> >> Please help. >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >