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 ot 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 spacings, 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!)
'AI > R ggplot2' 카테고리의 다른 글
CDF stat_ecdf (0) | 2016.12.21 |
---|---|
ggplot2: 그래픽 라이브러리 (0) | 2016.03.20 |
R에서 EPS 이미지 생성 (0) | 2015.06.16 |
ggplot2 package를 이용한 Graph 그리기 (0) | 2015.02.16 |