truncate y-axis, data disappears
<p>My data disappears when I truncate the y-axis to show only the 50 to 90 range. Am I putting the ylim in the wrong place?</p>

<p>The spreadsheet looks like this:</p>

<pre><code>xval yval_LWTW  linenames   SNP
1   61.4835166  MT9513      NN
2   61.93341478 RITA        GG
3   63.31277751 JUDITH      CC
4   63.60466558 CO04W320    GG
5   64.84700514 DECADE      NN

library(ggplot2)
library(xlsx)
data &lt;- read.xlsx("RdataForGraphsofBestHits.xlsx", sheetIndex=4)
ggplot(data, aes(x=xval, y=yval_LWTW, fill=SNP,  
                     scale_fill_manual(values=c(GG="blue",CC="red",NN="green")))) + 
                     geom_bar(stat="identity", width=1) + 
                     theme(axis.title.x=element_blank())
</code></pre>

<p><a href="https://i.stack.imgur.com/VCA5P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VCA5P.png" alt="enter image description here"></a></p>

<p>This gives me a tall plot because the data go from 61 to 81. I want to make the y-axis start at 50, so the plot will be shorter, so I add + ylim(50.0, 90.0) to the code. </p>

<pre><code>library(ggplot2)
library(xlsx)
data &lt;- read.xlsx("RdataForGraphsofBestHits.xlsx", sheetIndex=4)
ggplot(data, aes(x=xval, y=yval_LWTW, fill=SNP, 
        scale_fill_manual(values=c(GG="blue", CC="red", NN="green")))) + 
        geom_bar(stat="identity", width=1) + 
        theme(axis.title.x=element_blank()) + 
        ylim(50.0, 90.0)
</code></pre>

<p>Now I get the gray background of the plot with the y-axis nicely limited to the 50 to 90 range, but no data plotted onto it. Just the gray background and the axis labels and the legend.
<a href="https://i.stack.imgur.com/Z39HN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z39HN.png" alt="enter image description here"></a></p>

<p>I think I have the code for making the plot horizontal.</p>

<pre><code>ggplot(data, aes(x=xval, y=yval_LWTW, fill=SNP, 
          scale_fill_manual(values=c(GG="blue", CC="red", NN="green")))) + 
          geom_bar(stat="identity", width=1) + 
          theme(axis.title.x=element_blank()) + 
          coord_fixed(ratio=1/2)
</code></pre>

<p>So I can fix the horizontal problem if I can fix the disappearing data problem.</p>