Answers.Body: <p>I was able to get it to work by converting the column in the dataframe to a character using this command:</p>
  <p><code>df$day &lt;- as.character(df$day)</code></p>
  <p>and it worked like a charm! Thanks for your advice @haci</p>
  <blockquote>
  <p>You can give a try by converting the column of numbers to a factor variable.</p>
  </blockquote>
  <p><a href="https://i.sstatic.net/Aotfy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Aotfy.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-13T14:37:40.617Z
Answers.LastActivityDate: 2023-06-14T21:18:19.183Z
Answers.LastEditDate: 2023-06-14T21:18:19.183Z
Answers.UserDisplayName: rimo
Body: <p>I have a simple dataframe that includes points where the x values are 0, 1, 2, 3, 4, and 7. When I go to plot the data this is what ggplot2 gives me:</p>
  <p><a href="https://i.sstatic.net/8JfDJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8JfDJ.png" alt="enter image description here" /></a></p>
  <p>I only want to include the points mentioned above. How do I take out the instance of 5 and 6 in the bar plot?</p>
  <p>(I have tried googling the answer and nothing is coming up with my actual need so I figured I'd ask the community which might give an answer sooner - please be kind I know this is bound to have a simple solution)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-12T23:47:19.550Z
Comments.Text: I’m voting to close this question because it’s not a bioinformatics question and should be on stack overflow instead.
Comments.UserDisplayName: user438383
Tags: <r><ggplot2>
Title: Removing missing categories from geom_bar
ThreadText: # Removing missing categories from geom_bar
  
  (Asked by: username_0 on 2023-06-12)
  
  I have a simple dataframe that includes points where the x values are 0, 1, 2, 3, 4, and 7. When I go to plot the data this is what ggplot2 gives me:
  
  [![enter image description here](https://i.sstatic.net/8JfDJ.png)](https://i.sstatic.net/8JfDJ.png)
  
  I only want to include the points mentioned above. How do I take out the instance of 5 and 6 in the bar plot?
  
  (I have tried googling the answer and nothing is coming up with my actual need so I figured I'd ask the community which might give an answer sooner - please be kind I know this is bound to have a simple solution)
  
  **Tags:** r, ggplot2
  
  > **Comments:**
  > **username_1**: I’m voting to close this question because it’s not a bioinformatics question and should be on stack overflow instead.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-06-13. Score: 4 | Accepted answer
  
  I was able to get it to work by converting the column in the dataframe to a character using this command:
  
  `df$day <- as.character(df$day)`
  
  and it worked like a charm! Thanks for your advice @haci
  
  > You can give a try by converting the column of numbers to a factor variable.
  
  [![enter image description here](https://i.sstatic.net/Aotfy.png)](https://i.sstatic.net/Aotfy.png)
  
  
  ---
  
  