Koordinatlar Katmanı

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

Rick Scavetta

Founder, Scavetta Academy

Koordinatlar katmanı

  • Grafik boyutlarını kontrol eder
  • coord_
    • ör. coord_cartesian()
ggplot2 ile Orta Düzey Veri Görselleştirme

Yakınlaştırma

  • coord_cartesian(xlim = ...)
  • scale_x_continuous(limits = ...)
  • xlim(...)
ggplot2 ile Orta Düzey Veri Görselleştirme

Orijinal grafik

iris.smooth <- ggplot(
  iris, 
  aes(x = Sepal.Length, 
      y = Sepal.Width, 
      color = Species)
  ) + 
  geom_point(alpha = 0.7) +
  geom_smooth()

iris.smooth 

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

scale_x_continuous()

iris.smooth + 
  scale_x_continuous(limits = c(4.5, 5.5))
Removed 95 rows containing non-finite values 
(stat_smooth).
Removed 95 rows containing missing values 
(geom_point).

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

scale_x_continuous()

Orijinal grafik

scale_x_continuous() ile yakınlaştırın

Orijinal verinin bir kısmı filtrelendi!

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

xlim()

iris.smooth +
  xlim(c(4.5, 5.5))
Removed 95 rows containing non-finite values 
(stat_smooth).
Removed 95 rows containing missing values 
(geom_point).

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

coord_cartesian()

iris.smooth +
  coord_cartesian(xlim = c(4.5, 5.5))

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

En-boy oranı

  • Yükseklik/genişlik oranı
  • Yanıltmaya dikkat!
  • Evrensel standart yok
  • Aynı ölçekteyse genelde 1:1 kullanın
ggplot2 ile Orta Düzey Veri Görselleştirme

Güneş Lekeleri

library(zoo)
sunspots.m <- data.frame(
    year = index(sunspot.month),
    value = reshape2::melt(sunspot.month)$value)
)

ggplot(sunspots.m, aes(x = year, y = value)) +
  geom_line() +
  coord_fixed() # default to 1:1 aspect ratio

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

Güneş Lekeleri

ggplot(sunspots.m, aes(x = year, y = value)) +
  geom_line() +
  coord_fixed(0.055)

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

Ayo berlatih!

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

Preparing Video For Download...