How can I indicate groups (such as chromosomes) on a continuous axis using ggplot2?
<p>This is what I want to plot:</p>
<p><a href="https://i.stack.imgur.com/VziWS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VziWS.png" alt="enter image description here" /></a></p>
<p>Using ggplot2, I can plot the correct bars, but with the locus number stated on the x-axis instead of the chromosome number. It just plots the number of each bar, like 1,2,...,500, but it doesn't show the chromosome. How can I achieve this?</p>
<h3>Reproducible example:</h3>
<pre><code>p &lt;- ggplot(data = info, aes(x = number,y= Fst,fill = Chromesome))
p + geom_bar(stat = &quot;identity&quot;) + labs(x = &quot;Chromosome&quot;, y =Fst)

number Chromosome   Fst
1       1           0.5
2       1           0.6
3       2           0.7
4       2           0.9
5       3           0.7
6       3           0.1
7       4           0.3
8       4           0.4
9       5           0.5
10      5           0.6
11      6           0.7
12      6           0.8
13      7           0.9
</code></pre>