With some data reshaping, you can actually create a single facetted plot, as shown in the code below, although you may ultimately decide that you need the greater flexibility that comes with generating separate plots.
# Setup
library(tidyverse)
# Sample data
set.seed(2)
sample_df <- data.frame(x = 1:8,
y = rnorm(8, mean = 200, sd = 28),
y1 = rnorm(8, mean = 240, sd = 57),
y2 = rnorm(8, mean = 0, sd = 27))
sample_df$group <- "rand_nums"
sample_df$type <- ifelse(sample_df$y2 < 0, "neg", "pos")
# Reshape and plot
# Reshape data to long format and add grouping column to mark the
# facet each data series belongs to
sample_df_long = sample_df %>%
gather(key, value, y, y1, y2) %>%
mutate(facet.group = case_when(key %in% c("y", "y1") ~ "line",
TRUE ~ "bar") %>% fct_rev())
ggplot(data=sample_df_long, aes(x, value)) +
geom_line(data=. %>% filter(facet.group=="line"), aes(colour=key),
size=2) +
geom_col(data=. %>% filter(facet.group=="bar"), aes(fill=type)) +
facet_grid(facet.group ~ ., scales="free_y") +
theme_bw() +
theme(strip.text=element_blank()) +
guides(color = guide_legend(order = 1),
fill = guide_legend(order = 2, reverse=TRUE)) +
scale_fill_manual(values=c("red","blue")) +
scale_colour_manual(values=c("violet", "forestgreen")) +
labs(x="", y="", colour="Line Title", fill="Pos or Neg") +
expand_limits(y=0)
