0

I have a set of a data I'm working on but can't seem to organize the bin size of my data

vgsales %>% 
  ggplot(aes(User_Score)) +
  geom_bar()

The bins are all crowded and not sure how to make them look nicer:

The bins are all crowded and not sure how to make them look nicer.

I would like them to range from 1-10 but with a bin size of 0.5. Unsure how to do that. I'm a beginner and in need of help.

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
  • [See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on making an R question that folks can help with. You're referring to bin sizes, which implies a histogram, but then drawing a bar plot. I'm going to guess that you've got data in a type you're not expecting (maybe a factor?), but without any data, guessing is the best anybody can do – camille Dec 07 '19 at 01:31

1 Answers1

0

First, it appears that User_Score is a factor or character, not numeric. Second, it looks like you may need geom_histogram() rather than geom_bar.

You could try the following to see if they make any differences:

vgsales %>% 
  mutate(x = as.numeric(as.character(User_Score))) %>% 
  ggplot(aes(x)) +
  geom_bar()

or

vgsales %>% 
  mutate(x = as.numeric(as.character(User_Score))) %>% 
  ggplot(aes(x)) +
  geom_histogram()
Zhiqiang Wang
  • 6,206
  • 2
  • 13
  • 27