Double and flipped axes

Trực quan hóa dữ liệu nâng cao với ggplot2

Rick Scavetta

Founder, Scavetta Academy

Typical axis modifications

  • Aspect ratios (see video 1)
    • Adjust for best perspective
  • Transformation functions (e.g. log, see video 2)
    • Adjust if original scale is inappropriate
  • Double x or y axes
    • Add raw and transformed values
  • Flipped axes
    • Change direction of dependencies
    • Change geometry orientation
Trực quan hóa dữ liệu nâng cao với ggplot2

Typical axis modifications

  • Aspect ratios (see video 1)
    • Adjust for best perspective
  • Transformation functions (e.g. log, see video 2)
    • Adjust if original scale is inappropriate
  • Double x or y axes
    • Add raw and transformed values
  • Flipped axes
    • Change direction of dependencies
    • Change geometry orientation
1 See chapter 4, video 3 for more discussion on double x and y-axes.
Trực quan hóa dữ liệu nâng cao với ggplot2

Double axes

scale relabeled

Trực quan hóa dữ liệu nâng cao với ggplot2

Adding raw and transformed axes

with annotations

Trực quan hóa dữ liệu nâng cao với ggplot2

Typical axis modifications

  • Aspect ratios (see video 1)
    • Adjust for best perspective
  • Transformation functions (e.g. log, see video 2)
    • Adjust if original scale is inappropriate
  • Double x or y axes
    • Add raw and transformed values
  • Flipped axes
    • Change direction of dependencies
    • Change geometry orientation
Trực quan hóa dữ liệu nâng cao với ggplot2

Flipping axes

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

Trực quan hóa dữ liệu nâng cao với ggplot2

coord_flip()

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

Trực quan hóa dữ liệu nâng cao với ggplot2

Let's practice!

Trực quan hóa dữ liệu nâng cao với ggplot2

Preparing Video For Download...