我希望在我的情节中得到一个破X轴.在x轴上,我喜欢插入一个断轴符号< // >[从2开始到8结束,这意味着2-8将隐藏在< // >符号中],因此可以强调其他值.在Matlab中,此任务通过使用BreakXAxis执行.在R中,plotrix库只能插入一个断轴符号,就是这样.
x <- c(9.45, 8.78, 0.93, 0.47, 0.24, 0.12)
y <- c(10.72, 10.56, 10.35, 10.10, 9.13, 6.72)
z <- c(7.578, 7.456, 6.956, 6.712, 4.832, 3.345)
plot(x, y, col='blue', pch=16, xlab= 'x', ylab='y, z')
points(x, z, col='red', pch=17)
library(plotrix)
axis.break(1,2,style="slash")
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用此处提供的脚本制作 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)