Upgrade to Pro — share decks privately, control downloads, hide ads and more …

さまざまなグラフ描画(2) / Various Chart Drawing 2

Kenji Saito
December 12, 2023

さまざまなグラフ描画(2) / Various Chart Drawing 2

早稲田大学大学院経営管理研究科「企業データ分析」2023 冬のオンデマンド教材 第8回で使用したスライドです。

Kenji Saito

December 12, 2023
Tweet

More Decks by Kenji Saito

Other Decks in Business

Transcript

  1. generated by Stable Diffusion XL v1.0 2023 8 (2) (WBS)

    2023 8 (2) — 2023-12 – p.1/17
  2. ( 20 ) 1 • 2 R • 3 •

    4 • 5 • 6 ( ) • 7 (1) • 8 (2) • 9 R ( ) (1) 10 R ( ) (2) 11 R ( ) (1) 12 R ( ) (2) 13 GPT-4 14 GPT-4 15 ( ) LaTeX Overleaf 8 (12/21 ) / (2 ) OK / 2023 8 (2) — 2023-12 – p.3/17
  3. 2 R "yyyy-mm-dd" 1970 1 1 0 ( → :

    “Dec 03”) y x 2 cda-demo “ -2.R” Git 1 2023 8 (2) — 2023-12 – p.5/17
  4. y (1/2) (?) “ .txt” 1 1 <- read.table(" .txt",

    header=T) x y par(oma=c(0, 0, 0, 2)) # plot(as.Date( 1$ ), 1$ , type="o", lty=1, pch=1, col=4, ylim=c(0, 8), axes=F, xlab=" (2023 )", ylab=" ", main=" 1 ") axis.Date(1, format="%m/%d") # x ( / )(%m = )(%d = ) ‘as.Date(. . .)’ ( plot ) ‘axis.Date(. . .)’ 1 1 = , 2 = , 3 = , 4 = (‘side’ ) ‘format’ (‘as.Date( . . . )’ ) 2023 8 (2) — 2023-12 – p.6/17
  5. y (2/2) y y y axis(2, line=0.5, col=4) # y

    par(new=T) plot(as.Date( 1$ ), 1$ , type="o", lty=2, pch=2, col=2, ylim=c(0, 7), axes=F, ann=F) mtext(" ", side=4, line=3) axis(4, line=0.5, lty=2, col=2) # y par(oma=c(0, 0, 0, 0)) # ‘axis(. . .)’ ‘line’ ‘mtext(. . .)’ 2023 8 (2) — 2023-12 – p.7/17
  6. ࠶ࡿ1㐌㛫ࡢணᐃ௳ᩘ࡜ᣊ᮰᫬㛫 ᪥௜ (2023ᖺ) ணᐃࡢ௳ᩘ 12/03 12/05 12/07 12/09 0 2

    4 6 8 ᣊ᮰ࡉࢀࡓ᫬㛫 0 1 2 3 4 5 6 7 2023 8 (2) — 2023-12 – p.8/17
  7. 3D 3 3D × ( ) 3 . . .

    2023 8 (2) — 2023-12 – p.9/17
  8. 3 (2/2) 3D scatterplot3d(x = 2$V1, y = 2$V2, z

    = 2$V3, pch=20, highlight.3d = TRUE, type ="h", lwd = 2, angle = 50, xlab=" a ", ylab=" (%)", zlab=" (%)") ‘scatterplot3d(. . .)’ 3D plot x, y, z ‘highlight.3d’ y ‘angle’ x y 2023 8 (2) — 2023-12 – p.11/17
  9. 10 20 30 40 50 0 20 40 60 80

    100 0 10 20 30 40 50 ࣃ࣓࣮ࣛࢱa ࡢ኱ࡁࡉ ࢹ࣮ࢱᦆኻ⋡ (%) ᚓࡽࢀࡓࢹ࣮ࢱࡢ᳨ドྍ⬟ᛶ (%) 2023 8 (2) — 2023-12 – p.12/17
  10. 5 1 3D 5 par(mfrow=c(2, 3)) for (x in 1:5)

    { a <- x * 10 plot( 2[ 2$V1==a, 2], 2[ 2$V1==a, 3], type="o", ylim=c(0, 100), xlab=" (%)", ylab=" (%)", main=paste("a=", a)) } par(mfrow=c(1, 1)) ‘mfrow=c(2, 3)’ 2 3 a 10, 20, 30, 40, 50 5 2023 8 (2) — 2023-12 – p.13/17
  11. 0 10 20 30 40 0 20 60 100 a=

    10 ࢹ࣮ࢱᦆኻ⋡ (%) 0 10 20 30 40 0 20 60 100 a= 20 ࢹ࣮ࢱᦆኻ⋡ (%) ᳨ドྍ⬟ᛶ 0 10 20 30 40 0 20 60 100 a= 30 ࢹ࣮ࢱᦆኻ⋡ (%) ᳨ドྍ⬟ᛶ 0 10 20 30 40 0 20 60 100 a= 40 ࢹ࣮ࢱᦆኻ⋡ (%) 0 10 20 30 40 0 20 60 100 a= 50 ࢹ࣮ࢱᦆኻ⋡ (%) ᳨ドྍ⬟ᛶ 2023 8 (2) — 2023-12 – p.14/17
  12. . . . 1 for (x in 1:5) { a

    <- x * 10 plot( 2[ 2$V1==a, 2], 2[ 2$V1==a, 3], type="o", lty=x, pch=x, col=x, ylim=c(0, 100), xlim=c(0, 50), axes=F, ann=F) par(new=T) } axis(1) axis(2) mtext(" (%)", side=1, line=2) mtext(" (%)", side=2, line=2) legend("bottomleft", legend=c("a=50", "a=40", "a=30", "a=20", "a=10"), lty=5:1, pch=5:1, col=5:1) box() # 2023 8 (2) — 2023-12 – p.15/17
  13. 0 10 20 30 40 50 0 20 40 60

    80 100 ࢹ࣮ࢱᦆኻ⋡ (%) ᳨ドྍ⬟ᛶ (%) a=50 a=40 a=30 a=20 a=10 2023 8 (2) — 2023-12 – p.16/17