Error: discrete value supplied to continuous scale
#Simulation data
set.seed(123)
my_df1 <- data.frame(a=rnorm(100), b=runif(100), c=rep(1:10, 10))
my_df2 <- data.frame(a=rnorm(100), b=runif(100), c=factor(rep(LETTERS[1:5], 20)))
#Error: Discrete value supplied to continuous scale
ggplot() +
geom_point(data=my_df1, aes(x=a, y=b, color=c)) +
geom_polygon(data=my_df2, aes(x=a, y=b, color=c), alpha=0.5)
#Solution:
Use the fill parameter;
ggplot() +
geom_point(data=my_df1, aes(x=a, y=b, color=c)) +
geom_polygon(data=my_df2, aes(x=a, y=b, fill=c), alpha=0.5)
Read More:
- Error: Discrete value supplied to continuous scale [How to Solve]
- R Language Error: variable does not have limits defined by datadist
- [Solved] R Language Error: Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error)
- R Language: How to Solve featureplot function Error
- R language: How to Solve DMwR Install Error
- R language Use setwd() function Error [How to Solve]
- R language learning problem solving error in output $nodeid: $operator is invalid for atomic vectors
- [Solved] R Language Error: duplicate ‘row.names’ are not allowed
- [Solved] R Language Error: Error in file(out, “wt“) : cannot open the connection
- [Solved] AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
- R: Data frame index error “unexpected token”
- Implement base64_decode in GO language to solve the problem of illegal characters
- C Language error: two or more data types in declaration specifiers
- [Solved] Go language gob serialization pointer cannot be addressed Error
- Go Language Error: main redeclared in this block [How to Solve]
- Template cannot be rendered due to the joint query of populate in mongoose: syntax error: unexpected token r in JSON at position 0
- ANASYS2020R2 mesh script error [How to Solve]
- Stata Comment // Error / invalid name r(198); [How to Solve]
- Error: could not find function … in R [How to Solve]
- Matlab R2019b License Manager Error -103 [How to Solve]