ggplot2-translation icon indicating copy to clipboard operation
ggplot2-translation copied to clipboard

P161: vp4, vp5 两行代码似有误

Open aoyh opened this issue 11 years ago • 6 comments

P161 第六行 vp4 <- viewport(x = 1, y = 1, just = c('top', 'right')) 第八行 vp5 <- viewport(x = 0, y = 0, just = c('top', 'right'))

报错 Error in valid.charjust(just) : invalid horizontal justification

just的第一个参数对应水平,第二参数对应垂直。水平是左右,垂直是上下。

似乎应将两个参数对调,改为:

vp4 <- viewport(x = 1, y = 1, just = c("right", "top"))
vp5 <- viewport(x = 0, y = 0, just = c("right", "bottom"))

aoyh avatar May 31 '13 09:05 aoyh

请问这个是印刷版里的错误吗?我没有现书所以看不到,这个其实是我们邮件讨论和更正过的错误。。。解决方法就是如你所说的调换位置。

On Fri, May 31, 2013 at 4:02 AM, Aaron Ouyang [email protected]:

P161 第六行 vp4 <- viewport(x = 1, y = 1, just = c('top', 'right')) 第八行 vp5 <- viewport(x = 0, y = 0, just = c('top', 'right'))

报错 Error in valid.charjust(just) : invalid horizontal justification

just的第一个参数对应水平,第二参数对应垂直。水平是左右,垂直是上下。

似乎应将两个参数对调,改为: vp4 <- viewport(x = 1, y = 1, just = c("right", "top")) vp5 <- viewport(x = 0, y = 0, just = c("right", "bottom"))

— Reply to this email directly or view it on GitHubhttps://github.com/cosname/ggplot2-translation/issues/3 .

Tengfei Yin MCDB PhD student 1620 Howe Hall, 2274, Iowa State University Ames, IA,50011-2274

tengfei avatar May 31 '13 16:05 tengfei

对,印刷版中文书里的。前几天京东买的。前不久看过英文的pdf,也遇到部分代码在ggplot2 v0.9.3中不兼容的问题。看到中文译本出来说对代码进行了更正,就买来对照着学习。确实,大部分的升级命令都作了调整。译文读来也很流畅。 总的来说,中文译本不错。 前序中说,如果有勘误和代码问题,可以到github这个翻译主页上来。所以我就来了……也许其他读者遇到类似问题也可以在此得到答案。

aoyh avatar Jun 04 '13 01:06 aoyh

在给出的源程序代码中都早更新改过了,书中不知怎么却没有更新,真扯淡!

https://github.com/cosname/ggplot2-translation/blob/master/Rcode/chapter8.R

taiyun avatar Jun 05 '13 08:06 taiyun

在这时候就体现出 knitr 的必要性了,哈哈。@yihui

nanxstats avatar Jun 05 '13 09:06 nanxstats

@road2stat 唉,等下一本书发招吧:)

yihui avatar Jun 07 '13 00:06 yihui

##处在左下角,是不是该这样呢?

vp5 <- viewport(x = 0, y = 0, just = c("left", "bottom"))

popucui avatar Aug 24 '13 01:08 popucui