我尝试使用R的ggplot2来创建密度图,但是,一旦我给scale_y_log10()
以获得对数y轴,该图本身就会反转。 如何更正此问题以获得类似于下面所示的预期结果?
fd <- read.csv('data.csv')
fd_factor <- factor(fd$XDIndicator, levels = c("a","b","c"),
labels = c("a","b","c"))
p <- ggplot(fd, aes(x = KTotal, fill = factor(fd_factor))) +
geom_density(alpha = 0.2, na.rm = TRUE) +
xlab('Total collaboration degree') + ylab("PDf") +
scale_y_log10()
ggplotly(p)