Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改图形轴上的图表值。语言R_R_Lattice_Graphic - Fatal编程技术网

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

更改图形轴上的图表值。语言R,r,lattice,graphic,R,Lattice,Graphic,我需要更改垂直y轴上的图表值。我有这样的数据。 我需要y轴上的值,像GNP一样,从500到3000,而不是从1到20。 这是我画图形的代码 library(lattice) data(Investment, package="sandwich") Investment <- as.data.frame(Investment) stripplot(Investment$GNP~Investment$Investment|"Graphic",

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

我需要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")
库(晶格)
数据(投资,包=“三明治”)

投资您应该使用
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"
)
库(晶格)
数据(投资,包=“三明治”)

谢谢你的投资,但是我可以用条带图图形来做吗?你不应该,因为条带图是一个单变量散点图。这意味着它的目的是只绘制一个定量变量,可能由几个因素分开。这就是为什么y轴数据被视为因子。好的,请告诉我除了
xyplot
之外,我还可以用什么图形来表示两个变量?我需要使用六种不同的图形来分析数据。条形图、点图、BWClot也无法正常工作。您可以从基本
图形
使用
plot
,或从
ggplot2
使用
ggplot
。这些是我的建议。我想
lattice
包有点麻烦。我只需要使用lattice包中的图形。那么除了
xyplot
之外,没有其他选项了吗?