R中绘图包之间的关系 [英] Relationship between plotting packages in R

查看:149
本文介绍了R中绘图包之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始与R,并开始开始生产图表。我知道至少有三种不同的绘图软件包,标准软件包,ggplot2和格子。



这些软件包是互补的,还是它们覆盖了很多相同的地方?如果它们互补,我什么时候使用它们?如果他们覆盖相同的基础,我应该选择哪一个,作为一个新的R用户,把我的精力放在掌握之中?

是4个绘图系统。有标准,网格,格子和ggplot2。后两者是建立在前两者之上的更高层次的系统。每种方式都有其优点和缺点。

标准图形让您可以绝对控制图表,并且非常适合按照您喜欢的方式创建一个图表。莱迪思被开发来解决你想要的情节阵列。它非常灵活,可以绘制大多数数据和任何变量的任何函数。如果你想要一个任意函数应用于每个主题的数据,并呈现为一个情节网格,格子就是你的宝贝。它建立在网格上,几乎是任何人使用grid包的唯一方式。



最新的一个ggplot2既是一个图形包,也是一个图形化的新理念。它基于Wilkinson的图形语法,并试图完成这一工作,为图形生成语法。人们只需要学习像geom(你绘制什么),stat(数据统计),facet(单个面板)等术语的高级语法,并且可以构建非常复杂的图形。他们一般都很可爱,尤其是电子分销。不幸的是,对每个单独细节的精细控制不可用。有些东西你根本无法调整。也就是说,很多人都得出了一个合理的结论,即用简单的方式来描述高质量的地块是一个小的代价。

查看一些默认值以及ggplot2的示例图。如果他们呼吁你,那么我建议你从那里开始。如果可以的话,尝试通过基本的语法方法学会做所有事情。我个人认为这是一个错误,哈德利有便利功能作为网站的主要帮助。它似乎破坏了ggplot2的全部目的。一个简短的语法被提出作为帮助的主要接口,但这本书是关于哲学和基本语法的。

(我说,但我做了大部分绘图在基础图形中,因为我发现构建图的每个组件都很有趣。)


I am just starting out with R, and beginning to start producing charts. I am aware that there are at least three different plotting packages, the standard one, ggplot2 and lattice.

Are these packages complementary, or do they cover much the same ground? If they are complementary, when do I use each? If they cover the same ground, which one should I, as a new R user, put my energy into mastering?

解决方案

There are 4 plotting systems. There is standard, grid, lattice, and ggplot2. The latter two are higher level systems built on the former two. Each has advantages and disadvantages.

Standard graphics gives you absolute control over plots and is great to make one plot just the way you like it. Lattice was developed to address situations where you want arrays of plots. It is very flexible and can plot most any function over your data and over any variable. If you want an arbitrary function applied to each subject's data and presented as a grid of plots, lattice is your baby. It's built on grid and almost the only way anyone uses the grid package.

The latest one, ggplot2, is both a graphing package and a new philosophy in graphing. It is based on "The Grammar of Graphics" by Wilkinson and attempts to do exactly that, generate a grammar for graphics. One merely has to learn the higher level syntax of terms like geom (what you plot), stat (statistics on the data), facet (individual panels), and you can construct very complex graphs. They generally come out quite lovely, especially for electronic distribution. Unfortunately, fine control of each individual detail is not available. There are certain things you simply cannot adjust. That said, many have come to the sane conclusion that it's a small price to pay for the easy way to describe high quality plots.

Have a look at some of the default and example graphs for ggplot2. If they appeal to you then I'd suggest you start there. If you can, try to learn to do everything through the basic grammar method. I personally think it's a mistake that Hadley has the convenience functions as the main help on the website. It seems to undermine the whole purpose of ggplot2. An abbreviated syntax is presented as the primary interface for the help but the book is all about the philosophy and fundamental grammar.

(I say that but I do most of my plotting in base graphics because I find it fun building every single component of the graphs.)

这篇关于R中绘图包之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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