A suffering student adding a discrete value to a continuous scale.

newdf2%>%
ggplot(aes(x = as.factor(hPossesion),
y = hgoals)) + scale_x_continuous(limits=c(0,100),breaks=c(seq(from = 0,to = 100,by = 10)))+
geom_boxplot()+
labs(y = "Goals Scored",
x = "Possession (Percentage)",
title = "Possession vs. Goals Scored")

What is your question? Please take a look at the homework policy FAQ: Homework Policy and some information on creating a reproducible example (reprex) FAQ: How to do a minimal reproducible example ( reprex ) for beginners

I can see how it would be helpful to actually state what I needed help with! Sorry for that, I'll review that now.

Okay, so I'm running into an issue with creating a discrete interval along the x-axis of a scatter plot. I have a domain of 0-100, but the interval between each step is too close together to create a decent looking graph. Right now, when I try to create a discrete step in-between values, it populates with an error of "Error: Discrete value supplied to continuous scale".

There are some conflicting aspects of your ggplot code and your description of your goal. Your axis labels say you want to plot Goals Scored vs. Percentage Possession, you say you want a scatter plot and you use scale_x_continuous in your code. That all makes sense. In your code, you make the hPossesion a factor with as.factor(). That is not compatible with having a continuous x axis. You also use geom_boxplot() which does not lead to a scatter plot and is used with a discrete x axis.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.