GraphRecipes.jl icon indicating copy to clipboard operation
GraphRecipes.jl copied to clipboard

Allow nodes to be scaled for non-square axis sizes

Open JackDevine opened this issue 5 years ago • 1 comments

Since the implementation of nodes is a little basic, we have the problem that when the aspect ratio is not equal to one, the nodes become distorted (circles become ellipses). The solution until now has been to force the aspect ratio to be one. As pointed out in #105, having an axis size that is non-square and an aspect ratio that is not equal to one is critical for visualizing trees that are very deep, but not very wide.

The code that needs to be fixed is here: https://github.com/JuliaPlots/GraphRecipes.jl/blob/1eaa2b6a3488887a876160d899fd4c535ed89413/src/graphs.jl#L452

I think that everything in that if-block should be refactored out into a separate function that takes in nodeshape, the x and y positions of the nodes, some information on the current axis and returns the scaled version of node_vec_vec_xy.

I am happy to do the work, however, I thought that I would open this issue to let people know that I am thinking of the problem. If anybody wants to tackle this issue, then I think that it would make a good first issue for somebody who is a competent Julia dev, but new to the GraphRecipes code. If you are interested in tackling the problem, feel free to tag me in in a comment below and I can provide more information on what needs to be done. For the more adventurous, you may like to tackle the issue by yourselves based on the information provided.

JackDevine avatar Apr 11 '20 03:04 JackDevine

This sounds like a good approach. I fear getting the actual area of the subplot plotting area could be challenging though.

mkborregaard avatar Apr 13 '20 10:04 mkborregaard