サルでもわかるWEBプログラミング

フリーソフトのみでホームページ作成

ユーザ用ツール

サイト用ツール


00.初めての医療統計rとezr:08.ggplot2でグラフの体裁を調整


差分

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

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
00.初めての医療統計rとezr:08.ggplot2でグラフの体裁を調整 [2019/10/22] – [タイトルとx軸y軸] adash33300.初めての医療統計rとezr:08.ggplot2でグラフの体裁を調整 [2022/02/22] (現在) – [タイトルとx軸y軸] adash333
行 1: 行 1:
 ====== 08.ggplot2でグラフの体裁を調整 ====== ====== 08.ggplot2でグラフの体裁を調整 ======
 +[[00.初めての医療統計rとezr:index.html|初めての医療統計RとEZR]]
 +
 +
  
 前回の[[00.初めての医療統計rとezr:07.colaboratoryで箱ひげ図と蜂群図|07.Google ColaboratoryでRで箱ひげ図と蜂群図(ほうぐんず)]] 前回の[[00.初めての医療統計rとezr:07.colaboratoryで箱ひげ図と蜂群図|07.Google ColaboratoryでRで箱ひげ図と蜂群図(ほうぐんず)]]
 +
 +===== ggplot2で論文用の白黒のグラフをかく =====
 +
 +
 +[[https://i-doctor.sakura.ne.jp/dokuwiki/doku.php/ggplot2%E3%81%A7%E8%AB%96%E6%96%87%E7%94%A8%E3%81%AE%E7%99%BD%E9%BB%92%E6%8A%98%E3%82%8C%E7%B7%9A%E3%82%B0%E3%83%A9%E3%83%95|ggplot2で論文用の白黒折れ線グラフ]]
 +
 +===== エスキス =====
 +[[https://dreamrs.github.io/esquisse/index.html|esquisseエスキス]]
 +
 +<code>
 +# RStudioの場合は、Console画面で、以下を入力
 +install.packages("esquisse")
 +# remotes::install_github("dreamRs/esquisse")
 +
 +# esquisse::esquisser(iris)
 +
 +# Webブラウザで開きたい場合
 +esquisse::esquisser(viewer = "browser")
 +</code>
 +{{:00.初めての医療統計rとezr:pasted:20200506-001548.png}}
 +
 +{{:00.初めての医療統計rとezr:pasted:20200506-001836.png}}
 +
 +csvファイルは、UTF-8でエンコードしておく必要がありそう。
 +
 +pptx出力する場合は、
 +<code>
 +Packages 'officer' and 'rvg' are required to use this functionality.
 +</code>
 +だそうです。
 +<code>
 +install.packages("officer")
 +install.packages("rvg")
 +</code>
 +すれば、パワーポイントファイル(pptx)として出力することもできます。どちらも非常に便利。
 +
 +
 +
 +エスキスの使い方(英語)
 +https://dreamrs.github.io/esquisse/articles/get-started.html
 +
 +
 +
 +https://qiita.com/taro_9674/items/55dc92d30ba569465ca9
 +@taro_9674
 +2019年07月25日に投稿
 +【R言語】もうggplot2の操作も怖くない!esquisseパッケージの効力が絶大だった件
 +
 +https://note.com/tqwst408/n/n82d56c69a18e
 +R言語:ggplotのGUIをまとめてみる
 +Osamu_Machida
 +2019/02/23 13:07
 +
 +https://www.marketechlabo.com/r-best-packages/
 +Rのおすすめパッケージ2019年版
 +
 +
  
 ===== グラフ全体の大きさと解像度 ===== ===== グラフ全体の大きさと解像度 =====
行 40: 行 100:
 scale_x_log10(limit = c(0.1 , 10)) scale_x_log10(limit = c(0.1 , 10))
 scale_y_log10(breaks = c(1, 5, 10)* 1000) scale_y_log10(breaks = c(1, 5, 10)* 1000)
 +</code>
 +
 +x軸の表示の順番を変える(factorの場合)
 +<code>
 +scale_x_discrete(limit=c('virginica', 'setosa', 'versicolor'))
 +</code>
 +
 +x軸の表示の値を変える(factorの場合)
 +<code>
 +scale_x_discrete("Cut Type", labels = c("Fair" = "F","Good" = "G", "Very Good" = "VG","Premium" = "P","Ideal" = "I"))
 +</code>
 +
 +値を変えて、同時に順序も変える(factor)
 +<code>
 +ggplot(summary_d, aes(x = time, y = temp_mean, group = 1)) +
 +  geom_line() +
 +  geom_point() +
 +  scale_x_discrete(
 +    limit = c("before", "a0sec","a30sec","a60sec","a180sec"),
 +    breaks = c("before", "a0sec","a30sec","a60sec","a180sec"),
 +    labels = c("before", "0sec","30sec","60sec","180sec")
 +  ) +
 +  scale_shape_manual(values=c(1,15)) +
 +  scale_y_continuous(limits = c(20, 30)) +
 +  geom_errorbar(aes(ymax = temp_mean + temp_sd, ymin = temp_mean - temp_sd), width = 0.1) +
 +  theme_classic()
 </code> </code>
  


00.初めての医療統計rとezr/08.ggplot2でグラフの体裁を調整.1571702413.txt.gz · 最終更新: 2019/10/22 by adash333

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki