Oh heya, So I copy pasted necessary things in a new excel, loaded it and checked the class of pvalue (it's numeric) and still getting the same error of supplying discrete value to continuous scale :(
help with ggplot
So here's the snip of the ORA result provided to me and I want to plot dotplot using ggplot.

ggplot(data = test12,
aes(x = Condition, y = GO, size = FoldChange)
) +
geom_point(aes(color = 'P-value')) +
scale_color_gradient(low = "blue", high = "red")
It's giving me error: Discrete value supplied to continuous scale
Any idea what I might be doing wrong. Any help is appreciated!
• 2,368 views
•
link
1 answer
It could be that your p-value is of character class. Check that. Your code works fine in my example:
dat12 <- data.frame(
GO=LETTERS[1:6],
Condition = c("+","-","+","-","+","-"),
FoldChange = sample(1:10,6),
pvalue = c(4.2E-02, 2.05E-02, 1.89E-03, 1.44E-02, 1.78E-06,7.04E-03)
)
dat12
GO Condition FoldChange pvalue
1 A + 8 4.20e-02
2 B - 10 2.05e-02
3 C + 6 1.89e-03
4 D - 4 1.44e-02
5 E + 3 1.78e-06
6 F - 2 7.04e-03
ggplot(dat12,
aes(x = Condition, y = GO, size = FoldChange)) +
geom_point(aes(color=pvalue)) +
scale_color_gradient(low = "blue", high = "red")
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.
What is the output to:
But before that, why are you trying to set
colorusing a continuous value? Shouldn't you bin the p-value then set a color based on, say, if the pvalue < 0.05 or >=0.05?oh hey, they are as follow:
I am so sorry but I am not sure what you mean by continuous value and bin the p-value, also, results are taken from DAVID I guess so only p-value of <0.05 are exported