Я хочу объединить два графика в один график: когда я пытаюсь код ниже:
data_df <- df%>%
filter(!is.na(LayerName)) %>%
dplyr::select(LayerName, A,B) %>%
group_by(LayerName) %>%
dplyr::summarise(lower=min(A),upper=max(A),Mean=mean(A),
lower_out=min(B),upper_out=max(B),Mean_out=mean(B))
c<-ggplot(data = data_df, mapping = aes(x = LayerName, y = Mean)) +
geom_pointrange(mapping = aes(ymin = lower, ymax = upper),color = "red")
r<-c+ggplot(data = data_df, mapping = aes(x = LayerName, y = Mean_out)) +
geom_pointrange(mapping = aes(ymin = lower_out, ymax = upper_out),color = "blue")+
theme_bw()
ggplotly(r)
я получаю это сообщение об ошибке:
Don't know how to add ggplot(data = data_df, mapping = aes(x = LayerName, y = Mean_out)) to a plot