Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rの基礎8 作図
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
xjorv
January 22, 2021
Education
270
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rの基礎8 作図
Rの基礎8は、Rでの作図(グラフ作成)について説明します。
xjorv
January 22, 2021
More Decks by xjorv
See All by xjorv
コンパートメントモデル
xjorv
3
6.1k
コンパートメントモデルをStanで解く
xjorv
0
540
生物学的同等性試験 検出力の計算法
xjorv
0
3.7k
生物学的同等性試験ガイドライン 同等性パラメータの計算方法
xjorv
0
6.7k
粉体特性2
xjorv
0
2.6k
粉体特性1
xjorv
0
3k
皮膜5
xjorv
0
2.4k
皮膜4
xjorv
0
2.3k
皮膜3
xjorv
0
2.3k
Other Decks in Education
See All in Education
Center for Entrepreneurship Education | Science Tokyo (Institute of Science Tokyo)
sciencetokyo
PRO
0
390
DecisionesEjecutivasCrisis
mariooc
0
290
Plano urbano de Madrid desde el Ensanche al s. XXI (2ª parte).
juanmartin2026
1
64k
Geografía y fútbol. Atlanta. la megalópolis del fútbol
juanmartin2026
1
12k
Soluciones al examen de Geografía 2026. JUNIO (Convocatoria Ordinaria)
juanmartin2026
1
10k
【ZEPメタバース校舎操作ガイド】
ainischool
0
120
データマネジメント試験対策教材1〜データマネジメント基礎〜
yoshimura_datam
1
720
Fundamentos, Caracteristicas y Aplicaciones de los Modulos NumPy , Matplotlib y Pandas
robintux
0
250
[2026前期火5] 論理学(京都大学文学部 前期 第9回)「正規化の停止性——ヒドラゲームによる証明」
yatabe
0
270
焦燥を平穏に変えるエンジニアのための哲学
ichimichi
7
6.8k
AIの力を100%引き出すために
frievea
0
500
良書紹介08_ 頭のいい子がやっているすごいグラフの読み方
bunnchinn3
0
160
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
370
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
380
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
The Cult of Friendly URLs
andyhume
79
7k
Optimizing for Happiness
mojombo
378
71k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
Writing Fast Ruby
sferik
630
63k
Transcript
Rの基礎8 作図 2020/8/14 Ver. 1.0
Rと作図 Rはパッケージなしでも作図機能が豊富 *http://cse.naro.affrc.go.jp/takezawa/r-tips/r/47.html のスクリプトを走らせただけ
基本の散布図: plot plot関数で散布図などを書くことができる plot(x, y)が基本的な使い方となる
散布行列: pairs 行列・データフレームの散布図作成に利用できる pairs(data.frame)で各列間の相関を調べられる *相関係数はcor(data.frame)で調べられる
ヒストグラム: hist hist関数でヒストグラム(データの分布)を描画できる hist(vector)が基本の形となる
箱ひげ図: boxplot boxplot関数で箱ひげ図(データの分布)を描画できる 箱ひげ図: https://ja.wikipedia.org/wiki/%E7%AE%B1%E3%81%B2%E3%81%92%E5%9B%B3 boxplot(vector)が基本の形となる
Rの基礎作図の問題点 複雑な描画をするとスクリプトがわかりにくくなる • 高次作図関数と低次作図関数を組み合わせる • plotを重ね合わせる • 描画エリアを分割する 等々の複雑な操作が必要
ggplot2パッケージ 現代Rでの作図のデファクト・スタンダード やや複雑だが、きれいなグラフが簡単に書ける *ggplot2 reference: https://ggplot2.tidyverse.org/reference/
ggplot2を使う: ライブラリを読み込む ggplot2 もしくは tidyverse を読み込む • tidyverseにはggplot2が含まれる • tidyverseの他のパッケージをグラフ作成に利用できる
ggplot2の基礎 ggplot関数を使用する ggplot(data.frame, aes(…)) • ggplotの第一引数はデータフレーム • 第二引数にaes関数を置く *aes: aesthetic、「美的な」の略
ggplot2の基礎: aes関数 aes関数には、x・y軸の指定、色の指定などを入力する irisデータフレームを作図に使う x軸はPetal.Lengthの列 y軸はSepal.Lengthの列 線の色はSpeciesの列 棒グラフの中などはSpeciesの列 で記述する *iris:
アヤメの花弁、がく片の長さのデータセット。Rでは始めから利用でき、よく用いられる
ggplot2の基礎: geom関数 グラフの形はgeom関数で決定する geom_point() geom_line() geom_bar() geom_boxplot() geom_density() geom_quantile() geom_errorbar()
geom_linerange() 点グラフ(散布図) 線グラフ 棒グラフ 箱ひげ図 確率密度 回帰(四分位幅あり) エラーバー エラーバー(横線なし)
ggplot2の基礎: geom関数の使い方 ggplot関数と+でつなぐ
まとめ • Rには作図のための関数が準備されている • ggplot2が作図のスタンダードとなっている • ggplot(data.frame, aes())が基本の形 • geom関数でグラフの形を決める