Aesthetics संशोधित करना

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

Rick Scavetta

Founder, Scavetta Academy

Positions

ओवरलैप के लिए समायोजन

  • identity
  • dodge
  • stack
  • fill
  • jitter
  • jitterdodge
  • nudge
ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

position = "identity" (डिफ़ॉल्ट)

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point()

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

position = "identity" (डिफ़ॉल्ट)

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = "identity")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

position = "jitter"

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = "jitter")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

position_jitter()

posn_j <- position_jitter(0.1)

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 col = Species)) +
  geom_point(position = posn_j)

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

position_jitter()

posn_j <- position_jitter(0.1, 
                          seed = 136)

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = posn_j)
  • position के आर्ग्युमेंट सेट करें
  • प्लॉट्स और लेयर्स में स्थिरता

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

Scale फंक्शन

  • scale_x_*()
  • scale_y_*()
  • scale_color_*()
    • scale_colour_*() भी
  • scale_fill_*()
  • scale_shape_*()
  • scale_linetype_*()
  • scale_size_*()
ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

Scale फंक्शन

  • scale_x_continuous()
  • scale_y_*()
  • scale_color_discrete()
    • वैकल्पिक: scale_colour_*()
  • scale_fill_*()
  • scale_shape_*()
  • scale_linetype_*()
  • scale_size_*()
ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

scale_*_*()

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = "jitter") +
  scale_x_continuous("Sepal Length") +
  scale_color_discrete("Species")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

limits आर्ग्युमेंट

ggplot(iris, aes(x = Sepal.Length, 
                  y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = "jitter") +
  scale_x_continuous("Sepal Length", 
                     limits = c(2,8)) +
  scale_color_discrete("Species")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

breaks आर्ग्युमेंट

ggplot(iris, aes(x = Sepal.Length, 
                  y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = "jitter") +
  scale_x_continuous("Sepal Length", 
                     limits = c(2, 8), 
                     breaks = seq(2, 8, 3)) +
  scale_color_discrete("Species")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

expand आर्ग्युमेंट

ggplot(iris, aes(x = Sepal.Length, 
                  y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = "jitter") +
  scale_x_continuous("Sepal Length", 
                     limits = c(2, 8), 
                     breaks = seq(2, 8, 3),
                     expand = c(0, 0)) +
  scale_color_discrete("Species")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

labels आर्ग्युमेंट

ggplot(iris, aes(x = Sepal.Length, 
                  y = Sepal.Width, 
                 color = Species)) + 
  geom_point(position = "jitter") +
  scale_x_continuous("Sepal Length", 
                     limits = c(2, 8), 
                     breaks = seq(2, 8, 3),
                     expand = c(0, 0), 
                     labels = c("Setosa", 
                               "Versicolor", 
                               "Virginica")) +
  scale_color_discrete("Species")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

labs()

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) +
  geom_point(position = "jitter") +
  labs(x = "Sepal Length", 
       y = "Sepal Width", 
       color = "Species")

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

चलो इसे आज़माएँ!

ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय

Preparing Video For Download...