set dynamically break on y axis using ggbreak

--Hi all,

i try to use ggplot2 with ggbreak library to set dynamically break on y axis,
for example if i have this list of values for y axis:
42,72,1057,4034,4056,5454,12486,15296,16087,18705,43015,44909,50589,52176,54172,109819,121325,121642,153197,156208,168275,168887,263759,322814

how to calculate axis break dynamically to cover all types of possible data. The reasons for requiring a dynamic calculation is because the values keep changing and can be anywhere in the range of 1 to 350000.

Thank you --

to break at thew largest gap in values of y, you could use:

ggplot()+
  geom_point(aes(x=x,y=y),color="blue")+
  scale_y_break( breaks = y[which(diff(y) == max(diff(y)))+0:1])
    )

yes, seems to be good