-3

SO私はこれに似たデータを持っています

Value   Number
3   1.5
6   1.67
9   1.7
12  1.6
15  1.7
18  1.8
21  1.9
24  1.98
27  1.98
30  1.8
33  1.84
36  1.5
39  1.7
42  1.9
45  1.9
48  2.0
51  1.21
54  1.4
57  2.34
60  2.5
63  2.1
66  1.77

標準エラーバーを使用して散布図を作成するにはどうすればよいですか....調べてみると、次のようになります

errbar(df$Value, df$Number, yplus, yminus, cap = 0.015,
       xlab= deparse(substitute(x)),
       ylab= deparse(substitute(y)))

しかし、私はyplus、yminusに慣れていませんか?そしてデパース?? これを行う他の方法はありますか?私はggplotを使ってみて、install.packages(ggplot2)を使ってダウンロードしましたが、Rはそれが見つからないと言い続け、このコードで試しました

> ggplot(data=dataset,aes(x=df$Value,y=df$Number,colour=Code,linetype=Group,ymin=Mean-SE,ymax=Mean+SE)) 
Error: could not find function "ggplot"
> + geom_line()
Error: could not find function "geom_line"
> + scale_x_continuous(breaks=c(1,2))
Error: could not find function "scale_x_continuous"
> + scale_linetype_manual(values=c(2,1))
Error: could not find function "scale_linetype_manual"
> + geom_point()
Error: could not find function "geom_point"
> + geom_errorbar(width=.1,position='dodge')
Error: could not find function "geom_errorbar"

また、x 軸に同じ値を使用して 1 つのグラフに 2 つの散布図をプロットし、エラー バーも表示するにはどうすればよいですか? みんなありがとう...どんな提案でも感謝します

4

2 に答える 2

4

表示されるエラーは、ggplot2パッケージが読み込まれていないためです。スクリプトに追加library(ggplot2)すると、これが修正されます。ggplot2もちろん、これはパッケージがインストールされていることを前提としています。install.packages("ggplot2")そうでない場合は、これを修正するために使用します。

于 2013-04-24T06:52:37.393 に答える
0

別の方法として、R のパッケージを使用することもできgplotsます。これは非常に優れていて、扱いが簡単です (少なくとも私の意見では)。

# Required package
library(gplots)

# Sample data
x <- seq(3, 66, 3)
y <- c(1.5, 1.67, 1.7, 1.6,  1.7,  1.8,  1.9,  1.98,  1.98,  1.8,  1.84,  
       1.5,  1.7,  1.9,  1.9,  2.0,  1.21,  1.4,  2.34,  2.5,  2.1,  1.77)
xy <- data.frame(x, y)

# Plotting
plotCI(x, y, 
       uiw = .5, gap = 0, pch = 22, pt.bg = "green")

もちろん、引数uiwliwエラー ベクトルを置き換える必要があります。

乾杯、フロリアン

于 2013-04-24T08:30:19.253 に答える