文書の過去の版を表示しています。
08.ggplot2でグラフの体裁を調整
グラフ全体の大きさと解像度
タイトルとx軸y軸
タイトルがデフォルトだと左寄り。中央寄せにしたいときはthemeにelement_text(hjust = 0.5)を指定します。
ggplot() + ggtitle("Use theme(plot.title = element_text(hjust = 0.5)) to center") + theme(plot.title = element_text(hjust = 0.5))
scale_x_continuous(breaks = seq(10, 100, by = 10)) scale_x_log10(limit = c(0.1 , 10)) scale_y_log10(breaks = c(1, 5, 10)* 1000)
値を変えずに座標軸を変える
scale_*
coord_*
coord_cartesian(ylim = c(800, 12000)) labs(title = "Diamonds", x = "Size(carat)", y = "Price(USD)")
使用する関数
- labs()
- xlab()
- ylab()
- ggtitle()
http://motw.mods.jp/R/ggplot_labs.html
ggplotでの軸ラベル, タイトルの扱い方
https://notchained.hatenablog.com/entry/2016/10/15/134938
2016-10-15
ggplot2 2.2.0 を使ってみる
http://mukkujohn.hatenablog.com/entry/2016/10/11/220722
2016-10-11
ggplot2を使って、軸を制御する-3
http://yutakahogeta.blogspot.com/2014/09/ggplot2_8.html?m=1
2014年9月8日月曜日
ggplot2で作図4:デザイン
ggplot2でグラフの体裁を整える関連のリンク
https://heavywatal.github.io/slides/nagoya2018/2-ggplot.html
http://nfunao.web.fc2.com/files/R-ggplot2.pdf
ggplot2 パッケージの入門スライド
ggplot2で白黒グラフ
https://qiita.com/yuifu/items/83103d03aef2dba95465
@yuifu
2015年03月10日に投稿
ggplot2で論文用の図を作るときに使いたいオプション(点のshape、色、軸の文字の大きさ、色、エラーバー、背景)
http://datascience-blog.com/2019/05/06/post-50/
ggplot2: 棒グラフに置いたテキストがグラフの枠からはみ出る問題を解決したい (geom_blank)
2019年5月6日2019年5月22日
https://blog.atusy.net/2018/11/10/ggplot2-legend-pos-n-just/
ggplot2のレジェンド位置を調整
2018-11-10 by Atusy
リンク