title: Inserting axis breaks into histograms in R
body: <p>I have seen previous advice on Stack Overflow relating to inserting axis breaks in histograms, for example, see here:</p>
  
  <p><a href="https://stackoverflow.com/questions/19612348/break-x-axis-in-r">Break X Axis in R</a> and <a href="https://stackoverflow.com/questions/10504804/put-a-break-in-the-y-axis-of-a-histogram">Put a break in the Y-Axis of a histogram</a></p>
  
  <p>However, applying the code given in these posts to my data has proved difficult. I am using R Studio (version 3.4.3) on a 64-bit Windows 10 machine. I am producing histograms to compare four foraging behavioural ethograms relating to three bird species. </p>
  
  <p>The three species are denoted by the following initials: 'HG', 'GB' and 'LB'. An observation unit of 15 seconds (sec) per bird was used, with the following ethogram information collected for each subject: (a.) number of pecks, (b.) number of occasions food items were swallowed, (c.) number of paces ranked in 1 of 4 categories: 0 = none, 1 = 1–4, 2 = 5–10, 3 = >10. Mean walking rates were estimated by assigning the following number of paces to each rank: 1 = 2.5 paces, 2 = 7.5 paces, 3 = 15 paces, (d.) proportion of time spent stationary was ranked in one of four categories: 0 = none, 1 = 1–5 sec, 2 = 6–10 sec, 3 = 11–15 sec. Mean time spent stationary was estimated by assigning the following number of seconds to each rank: 1 = 2.5 sec, 2 = 7.5 sec, 3 = 12.5 sec. The data amount to a total of 2,329 bird-observations.</p>
  
  <p>The behaviour data for each of the three species exists as individual datasets in R, entitled 'HGbehaviour', 'GBbehaviour' and 'LBbehaviour'. I also have a complete dataset entitled 'behaviour', which contains the 2,329 bird-observations across all three species.</p>
  
  <p>I have no problem in producing 'standard' histograms for each species. For example, for species 'HG', the following code produces histograms in base R:</p>
  
  <pre><code>attach (HGbehaviour) 
  hist (Nopecks) 
  hist (Noswallows) 
  hist (Nopaces) 
  hist (Time_stationary)
  </code></pre>
  
  <p>However, the problems lie in attempting to compare histograms between species. This is at least partly compounded by the fact that the number of observations for each species is not the same (HG n = 1961; GB n = 255; LB n = 113). </p>
  
  <p>I have found a way of limiting the x and y axes in order to compare histograms with fixed axes, for different species, with the following code: </p>
  
  <pre><code>hist (Nopecks, xlim = c (0,21), ylim = c (0, 1000))
  </code></pre>
  
  <p>But the problem I have is that, for HG, some of the frequencies are considerably higher. This means that I need to create breaks on the y axis. For some behaviours, I am likely to need breaks on the x axis also.</p>
  
  <p>Here is some code that I have tried: </p>
  
  <pre><code>gap.barplot (HGbehaviour, gap =c (200, 250)), xlab= "No. pecks",
               ytics=c(0,5,10,15,20), ylab = "Frequency", 
               main = "HG no. pecks"
  </code></pre>
  
  <p>However, this produces error messages.</p>
  
  <p>I have spent two days in front of my laptop attempting to remedy this, but to no avail.</p>
  
  <p>Can someone advise please as to how to produce breaks in the x and y axes of my histograms?</p>