ggplot(all, aes(x=area, y=nq)) +
geom_point(size=0.5) +
geom_abline(data = levelnew, aes(intercept=log10(exp(interceptmax)), slope=fslope)) + #shifted regression line
scale_y_log10(labels = function(y) format(y, scientific = FALSE)) +
scale_x_log10(labels = function(x) format(x, scientific = FALSE)) +
facet_wrap(~levels) +
theme_bw() +
theme(panel.grid.major = element_line(colour = "#808080"))
And I get this figure
Now I want to add one geom_line to one of the facets. Basically, I wanted to have a dotted line (Say x=10,000) in only the major panel. How can I do this?
Another way to express this which is possibly easier to generalize (and formatting stuff left out):
The key things being: facet first, then decorate facets by subsetting the original data frame, and put the details in a new
aes
if possible. Other examples of a similar idea:I don't have your data, so I made some up:
To add a vertical line at
x = 1
we can usegeom_vline()
with a dataframe that has the same faceting variable (in my casez='b'
, but yours will belevels='major'
):