set.seed(12346)
my.df <- data.frame(x = rnorm(50, sd = 4), y = rnorm(50, sd = 4))
# we assume that both x and y values are expressed as log2 fold change
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC() +
scale_y_logFC()
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC(labels = scales::trans_format(function(x) {log10(2^x)},
scales::math_format())) +
scale_y_logFC(labels = scales::trans_format(function(x) {log10(2^x)},
scales::math_format()))
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC(log.base.labels = 2) +
scale_y_logFC(log.base.labels = 2)
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC("A concentration%unit", log.base.labels = 10) +
scale_y_logFC("B concentration%unit", log.base.labels = 10)
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC("A concentration%unit", breaks = NULL) +
scale_y_logFC("B concentration%unit", breaks = NULL)
# taking into account that data are expressed as log2 FC.
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC("A concentration%unit", breaks = log2(c(1/100, 1, 100))) +
scale_y_logFC("B concentration%unit", breaks = log2(c(1/100, 1, 100)))
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC(labels = scales::trans_format(function(x) {log10(2^x)},
scales::math_format())) +
scale_y_logFC(labels = scales::trans_format(function(x) {log10(2^x)},
scales::math_format()))
# override "special" default arguments.
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC("A concentration",
breaks = waiver(),
labels = waiver()) +
scale_y_logFC("B concentration",
breaks = waiver(),
labels = waiver())
ggplot(my.df, aes(x, y)) +
geom_point() +
scale_x_logFC() +
scale_y_logFC() +
geom_quadrant_lines() +
stat_quadrant_counts(size = 3.5)
Run the code above in your browser using DataLab