タグ

ggplot2とanalyticsに関するnabinnoのブックマーク (102)

  • ggplot2で2軸プロットをする - Qiita

    2軸プロットが欲しくなるとき y軸が左右にあるいわゆる2軸プロットはExcelなんかでは簡単に作れるがggplot2では簡単には作れない。 つまりそもそもそんなもん作るなという話だが、欲しくなる場面はある。 例として気温(℃)と相対湿度(%)と飽差(Pa)をプロットする場合を挙げよう。飽差は気温と相対湿度から算出できる数値で、「乾きやすさ」の指標と考えてもらえればいい。 日常的な環境では、3つの変数のうち相対湿度が最も大きく変動するので、これらを1枚に収めると相対湿度の変動だけが目立ってしまう。したがって、相対湿度だけ第2軸に移してなんとかしたい、という動機が生ずる。 使用データ 上述の気温、相対湿度、飽差をプロットする例を想定し、次のように作成した。 ## function ---- svp <- function(t){ # 飽和水蒸気圧計算 Alduchov and Eskridge

    ggplot2で2軸プロットをする - Qiita
  • Cookbook for R

    Welcome to the Cookbook for R. The goal of the cookbook is to provide solutions to common tasks and problems in analyzing data. Most of the code in these pages can be copied and pasted into the R command window if you want to see them in action. Basics Numbers Strings Formulas Data input and output Manipulating data Statistical analysis Graphs Scripts and functions Tools for experiments My book ab