You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I love to use the circular ggtree layouts, but always found the low line segment resolution - especially close to the root - somewhat unattractive:
Following the stackoverflow post from above, overwriting the ggplot2:::coord_munch function solves the issue:
# Save the original version of coord_munch
coord_munch_old <- ggplot2:::coord_munch
# Make a wrapper function that has a different default for segment_length
coord_munch_new <- function(coord, data, range, segment_length = 1/500, is_closed = FALSE) {
coord_munch_old(coord, data, range, segment_length, is_closed)
}
# Make the new function run in the same environment
environment(coord_munch_new) <- environment(ggplot2:::coord_munch)
# Replace ggplot2:::coord_munch with coord_munch_new
assignInNamespace("coord_munch", coord_munch_new, ns="ggplot2")
This results in much nicer line segments:
Maybe you could implement this somehow in your great library?
Also, if I understood the stackoverflow discussion correctly, then the low resolution would be less of an issue if the numerical range of x-values would be higher (which is only between 0 and 0.5 in my circular trees). Maybe increasing this scale is an easier solution compared to overwriting some ggplot2 function?
Cheers,
Ulrich
The text was updated successfully, but these errors were encountered:
Hi!
I love to use the circular ggtree layouts, but always found the low line segment resolution - especially close to the root - somewhat unattractive:
Apparently that is a gneral issue with ggplot polar plots:
https://stackoverflow.com/questions/9483033/increase-polygonal-resolution-of-ggplot-polar-plots
Following the stackoverflow post from above, overwriting the
ggplot2:::coord_munch
function solves the issue:This results in much nicer line segments:
Maybe you could implement this somehow in your great library?
Also, if I understood the stackoverflow discussion correctly, then the low resolution would be less of an issue if the numerical range of x-values would be higher (which is only between 0 and 0.5 in my circular trees). Maybe increasing this scale is an easier solution compared to overwriting some ggplot2 function?
Cheers,
Ulrich
The text was updated successfully, but these errors were encountered: