« [gfortran]エラーメッセージ「imported at (1), is also the name of the current program unit」 | トップページ | [R]文字列を日付に簡単に変換する »

2014年12月16日 (火)

[R]ggplot2パッケージによる図を、簡単に並べて表示する

gridExtraパッケージのgrid.arrange関数を使えばよい。以下、使用例。

> library(ggplot2)
> library(gridExtra)
> x <- c(1, 2, 3)
> y1 <- c(1, 4, 9)
> y2 <- c(9, 4, 1)
> y3 <- c(4, 4, 5)
> g1 <- qplot(x, y1)
> g2 <- qplot(x, y2)
> g3 <- qplot(x, y3)
> grid.arrange(g1, g2, g3, nrow = 2)

Figure4

« [gfortran]エラーメッセージ「imported at (1), is also the name of the current program unit」 | トップページ | [R]文字列を日付に簡単に変換する »

ggplot2」カテゴリの記事

R(グラフィックス)」カテゴリの記事

コメント

コメントを書く

コメントは記事投稿者が公開するまで表示されません。

(ウェブ上には掲載しません)

« [gfortran]エラーメッセージ「imported at (1), is also the name of the current program unit」 | トップページ | [R]文字列を日付に簡単に変換する »

無料ブログはココログ