2017-02-03 8 views
0

正規分布からランダムベクトルを生成し、ヒストグラムをプロットしました。R:ビンカウントとビンの区切りを使ってヒストグラムを得る

私は各ビンの数を変更し、同じブレーク(break_vector)と新しいビンカウントベクトル(new_counts)を持つ別のヒストグラムをプロットしたいと思います。

どうすればよいですか?

私はbarplot()を試しましたが、ビンのラベルを表示する方法が異なります。

x = rnorm(500,1,6) 
delta = 1 
break_vector = seq(min(x)-delta,max(x)+delta,by=delta) 
hist_info = hist(x,breaks=break_vector) 

new_counts = hist_info$counts+5 

答えて

1

new_hist <- hist_info 
new_hist$counts <- hist_info$counts + 5 
plot(new_hist) 
をお試しください
関連する問題