I save acquiring the Error: Discrete value gave to constant range for the complying with code

ggplot(ENGR_293_TEST, aes(x="X", y="Y")) +annotation_custom(court, 0, 50, 0, 47) +geom_point(aes(colour = "red", shape = Result)) + scale_shape_identity() +xlim(0, 50) +ylim(0, 47)

Here is the information


Obelisk names inside of ggplot() so not must be quoted. I additionally rerelocated the call to annotation_custom() because the court variable is not obtainable.

You are watching: Error discrete value supplied to continuous scale



ggplot(DF, aes(x=X, y=Y)) + #annotation_custom(court, 0, 50, 0, 47) + geom_point(aes(colour = "red", shape = Result)) + scale_shape_identity() + xlim(0, 50) + ylim(0, 47)

Thank you so a lot however I currently get a brand-new error

> DF ggplot(DF, aes(x=X, y=Y)) ++ annotation_custom(court, 0, 50, 0, 47) ++ geom_point(aes(colour = "red", form = Result)) + scale_shape_identity() ++ xlim(0, 50) ++ ylim(0, 47)Error in y : object of form "closure" is not subsettable
Hi, and also welcome!

Your question comes cshed to including a reproducible instance, dubbed a reprex, yet falls a bit short. Having a reprex attracts more and useful answers. The information do not need to be a complete set, or also your actual data. They can be a integrated data set with the very same framework or simply a item.

So, let"s look at the screenswarm. Amongst X, Y, Result and also Pxt, which are discrete and also which are continuous?

ggplot(ENGR_293_TEST, aes(x="X", y="Y"))invokes 2 that take on a number of different values. (A preeminence of thumb is you deserve to try dealing with as constant any variable via even more than 10 numeric values).

We have the right to ignore annotation_custom, xlim and ylim and also scale_shape_identity() for now and also focus on geom_point. We check out immediately that Pxy isn"t implicated, so the concern comes dvery own to Result, which indeed is discrete--1 or 0, nothing more, nopoint much less and also nopoint in in between.

Why execute we care?

First off, everyone working in ggplot listed below the Jedi level sees this a lot. Plus, of course, it"s in the way of a display screen of your information.

Take a look at help(geom_point). Both aes disagreements are optional. We deserve to discard colour and also emphasis on form.

See more: " Vikings Season 1 Ep 8 - Vikings Sacrifice (Tv Episode 2013)

Looking at the

Shape takes 4 forms of values: an integer in <0, 25>,a single character-- which uses that character as the plotting symbol,a . to attract the smallest rectangle that is visible (i.e., about one pixel)an NA to attract nothing

While Result is an integer, which one? Here, the dispute being tried to find is a continuous range from 0 to 25, not a discrete range of 0 or 1.

Let"s action back though and ask what perform you want the form of the points to reflect? Is it simply to identify zero and one in Results?