2017-10-28 62 views
1

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

我需要在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

您应该使用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" 
) 
+0

感谢的,但我可以做到这一点与stripplot图形? – LuckyProgrammer

+0

你不应该,因为stripplot是一个单变量散点图。这意味着其目的是只绘制一个量化变量,也许由几个因素分开。这就是为什么你的Y轴数据被视为因素。 – jsb

+0

好的,请告诉我除'xyplot'外还有什么其他图形可以用于两个变量?我需要使用六种不同的图形来分析数据。条形图,dotplot,bwplot也无法正常工作。 – LuckyProgrammer