ユーザ用ツール

サイト用ツール


ggplot2でタイトルとx軸y軸の設定

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
ggplot2でタイトルとx軸y軸の設定 [2018/08/12] – [x軸の値が離散値(?)の場合] adash333ggplot2でタイトルとx軸y軸の設定 [2020/08/12] (現在) – [ggplot2でタイトルとx軸y軸の設定] adash333
行 1: 行 1:
 ====== ggplot2でタイトルとx軸y軸の設定 ====== ====== ggplot2でタイトルとx軸y軸の設定 ======
 +[[初めての医療統計:index.html|初めての医療統計 目次]]
  
 ggplot2でグラフを描いた後に、タイトルを中央に記載したり、y軸の値の範囲の設定、x軸のラベルの値の変更などについて記載します。 ggplot2でグラフを描いた後に、タイトルを中央に記載したり、y軸の値の範囲の設定、x軸のラベルの値の変更などについて記載します。
行 6: 行 7:
 2017/12/30 2017/12/31 \\ 2017/12/30 2017/12/31 \\
 http://twosquirrel.mints.ne.jp/?p=21665 http://twosquirrel.mints.ne.jp/?p=21665
 +
 +===== ソースコード =====
 +https://colab.research.google.com/drive/1yPHODB6sgUU9OJx48tEibAF9rnUHDv-s?usp=sharing#scrollTo=M0KdH1hDF0l8
  
 ===== 開発環境 ===== ===== 開発環境 =====
  
-RStudio Cloudのconsole画面(画面左下)で、install.package("tidyverse")を入力して、tidyverseパッケージをインストールした状態とします。+RStudio Cloudのconsole画面(画面左下)で、install.packages("tidyverse")を入力して、tidyverseパッケージをインストールした状態とします。
  
 参考:http://twosquirrel.mints.ne.jp/?p=26918 参考:http://twosquirrel.mints.ne.jp/?p=26918
行 15: 行 19:
 ===== グラフタイトルをグラフ上部中央に記載する ===== ===== グラフタイトルをグラフ上部中央に記載する =====
  
 +
 +<code>
 +ggplot() +
 +  ggtitle("Use theme(plot.title = element_text(hjust = 0.5)) to center") +
 +  theme(plot.title = element_text(hjust = 0.5))
 +</code>
 +
 +参考:https://codeday.me/jp/qa/20190317/372133.html
  
 ===== x軸の値を変更する ===== ===== x軸の値を変更する =====
行 62: 行 74:
 </code> </code>
  
 +===== 軸のラベルの書き換え =====
  
 +<code>
 +# y軸のラベルの書き換え
 +labs(y="Length")
 +</code>
 ===== グループによって少しだけx軸方向にずらす ===== ===== グループによって少しだけx軸方向にずらす =====
  
行 92: 行 109:
 <iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=twosquirrel-22&language=ja_JP&o=9&p=8&l=as4&m=amazon&f=ifr&ref=as_ss_li_til&asins=487311814X&linkId=0c89d7378632a8fa2f9442eb6408bf53"></iframe> <iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=twosquirrel-22&language=ja_JP&o=9&p=8&l=as4&m=amazon&f=ifr&ref=as_ss_li_til&asins=487311814X&linkId=0c89d7378632a8fa2f9442eb6408bf53"></iframe>
 </html> </html>
 +
 +===== リンク =====
 +目次:[[初めての医療統計:index.html|初めての医療統計 目次]]
 +
 +
 +

ggplot2でタイトルとx軸y軸の設定.1534117034.txt.gz · 最終更新: 2018/10/07 (外部編集)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki