I'm building a pretty intensive plot, but I am having a basic problem with geom_smooth
that I can't seem to find any answers for. Here's how the plot looks now with geom_smooth(method = "lm")
:
When I build the geom_smooth()
portion of my plot, I'd like to change the line color. When I do this, it draws new lines bordering my confidence interval,
Calling geom_smooth(method = "lm", color = "black")
returns this:
Is there a simple way to get rid of the border lines, but keep the main line black?
EDIT: I can't provide full code with data, but have provided circumstances that will reproduce the error here. You will need no more than this to answer the question. Per the comments below, its likely an interaction with plotly (ggplotly
).
library(ggplot2)
library(plotly)
df <- data.frame(
Demographic = rnorm(1:100),
Proficiency = rnorm(1:100),
N.Tested = rnorm(1:100)
)
a <- ggplot(data = df,
aes(x = Demographic,
y = Proficiency)
)
b <- a + geom_point(aes(
text = "to be replaced",
color = N.Tested,
size = N.Tested
),
show.legend = FALSE)
c <- b + scale_color_gradient2(low = "firebrick4", high = "gold", mid = "orange", midpoint=300)
d <- c + geom_smooth(method = "lm", color="black")
ggplotly(d)