The plotting code below gives Error: Discrete value supplied to continuous scale
I already tried this solution mentioned by stack overflow community but none of them is working. I don't know what wrong with this code.
What's wrong with this code?
#Library Download
library(ggplot2)
library(dplyr)
library(ggthemes)
#Setting Working Directory
setwd("")
getwd()
#Main Code
data <- read.csv("Test2.csv",header=TRUE)
str(data)
xd <-factor(data$SampleID)
g <- ggplot()
g <- g + geom_bar(data= data,aes(x = xd, y = Average.of.Result,group=Element,color=Element),stat='identity',
position="dodge",
na.rm = FALSE,
show.legend = NA,
fill = rgb(0, 0, 0.8)
)+
theme_minimal(base_size = 12, base_family ="Segoe UI")+
geom_line(data=data,aes(x=xd,y=X10xDL,group=Element), size=1.25,color="blue",linetype = "dashed")+
geom_line(data=data,aes(x=xd,y=Expected.Value,group=Element), size=1.25,color="red",linetype = "dashed") +
theme_minimal(base_size = 12, base_family ="Segoe UI")
g
Dataset Attached here
Any help???