title: Customizing the y-axis in ggplots2 without using free scale
body: <p>I´m trying to plot a facet_wrap setting the y axis limit individually. I´ve looked for the solution in the forum but I didn´t find it.</p>
  <p>My data looks like these,</p>
  <pre><code>structure(list(fecha = c(2000, 2000, 2000, 2000, 2000, 2000, 
  2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 
  2000, 2000, 2000, 2000, 2000, 2001, 2001, 2001, 2001, 2001, 2001, 
  2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 
  2001, 2001, 2001, 2001, 2001, 2002, 2002, 2002, 2002, 2002, 2002, 
  2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 
  2002, 2002, 2002, 2002, 2002, 2003), cientifico = c(&quot;Gaidropsarus macrophthalmus&quot;, 
  &quot;Gadiculus argenteus&quot;, &quot;Microchirus variegatus&quot;, &quot;Arnoglossus laterna&quot;, 
  &quot;Blennius ocellaris&quot;, &quot;Eutrigla gurnardus&quot;, &quot;Argentina sphyraena&quot;, 
  &quot;Micromesistius poutassou&quot;, &quot;Lesueurigobius friesii&quot;, &quot;Callionymus maculatus&quot;, 
  &quot;Lepidorhombus boscii&quot;, &quot;Capros aper&quot;, &quot;Chelidonichthys cuculus&quot;, 
  &quot;Helicolenus dactylopterus&quot;, &quot;Callionymus lyra&quot;, &quot;Arnoglossus imperialis&quot;, 
  &quot;Chelidonichthys obscurus&quot;, &quot;Trisopterus minutus&quot;, &quot;Buglossidium luteum&quot;, 
  &quot;Trachinus draco&quot;, &quot;Serranus cabrilla&quot;, &quot;Scorpaena loppei&quot;, &quot;Gadiculus argenteus&quot;, 
  &quot;Microchirus variegatus&quot;, &quot;Helicolenus dactylopterus&quot;, &quot;Gaidropsarus macrophthalmus&quot;, 
  &quot;Eutrigla gurnardus&quot;, &quot;Lesueurigobius friesii&quot;, &quot;Argentina sphyraena&quot;, 
  &quot;Arnoglossus laterna&quot;, &quot;Micromesistius poutassou&quot;, &quot;Blennius ocellaris&quot;, 
  &quot;Callionymus maculatus&quot;, &quot;Chelidonichthys cuculus&quot;, &quot;Capros aper&quot;, 
  &quot;Lepidorhombus boscii&quot;, &quot;Callionymus lyra&quot;, &quot;Arnoglossus imperialis&quot;, 
  &quot;Chelidonichthys obscurus&quot;, &quot;Trachinus draco&quot;, &quot;Serranus cabrilla&quot;, 
  &quot;Buglossidium luteum&quot;, &quot;Trisopterus minutus&quot;, &quot;Scorpaena loppei&quot;, 
  &quot;Blennius ocellaris&quot;, &quot;Arnoglossus laterna&quot;, &quot;Argentina sphyraena&quot;, 
  &quot;Micromesistius poutassou&quot;, &quot;Helicolenus dactylopterus&quot;, &quot;Callionymus lyra&quot;, 
  &quot;Callionymus maculatus&quot;, &quot;Capros aper&quot;, &quot;Eutrigla gurnardus&quot;, 
  &quot;Microchirus variegatus&quot;, &quot;Gadiculus argenteus&quot;, &quot;Lepidorhombus boscii&quot;, 
  &quot;Lesueurigobius friesii&quot;, &quot;Gaidropsarus macrophthalmus&quot;, &quot;Arnoglossus imperialis&quot;, 
  &quot;Chelidonichthys cuculus&quot;, &quot;Chelidonichthys obscurus&quot;, &quot;Buglossidium luteum&quot;, 
  &quot;Trachinus draco&quot;, &quot;Trisopterus minutus&quot;, &quot;Serranus cabrilla&quot;, 
  &quot;Scorpaena loppei&quot;, &quot;Arnoglossus laterna&quot;), q95 = c(16, 11, 15, 
  12, 15, 24, 20, 20, 7, 10, 26, 14, 25, 33, 27, 15, 29, 20, 13, 
  27, 22, 13, 10, 15, 17, 15, 21, 7, 20, 12, 21, 15, 12, 27, 13, 
  26, 26, 15, 29, 26, 23, 13, 20, 12, 15, 12, 20, 21, 14, 27, 12, 
  14, 23, 15, 11, 26, 7, 15, 15, 27, 28, 12, 25, 21, 22, 14, 13
  )), row.names = c(1L, 3L, 4L, 5L, 6L, 8L, 11L, 12L, 15L, 16L, 
  17L, 18L, 20L, 22L, 24L, 28L, 32L, 36L, 38L, 39L, 42L, 43L, 44L, 
  46L, 47L, 48L, 49L, 51L, 52L, 53L, 55L, 57L, 58L, 60L, 63L, 64L, 
  70L, 72L, 79L, 80L, 81L, 82L, 83L, 86L, 87L, 88L, 89L, 90L, 91L, 
  92L, 93L, 94L, 98L, 101L, 103L, 104L, 106L, 107L, 116L, 117L, 
  120L, 121L, 123L, 126L, 127L, 128L, 131L), class = &quot;data.frame&quot;)
  </code></pre>
  <p>And using the following code,</p>
  <pre><code>  p &lt;- ggplot(peques, aes(x = fecha, y = q95)) + geom_point(color=&quot;black&quot;) +
    geom_line(color=&quot;blue&quot;) +
    facet_wrap(~cientifico, ncol=3, scales=&quot;free&quot;) + 
    labs(x=&quot;Año&quot;, y=&quot;Q95 (cm)&quot;, face=&quot;bold&quot;) +
    theme_bw()+ 
    annotate(&quot;segment&quot;, x=-Inf, xend=Inf, y=-Inf, yend=-Inf, size=1)+ 
    annotate(&quot;segment&quot;, x=-Inf, xend=-Inf, y=-Inf, yend=Inf, size=1)+
    theme(axis.ticks.length=unit(.15,&quot;cm&quot;),
    strip.text = element_text(face = &quot;italic&quot;),
    axis.title.x = element_text(face=&quot;bold&quot;, vjust=2.95, size=14), 
    axis.title.y = element_text(face=&quot;bold&quot;, vjust= 1.95, size=12),
    axis.text.x = element_text(size=8),  
    axis.text.y = element_text(size=8)) +
    scale_x_continuous(breaks = seq(1990,2020, by=1),labels = c(1990, rep(&quot;&quot;,4), 1995, rep(&quot;&quot;,4), 2000, rep(&quot;&quot;,4), 2005, rep(&quot;&quot;,4),
             2010, rep(&quot;&quot;,4), 2015, rep(&quot;&quot;,4), 2020 )+
  scale_y_continuous(limits=c(min[i], max[i)]), breaks=intervalo[i]), labels=labels[i])) 
  </code></pre>
  <p>I get this graph
  <a href="https://i.stack.imgur.com/bcQHO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bcQHO.png" alt="enter image description here" /></a></p>
  <p>But I want to define the intervals in the y axis, set all the numbers as integer not some as decimal....
  I´m trying with the following code just before the ggplot to define the min, the max and the interval for each species but no luck.</p>
  <pre><code>min &lt;- list()
  max &lt;- list()
  intervalo &lt;- list()
  sp &lt;- list()
  
  for (i in 1:length(especies_peques)){
    sp[[i]] &lt;- subset(peques, cientifico ==especies[i])
    
  min[[i]] &lt;- min(sp[i]$q95)
  max[[i]] &lt;- max(sp[i]$q95)
  intervalo[[i]] &lt;- seq(min[i], max[i], by=2)
  labels[[i]] &lt;- as.character(intervalo[i])
  labels[!(intervalo %% 2 == 0)] &lt;- &quot;&quot;
  </code></pre>
  <p>I hope I´ve explained myself well. Any hint for solving my problem will be more than welcomed.
  Thanks</p>