如何在R中的散点图中缩放轴?

时间:2016-04-21 10:43:51

标签: r plot ggplot2 scale axes

我在R中有一张表,但x轴和y轴的刻度是不可取的。如何缩放x轴和y轴以使图表上的点均匀?

我想要绘制两个值。

p2
[1]     0.061     0.380     1.000
[4]     3.880   140.900   861.460
[7]  7107.180 27262.082 61585.560

a3
[1]     0.058     0.378     1.000
[4]     3.540   140.810   867.910
[7]  7057.800 27155.500 61354.900

plot( 
      p2, 
      a3, 
      main="p2 vs a3", 
      pch=20, 
      type="o" 
  )

上面的代码给出了以下情节

enter image description here

我将如何操纵值和比例以使前几个值更普遍,并将图表显示为曲线而不是直线。 更像是这样:

enter image description here

1 个答案:

答案 0 :(得分:0)

你的标签是ggplot2,但你使用的是经典的R图。

你看起来似乎是x轴的对数转换。

情节:

Promise

如果要重新缩放两个轴:

plot(x = p2, y= a3, main="p2 vs a3", 
  pch=20, type="o",log = "x" 
)

使用plot(x = p2, y= a3, main="p2 vs a3", pch=20, type="o",log = "yx" )

ggplot2