更改图形轴上的图表值。语言R

时间:2017-10-28 20:38:09

标签: r lattice graphic

我需要在垂直y轴上更改图表值。我有这样的数据。 enter image description here

我需要y轴上的值是GNP的值,从500到3000,而不是从1到20。 这是我绘制图形的代码。

      library(lattice)
      data(Investment, package="sandwich")
      Investment <- as.data.frame(Investment)
      stripplot(Investment$GNP~Investment$Investment|"Graphic", 
      right = F, xlab="Investment", ylab="GNP")

enter image description here

提前谢谢

1 个答案:

答案 0 :(得分:1)

您应该使用xyplot代替:

library(lattice)
data(Investment, package = "sandwich")
Investment <- as.data.frame(Investment)

xyplot(
  x = GNP ~ Investment | "Graphic",
  data = Investment,
  right = F,
  xlab = "Investment",
  ylab = "GNP"
)