Make the background of a graph different colours in different regions

I want to change the background color of a graphic just behind a part of some data like the following image.

Can you help me please?

Have a look at 7.5 Adding a Shaded Rectangle | R Graphics Cookbook, 2nd edition

2 Likes

@jrkrideau

geom_ribbon() ?geom_ribbon is also useful as I can define the starting and the end value of the X axis.

Thank you very much.

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.