首页 > 解决方案 > 记录堆叠条形图的 y 轴并调整 y 轴标签以匹配

问题描述

当前代码输出不同地点的物种堆积条形图。我希望对 y 轴进行 log10 以提供更简洁的视图。并相应地调整 y 轴刻度标签,使其读取 log10 数字。

我已经尝试过scale_y_log10包括不同的休息和标签,但成功有限

species<-read.table('species.txt',header=TRUE)
library(ggplot2)
ggplot(species, aes(x = site, y = number, fill = species)) + 
  geom_bar(stat = "identity")+
  theme(legend.position="none")+
  labs(y="Number of Individuals",x="Sites")

标签: rggplot2

解决方案


推荐阅读