zoukankan      html  css  js  c++  java
  • R(week 8)

    library(ggplot2)
    library(tidyverse)
    
    mtcars
    dim(mtcars)
    head(mtcars)
    
    ?qplot
    qplot(data = mtcars, x = wt, y = mpg) +
      ggtitle(" sjdklfd skdjskfl  dsfs") + 
      theme(plot.title = element_text(hjust = 0.5)) + 
      xlab("x") + 
      ylab("y")
    
    grep("^geom", objects("package:ggplot2"), value = TRUE)
    
    qplot(mpg, wt, data = mtcars, color = factor(cyl),
      geom = c("point", "line"))
    qplot(mpg, wt, data = mtcars, color = cyl, 
          geom = c("point", "line"))
    p <- qplot(data = mtcars, x = wt, y = mpg, shape = factor(cyl)) +
      scale_shape_manual("Number of
     Clylinder", values = c(3, 5, 8)) +
      scale_color_manual(values = c("red", "blue", "green"))
    qplot(data = mtcars, x = wt, y = mpg, color = factor(gear)) +
      #facet_grid(gear~.)
      facet_grid(gear~cyl, label = label_both)
    qplot(factor(mtcars$cyl), geom = "bar")
    
    qplot(factor(mtcars$cyl), geom = "blank", fill = factor(mtcars$am),
          xlab = "", ylab = "", main = "sdfsdfsf") + 
            geom_bar(position = "dodge") + 
            scale_x_discrete(label = c("V4", "V6", "V8"))+
            scale_y_continuous(breaks = seq(0, 12, 2)) +
            theme_bw() +
            coord_flip()+
            scale_fill_grey(name = "Trans.",
                            labels = c("auto", "manual"))
    ggplot() +
      geom_point(data = mtcars, mapping = aes( x = wt, y = mpg, shape = factor(cyl)),
                 size = 3)+
      geom_smooth(data = mtcars, mapping = aes( x = wt, y = mpg),
                  method = 'lm')
    ggplot(data = mtcars, aes(x=wt, y = mpg)) + 
      geom_point(aes(color = factor(cyl)))+
      geom_smooth(method = 'lm')
                            
                            
                            
                            
                            
                            
          
    

      

  • 相关阅读:
    C语言-if语句
    C语言-表达式
    C语言-基础
    Java for LeetCode 187 Repeated DNA Sequences
    Java for LeetCode 179 Largest Number
    Java for LeetCode 174 Dungeon Game
    Java for LeetCode 173 Binary Search Tree Iterator
    Java for LeetCode 172 Factorial Trailing Zeroes
    Java for LeetCode 171 Excel Sheet Column Number
    Java for LeetCode 169 Majority Element
  • 原文地址:https://www.cnblogs.com/sineagle/p/14677852.html
Copyright © 2011-2022 走看看