I have a dataset of 21071445 rows x 29 columns called vir.blast. For technical reasons I can't upload it here:
Wanting to plot it with ggplot using the following code:
ggplot<-ggplot(vir.blast, aes(x = bitscore, fill = read, colour = read)) +
geom_density(alpha = 0.25, adjust = 4) +
xlim(0, 350) +
geom_vline(data = mu.pe.bs, aes(xintercept = grp.mean,
color = factor(read)),
linetype = "dashed") +
theme_minimal()
ggplot + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))
I get the following message:
Error: Discrete value supplied to continuous scale
I didn't get this error before and I haven't changed the type of data.frame. What am I doing wrong? How can I solve that?
Well, after much research I have seen that the problem was the class of the variable to represent. This needs to be in factor format, so I've fixed it with the function: vir.blast$read <- as.factor(vir.blast$read) and it's already plotted the result.