はじめに Rには、“ggplot2”というライブラリがある。このライブラリを使うと、デフォルトの作図コマンドよりも効率的に作図ができ、しかも分かりやすくて美しい図を描くことができる。美しい図といってもピンと来ないかもしれないが、百聞は一見にしかず、下の2つの図を比べてもらいたい。1つ目の白い背景の図がRのデフォルトの作図コマンドで作成された散布図である。2つ目の灰色の背景の図が“ggplot2”を使った散布図である。 Rのデフォルトの作図機能を使った場合の散布図の例 “ggplot2”を使った場合の散布図の例 以下では、“ggplot2”のコンセプトと簡単な作例を紹介したいと思う。最初は抽象的な話をする。このため、最初から読んで分かりづらかったら、後の方の作例を先に見た方が理解が早いかもしれない。 “ggplot2”のコンセプト “ggplot2”は、どのように作図を行っているのであろうか
このページでは, Rのグラフィクスパッケージであるggplotのインストールの仕方と, 使い方の流れを解説していきます. ggplotをインストールする Rを開いて, 以下のように打てば, インストール出来ます. ggplotの使い方の流れ ggplotの基本的な使い方を解説してみようと思います. このページでは, 使い方の流れを説明していくつもりです. それぞれの関数の細かい使い方については, Rのカテゴリを参照して下さい. 基本的には, ggplot2パッケージを読み込む データを用意する. 軸にするデータの種類を決める. 描きたいグラフごとにggplotの関数を呼ぶ. という流れになります. では, 簡単に散布図を作ってみます. ちなみに, このページでは, データセットとしてRにデフォルトで入っているirisというデータセットを使用します. > library(ggplot2) >
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く