Geometrilerle istatistikler

ggplot2 ile Orta Düzey Veri Görselleştirme

Rick Scavetta

Founder, Scavetta Academy

ggplot2, kurs 2

  • İstatistikler
  • Koordinatlar
  • Fasetler
  • Veri Görselleştirmede En İyi Uygulamalar
ggplot2 ile Orta Düzey Veri Görselleştirme

İstatistik katmanı

  • İki tür işlev
    • Bir geom içinde çağrılır
    • Bağımsız çağrılır
  • stats_
ggplot2 ile Orta Düzey Veri Görselleştirme

geom_ <-> stat_

p <- ggplot(iris, aes(x = Sepal.Width))
p + geom_histogram()

geomhistogram

ggplot2 ile Orta Düzey Veri Görselleştirme

geom_ <-> stat_

p <- ggplot(iris, aes(x = Sepal.Width))
p + geom_histogram()
p + geom_bar()

geomhistogram

ggplot2 ile Orta Düzey Veri Görselleştirme

geom_ <-> stat_

p <- ggplot(mtcars, aes(x = factor(cyl),  fill = factor(am))) 
p + geom_bar()
p + stat_count()

ggplot2 ile Orta Düzey Veri Görselleştirme

geom_/stat_ bağlantısı

stat_ geom_
stat_bin() geom_histogram(), geom_freqpoly()
stat_count() geom_bar()
ggplot2 ile Orta Düzey Veri Görselleştirme

stat_smooth()

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point() +
  geom_smooth()
geom_smooth() using method = 'loess' and 
formula 'y ~ x'

ggplot2 ile Orta Düzey Veri Görselleştirme

stat_smooth(se = FALSE)

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point() +
  geom_smooth(se = FALSE)
geom_smooth() using method = 'loess' and 
formula 'y ~ x'

ggplot2 ile Orta Düzey Veri Görselleştirme

geom_smooth(span = 0.4)

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point() +
  geom_smooth(se = FALSE, span = 0.4)
geom_smooth() using method = 'loess' and 
formula 'y ~ x'

ggplot2 ile Orta Düzey Veri Görselleştirme

geom_smooth(method = "lm")

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point() +
  geom_smooth(method = "lm", se = FALSE)

ggplot2 ile Orta Düzey Veri Görselleştirme

geom_smooth(fullrange = TRUE)

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point() +
  geom_smooth(method = "lm", 
              fullrange = TRUE)

ggplot2 ile Orta Düzey Veri Görselleştirme

geom_/stat_ bağlantısı

stat_ geom_
stat_bin() geom_histogram(), geom_freqpoly()
stat_count() geom_bar()
stat_smooth() geom_smooth()
ggplot2 ile Orta Düzey Veri Görselleştirme

Diğer stat_ işlevleri

stat_ geom_
stat_boxplot() geom_boxplot()
ggplot2 ile Orta Düzey Veri Görselleştirme

Diğer stat_ işlevleri

stat_ geom_
stat_boxplot() geom_boxplot()
stat_bindot() geom_dotplot()
stat_bin2d() geom_bin2d()
stat_binhex() geom_hex()
ggplot2 ile Orta Düzey Veri Görselleştirme

Diğer stat_ işlevleri

stat_ geom_
stat_boxplot() geom_boxplot()
stat_bindot() geom_dotplot()
stat_bin2d() geom_bin2d()
stat_binhex() geom_hex()
stat_contour() geom_contour()
stat_quantile() geom_quantile()
stat_sum() geom_count()
ggplot2 ile Orta Düzey Veri Görselleştirme

Hadi pratik yapalım!

ggplot2 ile Orta Düzey Veri Görselleştirme

Preparing Video For Download...