Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing half manual layouts? #139

Closed
llrs opened this issue May 28, 2018 · 9 comments · Fixed by schochastics/graphlayouts#77
Closed

Allowing half manual layouts? #139

llrs opened this issue May 28, 2018 · 9 comments · Fixed by schochastics/graphlayouts#77

Comments

@llrs
Copy link

llrs commented May 28, 2018

Many thanks for such wonderful packages I been using them more and more!

However, I can't find a functionality I think could be useful.I would like to be able to select some nodes and distribute at certain positions and let other nodes using the automagically positions. I'm not sure how to do that using the manual layout. Could that be done?

Something on these lines:

# To allow the nodes of to be in a square
# in node data  (following tidygraph) there would be a column describing the type of the node
ggraph(graph, layout = 'kk') + 
    geom_edge_fan(aes(alpha = ..index..), show.legend = FALSE) + 
    geom_node_point(select = type == "A" , position = "square") # Or circle 

# To allow the nodes of some genes to be as it would be on a map or from cmdscale
df <- cmdscale(matrix_distances_between_genes)
ggraph(graph, layout = 'kk') + 
    geom_edge_fan(aes(alpha = ..index..), show.legend = FALSE) + 
    geom_node_point(select = type == "A" , position = df) 

Of course, this could be changed and a better function names could be selected. Perhaps it is already doable with some combination of plottings and I might have missed. I hope you can give me directions. Thanks

@thomasp85
Copy link
Owner

This is something that needs to be implemented as a new layout. You could probably cook a force-directed one up pretty quickly using the particles package

@llrs
Copy link
Author

llrs commented Aug 13, 2019

Many thanks for the suggestion

@thomasp85
Copy link
Owner

@schochastics is this something that could be added as (yet another) constrained stress layout?

@schochastics
Copy link
Contributor

I think so. I will put it on the graphlayouts todo list

@schochastics
Copy link
Contributor

This is now implemented in graphlayouts

@thomasp85
Copy link
Owner

@schochastics does the implementation support partial fixes, e.g. that one node has a fixed x coord but no fix on the y coordinate and so on. Or does the fixtures need to be complete?

@schochastics
Copy link
Contributor

Yes. The fixed coordinates can be arbitrary and dont need to include both x and y values

@thomasp85
Copy link
Owner

great, so if all x coordinates are provided and no y-coordinates are provided it behaves exactly as layout_with_constrained_stress()?

@schochastics
Copy link
Contributor

Yes, I verfied that :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants