How to make a facetted spaghetti chart in ggplot?

How can I make a facetted spaghetti chart that retains all the lines, highlighting only the line that represents a given facet?

I am creating this chart and I want to show all the data on each facet only highlighting a single city.

Any help would be appreciated.

Take a look at the gghighlight package, which allows you to facet wrap by a variable, and then have that variable highlighted in the facet itself.

1 Like

Thank you for the answer. I did that right after asking this question and it worked perfectly. So anyone who might have the same question, highlighting a group variable can highlight each category on a separate facet. Just follow the simple gghighlight tutorial.

If your question's been answered (even if by you), would you mind choosing a solution? (See FAQ below for how).

Having questions checked as resolved makes it a bit easier to navigate the site visually and see which threads still need help.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.