R plot options in rdd::DCdensity

核能气质少年 提交于 2020-01-05 07:37:24

问题


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."

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?


回答1:


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')


来源:https://stackoverflow.com/questions/27532044/r-plot-options-in-rdddcdensity

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!