使用效果包自定义地块 [英] Custom plots using the effects package

查看:123
本文介绍了使用效果包自定义地块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从效果包中定制多行图。

无论如何将图例放置在绘图区域下面的示例中而不是图形上方?



另外:有谁知道如何绘制使用ggplot2的效果包计算的多行回归的结果?

<



Andy



示例:

 图书馆(效果)
数据(声望)
mod5 < - lm(声望〜收入*类型+教育,data = Prestige)
eff_cf< - 效果(收入*类型,mod5)
print(plot(eff_cf,multiline = TRUE))


解决方案




或者,可以通过
指定零部件 x y 和角落。 x y 确定由角给出的键的角落的位置

c(0,0) c(1,0) c(1,1) c(0,1),它们表示
单位平方的角点。


以及?plot.eff 您阅读


$ b $


key.args要传递给键网格的附加参数
参数xyplot或densityplot,例如,定位键(图例)
在绘图区域。


例如,您可以执行以下操作:

  plot(eff_cf,multiline = TRUE,
key.args = list(x = 0.2,y = 0.9,corner = c(x = 1,y = 1)))


I try to customize the multiline graphs from the effects package.

Is there anyway to position the legend in the example below within the plotting area and not above the graph?

Alternatively: Does anyone know how to plot the results of the multiline regressions calculated by the effects package using ggplot2?

I appreciate any help.

Andy

Example:

library(effects)
data(Prestige)
mod5 <- lm(prestige ~ income*type + education, data=Prestige)
eff_cf <- effect("income*type", mod5)
print(plot(eff_cf, multiline=TRUE))

解决方案

From ?xyplot you read :

Alternatively, the key can be positioned inside the plot region by specifying components x, y and corner. x and y determine the location of the corner of the key given by corner, which is usually one of c(0,0), c(1,0), c(1,1) and c(0,1), which denote the corners of the unit square.

and from ?plot.eff you read

key.args additional arguments to be passed to the key trellis argument to xyplot or densityplot, e.g., to position the key (legend) in the plotting region.

So for example you can do the following:

plot(eff_cf, multiline=TRUE,    
     key.args=list(x=0.2,y=0.9,corner=c(x=1, y=1)))

这篇关于使用效果包自定义地块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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