rlatticegraphic

Change chart values on the graphic axes. Language R


I need to change chart values on the vertical y axes. I have such a data. enter image description here

I need that on the y axes will be values like GNP has, from 500 to 3000, not from 1 to 20. Here is my code for drawing graphic.

      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

Thank you in advance


Solution

  • You should use an xyplot instead:

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