I'm using plotreg()
from the texreg
package to display coefficient and CI estimates, but I find that I was not able to reproduce graphical output with layout similar to those done by others. For example, using the working example
I'm wondering if there's a way to remove the outer frame of my plotreg
output and put the title (Model
) on top of the graph (instead of having it placed vertically on the left y-axis of the graph)?
Or it could be that the authors of the package have dramatically changed the default setting, so that the layout used in the working example is no longer available.
#UPDATE
Following @IRTFM's recommendation (changing the plotting theme()
), I was able to make the graphical output look much similar to the working example.
So that the frame is removed and the main title now sits on top of the graph, only that I still could not set the 0-reference vertical bar to solid line (I have tried using the [ref.line.par][4]
argument in coefplot()
, but it didn't work)
I used the following code:
plt <- plotreg(list(mod.std),
custom.coef.names = c("Intercept", "Income", "Education"),
custom.model.names = c("Model"),
reorder.coef = c(2, 3, 1),
lwd.vbars = 0)
library(ggplot2)
plt ggtitle("Model")
theme(panel.border=element_blank(), strip.text=element_text(size=12, colour="transparent"), strip.background=element_rect(colour="transparent", fill="transparent"), plot.title = element_text(hjust = 0.5))
The output looks like this
CodePudding user response:
It looks like a lattice plot to me. There are three major plotting paradigms: base, lattice and ggplot. If you execute:
plt <- plotreg( list(mod.std),
custom.coef.names = c("Intercept", "Income", "Education"),
custom.model.names = c(""),
reorder.coef = c(2, 3, 1),
lwd.vbars = 0)
str(plt)
... you see at the very end of the result
# much above
attr(*, "class")= chr [1:2] "gg" "ggplot"
So I'm wrong. It's a ggplot, so you need to look at the theme settings and figure out how to a) get rid of the box and grid, b)round the CI bars, and c) get rid of the y-oriented "Model" band AKA "facet" label.
Searching: