My question is similar to this one (I want to use arbitrary text for the labels on an axis), but instead of hardcoding values into the ggplot functions, I want to supply them by referencing a variable that exists in the source dataset.
The solution I've been using is to wrap all the ggplot code inside curly brackets, pipe the source dataset into it, and reference the variables with .$:
library(tidyverse)
tribble(
~description, ~y, ~x,
"apples", 3.4, 1.1,
"oranges", 5.6, 2.4,
"mangos", 2.3, 4.8
) %>%
{ggplot(data = ., aes(y = y, x = x)) +
scale_x_continuous(
breaks = .$x,
labels = .$description
) +
geom_point() + geom_line()}

This works but feels like a workaround. Is there a canonical/correct/cleaner/better way to do this? I've been trying to find an answer in the documentation but I'm having trouble finding the right keywords to describe this situation.
(The plot is nonsense, I know.)