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]
- Error: stat_bin() must not be used with a y aesthetic.
- R: Data frame index error “unexpected token”
- R Language Error: variable does not have limits defined by datadist
- [Solved] Error in inherits(x, “theme”): argument “e2” is missing, with no default
- [Solved] Arcgis Error: The number of points is less than required for feature
- [Solved] Error: ‘attrition‘ is not an exported object from ‘namespace:rsample‘
- [Solved] Opencv error: assertion__acrt_first_block == header
- [Solved] kitt2bag Error: Failed to find match for field intensity
- [Solved] Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), v
- RuntimeError: CUDNN_STATUS_EXECUTION_FAILED [How to Solve]
- OpenCV4 Error: imread(argv[1], CV_LOAD_IMAGE_COLOR);
- [Rails 6] How to deal with ActiveRecord :: RecordInvalid: Validation failed:
- [Solved] Qt UpdateLayeredWindowIndirect failed for ptDst Error
- Kafka executes the script to create topic error: error org apache. kafka. common. errors. InvalidReplicationFactorException: Replicati
- Solution to latex “too many unprocessed floats” error
- [Solved] Kafka Error: InvalidReplicationFactorException: Replication factor:
- Opencv c++ Read Video Error: capture.isOpened() Return false
- Scanf_S always reports errors [How to Solve]
- How to Solve Error Swift 4 Expression type ‘@value CGRect’ is ambiguous without more context