I'd like to plot a scatterplot with the data below using minimum.sptm
in X-axis and p.value
on Y-axis.
The point is, I'd like the -log(p.value)
but displaying the p.value
.
structure(list(minimun.sptm = c(0, 0.05, 0.1, 0.15, 0.2, 0.25,
0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85,
0.9, 0.95, 1), p.value = c(0.217137180894596, 8.69138632923479e-06,
5.19743435092154e-13, 2.86015251354523e-14, 5.51211423760726e-30,
1.06397214811093e-34, 3.15922010250516e-36, 1.54383374085175e-36,
3.17487635201757e-36, 1.65512592209202e-36, 2.19511495850264e-36,
1.39210307866501e-36, 1.55834678312407e-35, 7.23531845274866e-34,
9.6298173273593e-34, 2.05019326670673e-34, 6.9030663073707e-32,
1.33364294302178e-32, 1.26879586574242e-28, 9.22917969013045e-37,
3.31136440476303e-06)), row.names = c(NA, -21L), class = c("tbl_df",
"tbl", "data.frame"))
I tried:
tt %>%
ggplot(
aes(
x= minimun.sptm,
y = p.value
)
) +
geom_point() +
scale_y_continuous(trans = "log") +
theme_classic() +
theme(axis.text.x = element_text(angle=-45))
But I want the Y-axis inverted and I didn't find the right function.
I tried scale_y_continuous(trans = "-log")
but it doesn't work.
I also tried:
tt %>%
ggplot(
aes(
x= minimun.sptm,
y = p.value
)
) +
geom_point() +
scale_y_continuous(trans = "log") +
scale_y_reverse() +
theme_classic() +
theme(axis.text.x = element_text(angle=-45))
And I got the error:
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Another try was:
tt %>%
ggplot(
aes(
x= minimun.sptm,
y = p.value
)
) +
geom_point() +
scale_y_log10() +
scale_y_reverse() +
theme_classic() +
theme(axis.text.x = element_text(angle=-45))
Which also didn't work.
Any help is appreciated