R:使用莱迪思与ggplot2有什么优点和缺点? [英] R: What are the pros and cons of using Lattice versus ggplot2?

查看:600
本文介绍了R:使用莱迪思与ggplot2有什么优点和缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

R:使用莱迪思与ggplot2的优缺点是什么?

解析方案

/格/ gglot2包在他的ppt:
https://github.com/rdpeng/CourseraLectures /blob/master/ggplot2_part1.pptx



基准




  1. 艺术家的调色板模型

  2. 以空白画布开始并从那里开始制作

  3. 以绘图功能(或类似功能)开始

  4. 使用注解函数添加/修改(文本,线条,点,轴)

优点:



方便起见,反映了我们如何看待构建图表和分析数据

缺点:$ b​​
$ b


  1. 一旦开始绘制(即调整边距),不能返回;

  2. 需要提前计划
  3. 一旦创建了新的情节(无图形语言),很难转译给其他人。绘图仅仅是一系列R命令



格子



创建图优点:$ b​​
$ b




    li>对于调节阴谋类型最为有用:观察y如何随着x的变化跨越z
  1. 认为边距/间距自动设置,因为整个阴谋一次指定

  2. 很适合在屏幕上放置许多图块

缺点:$ b​​
$ b


  1. 在单个函数调用中指定整个绘图有时会很尴尬

  2. 绘图中的注释不直观

  3. 使用面板函数和下标很难操作,需要大量准备工作。



  4. 优点:$ b​​
    $ b

    ggplot2



    优点:$ b​​
    $ b


    1. 拆分base和lattice之间的区别
    2. 自动处理智慧h间距,文本,标题,但也允许您通过添加来注释

    3. 表面相似于点阵,但通常更容易/更直观地使用

    4. 默认模式为您提供了许多选择(但您可以自定义!)


    R: What are the pros and cons of using Lattice versus ggplot2?

    解决方案

    Love what Roger Peng said when comparing Base/Lattice/gglot2 packages in his ppt: https://github.com/rdpeng/CourseraLectures/blob/master/ggplot2_part1.pptx

    Base

    1. "Artist’s palette" model
    2. Start with blank canvas and build up from there
    3. Start with plot function (or similar)
    4. Use annotation functions to add/modify (text, lines, points, axis)

    Pros:

    Convenient, mirrors how we think of building plots and analyzing data

    Cons:

    1. Can’t go back once plot has started (i.e. to adjust margins);
    2. need to plan in advance
    3. Difficult to "translate" to others once a new plot has been created (no graphical "language"). Plot is just a series of R commands

    Lattice

    Plots are created with a single function call (xyplot, bwplot, etc.)

    Pros:

    1. Most useful for conditioning types of plots: Looking at how y changes with x across levels of z
    2. Thinks like margins/spacing set automatically because entire plot is specified at once
    3. Good for putting many many plots on a screen

    Cons:

    1. Sometimes awkward to specify an entire plot in a single function call
    2. Annotation in plot is not intuitive
    3. Use of panel functions and subscripts difficult to wield and requires intense preparation
    4. Cannot "add" to the plot once it’s created

    ggplot2

    Pros:

    1. Split the difference between base and lattice
    2. Automatically deals with spacing, text, titles but also allows you to annotate by "adding"
    3. Superficial similarity to lattice but generally easier/more intuitive to use
    4. Default mode makes many choices for you (but you can customize!)

    这篇关于R:使用莱迪思与ggplot2有什么优点和缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆