rdd :: DCdensity中的R绘图选项 [英] R plot options in rdd::DCdensity

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

问题描述

我正在使用rdd包中的DCdensity函数,该函数会在假定参数plot = TRUE的情况下,在回归不连续性设计中生成运行变量的密度图.

I'm using the DCdensity function in the rdd package, which produces a plot of the density of a run variable in a regression discontinuity design, assuming the argument plot = TRUE.

帮助页面显示用户可以将此功能包装在其他图形选项中以修改图."

The help page says "The user may wrap this function in additional graphical options to modify the plot."

我想生成默认图,但是具有较大的轴标题/刻度字体,但是我不知道该怎么做. DCdensity不接受其他参数,当我将函数调用包裹在plot()中时,如下所示,我得到了良好的坐标轴,但是图中只有一个点位于(1,1).

I want to produce the default plot, but with larger axis title/tick font size, but I can't figure out how to do it. DCdensity doesn't accept additional arguments, and when I wrap the function call in plot() as shown below, I get good axes, but only a single point on the plot at (1, 1).

plot(
    DCdensity(
        runvar      = data$xvar,
        cutpoint    = 0,
        bw          = 1.2,
        plot        = TRUE),
        xlab        = 'Assignment Variable',
        ylab        = 'Density',
        cex.axis    = 1.5,
        cex.lab     = 1.5)

我无法找到一个示例来实现帮助页面所讨论的内容,即将功能包装在其他图形选项中"-有人知道该怎么做吗?

I haven't been able to find an example that implements what the help page is talking about in terms of "wrap the function in additional graphical options" - does anyone know how to do this?

推荐答案

到目前为止,我最好的答案是在绘图之前全局更改选项,添加标题,然后再更改选项.很高兴看到其他人是否还有其他解决方案!

My best answer so far is to change the options globally before the plot, add the titles, and then change the options back afterwards. Happy to see if anyone else has other solutions though!

par(cex.axis = 1.5, cex.lab = 1.5)

DCdensity(
    runvar      = data$xvar,
    cutpoint    = 0,
    bw          = 1.2,
    plot        = TRUE)

title(xlab = 'Assignment Variable', ylab = 'Density')

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

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