I run into the error when trying to plot a line chart using ggpubr::ggline. Below are the codes:
#getting the dataset
pd_RecThematicity <- read.csv("Lower_CRF_PDP/pd_RecThematicity.csv")
#plotting
ptg_RecThematicity<- ggline(pd_RecThematicity,
x="RecThematicity",
y="yhat",
facet.by="variant")+
scale_x_continuous(name = "Recipient Thematicity")+
scale_y_continuous(name = "Predicted odd of variants",
labels = c("0","0.5", "1"),
limits = c(0,1),
breaks = c(0,0.5,1))+
geom_smooth() +
theme_classic2(base_size=12, base_family="Arial")
ggsave("pdp_RecThematicity.png",ptg_RecThematicity, width=6, height=4, units="in", dpi = 1000, type = "cairo")
And then R returns the error "Error: Discrete value supplied to continuous scale". However, I can confirm that the factors entered in both x and y axis are numeric (and R recognizes them as numeric when I check them in view(pd_RecThematicity)). The dataset can be downloaded in this OSF page.
