here's my problem:
with this simple example dataframe:
Samples = c("SRR9292593", "SRR9292593", "SRR9292593", "SRR9292594", "SRR9292594", "SRR9292594")
expression_gene = c(3.5, 0.4, 8.2, 4.5, 3.2, 3.1)
expression_intron = c(0.1, 0.1, 0.1, 0.5, 0.5, 0.5)
p <- data.frame(Samples, expression_gene, expression_intron)
I would like to make a boxplot with 2 x-axes, one indicating the values in "Samples", the other with the respective values in "expression_intron".
I tried this:
ggplot(p, aes(x=reorder(Samples, expression_intron), y=expression_gene)) +
geom_boxplot(color="black") +
scale_x_continuous(sec.axis = sec_axis(~ . * 1, breaks = c("SRR9292593", "SRR9292594"), labels = c("0.1","0.5")))
But it gives me this error:
Error: Discrete value supplied to continuous scale
How could i fix this?
Thanks in advance for the answers.