title: Labeling x-axis with another column from dataframe
body: <p>I have a dataframe derived from the output of running GWAS. Each row is a SNP in the genome, with its Chromosome, Position, and P.value. From this dataframe, I'd like to generate a Manhattan Plot where the x-axis goes from the first SNP on Chr 1 to the last SNP on Chr 5 and the y-axis is the -log10(P.value). To do this, I generated an Index column to plot the SNPs in the correct order along the x-axis, however, I would like the x-axis to be labeled by the Chromosome column instead of the Index. Unfortunately, I cannot use Chromosome to plot my x-axis because then all the SNPs on any given Chromosome would be plotted in a single column of points.</p>
  
  <p>Here is an example dataframe to work with:</p>
  
  <pre><code>library(tidyverse)
  
  df &lt;- tibble(Index = seq(1, 500, by = 1),
               Chromosome = rep(seq(1, 5, by = 1), each = 100),
               Position = rep(seq(1, 500, by = 5), 5),
               P.value = sample(seq(1e-5, 1e-2, by = 1e-5), 500, replace = TRUE))
  </code></pre>
  
  <p>And the plot that I have so far:</p>
  
  <pre><code>df %&gt;%
      ggplot(aes(x = Index, y = -log10(P.value), color = as.factor(Chromosome))) +
      geom_point()
  </code></pre>
  
  <p>I have tried playing around with the scale_x_discrete option, but haven't been able to figure out a solution.</p>
  
  <p>Here is an example of a Manhattan Plot I found online. See how the x-axis is labeled according to the Chromosome? That is my desired output.</p>
  
  <p><img src="https://journals.plos.org/plosgenetics/article/file?id=10.1371/journal.pgen.1002916.g001&amp;type=large" alt="Example Manhattan Plot"></p>