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')
                            
                            
                            
                            
                            
                            
          
    

      

  • 相关阅读:
    jbox使用总结
    NOI 2012 【迷失游乐园】
    SCOI 2008 【奖励关】
    trie树——【吴传之火烧连营】
    状压DP——【蜀传之单刀赴会】
    NOIP提高组2016 D2T3 【愤怒的小鸟】
    NOIP提高组2013 D2T3 【华容道】
    [学习笔记] [KMP]字符串匹配算法
    SHOI 2014 【概率充电器】
    HNOI 2015 【亚瑟王】
  • 原文地址:https://www.cnblogs.com/sineagle/p/14677852.html
Copyright © 2011-2022 走看看