Now we can use
scale_y_*, with the argument
sec.axisto create a second axis on the right, with numbers to be displayed at
breaks, defined by our vector of line ends:
ggplot(d, aes(age, circumference, color = Tree)) + geom_line() + scale_y_continuous(sec.axis = sec_axis(~ ., breaks = d_ends))
This is good. I’d really prefer to show the labels instead of the value; that way it’d be possible to eliminate the legend altogether. H/T R-Bloggers.