R -调整x轴的y值

yzckvree  于 2023-11-14  发布在  其他
关注(0)|答案(1)|浏览(127)

我有一些数据,我想以图形方式显示。这是它的样子:

data<- c(0.119197746, 0.054207788, 0.895580411, 0.64861727, 0.143249592, 
0.284314897, 0.070027632, 0.297172433, 0.183569184, 0.713896071, 
1.942425326, 1)

字符串
使用此命令:

barplot(data, main="Ratio of Lipidated and Unlipidated LC3 I & II forms\nNormalized
to GAPDH", names.arg = c("PT250", "PT219", "PT165", "PT218", "PT244", "PT253", "PT279", "PT281",    
"PT240", "PT262", "PT264", "CCD"), ylab = "Fold LC3 II/LC3I/GAPDH")


我制作了这个图表:


的数据
我想将X轴定位在1处,这样所有小于1的值都将显示为向下条。我可以通过简单地从所有值中减去1并再次绘制来实现所需的效果,但这会导致y轴上的数字不准确。有什么方法可以让R将小于1的值绘制为向下条吗?

kmbjn2e3

kmbjn2e31#

具有自定义轴的解决方案。

barplot(data - 1, main = "Ratio of Lipidated and Unlipidated LC3 I & II forms\nNormalized to GAPDH",
        names.arg = c("PT250", "PT219", "PT165", "PT218", "PT244", "PT253", "PT279", "PT281", "PT240", "PT262", "PT264", "CCD"),
        ylab = "Fold LC3 II/LC3I/GAPDH",
        axes = F,
        ylim = c(-1, 1))

my_labs <- seq(-1, 1, by = 0.5)
axis(side = 2, at = my_labs, labels = my_labs + 1)

字符串


的数据

相关问题