R ggplot2 - generate separate component for same plot

I would like to generate a plot as attached in R. Y-axis has a scale of 1 to 100 as a continuous value (with a break of 21 to 49) and X-axis has a categorical scale with two values.

I need to allocate 70% of the plot area to the bottom component (i.e. where values from 0-20 are plotted) and then 30% of the plot area to the top component (i.e. where values from 50 to 100 are plotted).

Is there any way, I can plot 3 different components i.e. 0-20, break for 21-49 and then 50 to 100


Not sure...

An alternative is a sqrt scale on the y-axis with scale_y_sqrt(). This transformation makes it easier to see across wide scales of values by effectively squishing down high values.

You can either use a facet:

Wrap a 1d ribbon of panels into 2d — facet_wrap • ggplot2 (tidyverse.org)
Lay out panels in a grid — facet_grid • ggplot2 (tidyverse.org)

or the ggbreak package:
Set Axis Break for ggplot2 (r-project.org)

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.