Break on x and y axis on a ggplot

Hi,

I get some data from an experiment that I would like to plot with ggplot2.
The problem I have is that both measures have a huge difference.

To make it more appreciable, I would like to set axis break on x and y axis for the same plot.
I found the ggbreak package and works perfectly well but only on one axis (x and y) at the same time.

Please see below an example with a break on x axis, and I would like to found a way to get rid off of the "white" part of the plot.

Do you know any trick or method to insert an axis break on x and y axis at the same time?

Thank you in advance.

library(ggplot2)
library(ggbreak)

DF <- data.frame(
  stringsAsFactors = FALSE,
  Sample = c("A","A","A","A","A","A",
             "A","A","A","A","A","B","B","B","B","B","B","B",
             "B","B","B","B"),
  Time = c(0,1,2,3,4,5,6,7,8,9,
           10,0,1,2,3,4,5,6,7,8,9,10),
  Activity = c(0,0.5,1,2,4,8,16,32,64,
               128,256,0,250,500,1000,2000,3000,4000,5000,6000,7000,
               8000)
)

ggplot(DF, aes(Time, Activity, colour = Sample)) +
  geom_line(size = 0.7) +
  scale_color_viridis_d(option = "viridis") +
  labs(x = "Time (sec)", y = "Activity") +
  theme_classic() +
  scale_x_break(c(3, 7))

Created on 2021-12-09 by the reprex package (v2.0.1)

This topic was automatically closed 21 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.