R:使用莱迪思与ggplot2有什么优点和缺点? [英] R: What are the pros and cons of using Lattice versus ggplot2?
本文介绍了R:使用莱迪思与ggplot2有什么优点和缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
R:使用莱迪思与ggplot2的优缺点是什么?
解析方案 /格/ gglot2包在他的ppt:
https://github.com/rdpeng/CourseraLectures /blob/master/ggplot2_part1.pptx
基准
- 艺术家的调色板模型
- 以空白画布开始并从那里开始制作
- 以绘图功能(或类似功能)开始
- 使用注解函数添加/修改(文本,线条,点,轴)
优点:
方便起见,反映了我们如何看待构建图表和分析数据
缺点:$ b
$ b
- 一旦开始绘制(即调整边距),不能返回;
- 需要提前计划
- 一旦创建了新的情节(无图形语言),很难转译给其他人。绘图仅仅是一系列R命令
格子
创建图优点:$ b
$ b
- 认为边距/间距自动设置,因为整个阴谋一次指定
- 很适合在屏幕上放置许多图块
li>对于调节阴谋类型最为有用:观察y如何随着x的变化跨越z
缺点:$ b
$ b
- 在单个函数调用中指定整个绘图有时会很尴尬
- 绘图中的注释不直观
- 使用面板函数和下标很难操作,需要大量准备工作。
-
-
- 优点:$ b
$ bggplot2
优点:$ b
$ b- 拆分base和lattice之间的区别
- 自动处理智慧h间距,文本,标题,但也允许您通过添加来注释
- 表面相似于点阵,但通常更容易/更直观地使用
- 默认模式为您提供了许多选择(但您可以自定义!)
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
- "Artist’s palette" model
- Start with blank canvas and build up from there
- Start with plot function (or similar)
- Use annotation functions to add/modify (text, lines, points, axis)
Pros:
Convenient, mirrors how we think of building plots and analyzing data
Cons:
- Can’t go back once plot has started (i.e. to adjust margins);
- need to plan in advance
- 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:
- Most useful for conditioning types of plots: Looking at how y changes with x across levels of z
- Thinks like margins/spacing set automatically because entire plot is specified at once
- Good for putting many many plots on a screen
Cons:
- Sometimes awkward to specify an entire plot in a single function call
- Annotation in plot is not intuitive
- Use of panel functions and subscripts difficult to wield and requires intense preparation
- Cannot "add" to the plot once it’s created
ggplot2
Pros:
- Split the difference between base and lattice
- Automatically deals with spacing, text, titles but also allows you to annotate by "adding"
- Superficial similarity to lattice but generally easier/more intuitive to use
- Default mode makes many choices for you (but you can customize!)
这篇关于R:使用莱迪思与ggplot2有什么优点和缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- 拆分base和lattice之间的区别
查看全文