This function takes a dendrogram class object and other attributes to calcuate the size of gaps between leaves. The gap is stored in a leaf to its left. The function is called recursively.

1 2 3 |

`d` |
dendrogram class object |

`sum` |
the sum of distance |

`gap_total` |
the total width allocated for gaps |

`mode` |
gap mode, either "threshold" or "quantitative" |

`mapping` |
in case of quantitative mode, either "linear" or "exponential" mapping |

`scale` |
the sclae log base for the exponential mapping |

`max_height` |
the highest distance value, which is the value of the first dendrogram branch |

`threshold` |
the threshold value for threshold mode |

`gap_size` |
the size of gap for threshold mode |

`verbose` |
logical for whether in verbose mode or not |

`...` |
ignored |

the annotated dendrogram class object

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.