我想在%y轴附加符号ggplot2.我使用scale_y_continuous(labels=percent)但它首先将值乘以100然后附加%符号,而我需要这样的东西35%而不是3,500%.
library(ggplo2)
library(scales)
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p + facet_grid(. ~ cyl)
p + facet_grid(. ~ cyl) + scale_y_continuous(labels=percent)
Run Code Online (Sandbox Code Playgroud)
将"%"粘贴到值上似乎工作正常
p + facet_grid(. ~ cyl) + scale_y_continuous(labels=function(x) paste0(x,"%"))
Run Code Online (Sandbox Code Playgroud)