我正在尝试使用此处提供的脚本制作 Y 轴损坏的 ggplot2 条形图
我的剧本
library(ggplot2)
dat <- read.csv("expression",header=T, check.names = FALSE)
dat
pd <- position_dodge(0.7) # move them .05 to the left and right
#Function to transform data to y positions
trans <- function(x){pmin(x,2) + 0.05*pmax(x-2,0)}
yticks <- c(0, 1, 2, 10,15,20,25,30)
#Transform the data onto the display scale
dat$mean_t <- trans(dat$value)
dat$sd_up_t <- trans(dat$value + dat$sd)
dat$sd_low_t <- pmax(trans(dat$value - dat$sd),1) #
png("test.png", units="in", family="Times", width=6, height=4, res=300) #pointsize is font size| increase image size to …Run Code Online (Sandbox Code Playgroud)