0

I created a histogram using the following code:

 ggplot(aes(as.numeric(Q30_1))) + geom_bar(fill = "lightblue", col = "black") + labs(x= "my variable", y= "Frequency") + ggtitle("") 

The variable scales from 1 to 10 and I want to show the frequency of each value. However, the x-axis scale only shows four values (2.5, 5, 7.5, 10).

This is the picture

How can I display each value (like 1,2,3,..., 10) on the x-axis?

0

1 Answer 1

0
df1 <- data.frame(Q30_1 = sample(1:10, 5000, replace = TRUE)) ggplot(df1, aes(as.numeric(Q30_1))) + geom_bar(fill = "lightblue", col = "black") + scale_x_continuous(breaks = 1:10, minor_breaks = NULL) + labs(x= "The level of support for the BLM", y= "Frequency") 

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.