R绘制不均匀的轴

Sea*_*ean -1 plot axis r

所以我在R中创建了这个简单的线图,我想知道如何将y轴从图片中的内容更改为:

1000000
100000
10000
1000
100
10
1
Run Code Online (Sandbox Code Playgroud)

并且x轴也只是从1到25跨越,包括每个刻度.

我试过了:

plot(dataTable[0:25], axes=FALSE)
axis(1, at=seq(0, 25, 1))
axis(2, at=c(1,10,100,1000,10000,100000,1000000))
Run Code Online (Sandbox Code Playgroud)

dataTable的位置如下所示:

1      2      3      4      5      6      7      8      9      10      11 
621266 496647 436229 394595 353249 305882 253983 199455 147380 102872 67255 
12     13     14     15     16     17     18     19     20     21     22 
41934  24506  13778  7179   3646   1778   816    436    217    114    74 
23     24     25     
49     44     26 
Run Code Online (Sandbox Code Playgroud)

但我一直在努力

Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' and 'y' lengths differ
Run Code Online (Sandbox Code Playgroud)

任何帮助?

R输出:

42-*_*42- 5

阅读?par?axis.需要抑制x轴构造,然后稍微缩小轴标签的大小,使它们适合刻度线之间的可用空间.并需要指明log="y":

d2 <- scan()
621266 496647 436229 394595 353249 305882 253983 199455 147380 102872 67255 41934  24506  13778  7179   3646   1778   816    436    217    114    74 49     44     26
Run Code Online (Sandbox Code Playgroud)

编辑提供请求的缩放,我最初误解了)

 png()
plot(d2, type ="b", log="y",axes=FALSE, ylim=c(1,10^7))
axis(2, at=10^(0:6), labels=formatC(10^(0:6),format="f", digits=0),
     cex.axis=0.8,las=2 )
axis(1, at=1:25, cex.axis=.6)
dev.off()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述