I want to create a sjPlot-ish coefficient plot using dwplot() because my model outputs (odds-ratio-lized logit coefs and s.e.) cannot be directly fed into the former. I want the output to display coef > 1 in "#377EB8" and those <= 1 in "#E41A1C" along both sides of the vertical reference line = 1 using sjPlot's default Set1 color palette.
However, I found it difficult to trick R to do what I want, below is my current code:
# load the data
mydf <- readRDS(url("https://www.dropbox.com/s/m6o3aohbu2iwge2/mydf.rds?dl=1"))
library(ggplot2)
library(dotwhisker)
p <- dwplot(df, vline = ggplot2::geom_vline(xintercept = 1,
colour = "grey90",
linetype = 1,
size = 1)) +
theme_classic() +
theme(legend.position="none", plot.title = element_text(hjust = 0.5, face="bold")) +
xlab("Odds ratio")
p + scale_fill_manual(values=c("#E41A1C", "#377EB8")) +
geom_segment(aes(x=conf.low,y=term,xend=conf.high,
yend=term,col=estimate > 1)) +
geom_point(aes(x=estimate,y=term,col=estimate > 1))
But the colors of the output look strange, don't look quite like the exact color scheme shown in Set1. I've referenced this earlier post but can't find a good walk-around to solve this problem, perhaps there's something wrong with my arguments inside the geom_segment() and geom_point() function.
It will be appreciated if someone could shed some light on this.

The issue is that you use
scale_fill_manualbut map on thecoloraes, i.e. usescale_color_manual. Additionally under the hood there is already something mapped on thecolorwhich results in an errorThis could be fixed by using a named color vector (or by setting the limits) which also ensures that the right colors are assigned to the categories.
DATA