Closed JZL closed 10 months ago
I think if you have a graphic with overplotting of text, the right course of action is to remove some of the text. If you set check_overlap = TRUE
in geom_node_text()
anything but the top label will not be plotted if they overlap. I'm unlikely to add a geom that entangles the two as it will lead to very bad performance (due to internal grid reasons).
ggplot2 and thus ggraph is extensible though, so anyone can create a geom that do that if they wish
Hi
Great package, thanks for writing it!
This is somewhere between a feature request and pointers to anyone else with the same problem. I was plotting a graph where most of the nodes are non-overlapping, but some are in a jumble. I did the typical (as far as I understand, canonical)
The problem is that it first layers the nodes, then layers the points, so the text is all in a jumble on top of the points. In other words, if two nodes are partially occluding, the nodes correctly stack but the two labels are on top of eachother and look weird and overlapping, ruining the illusion of the text being pasted on top of the nodes
I think it would be nice to have a
geom_node_point_and_text
which combines both and layers (point_1 + text_1), (point_2+text_2) instead of (point_1 + point_2), (text_1 + text_2). It could be a pain to get all themapping
's right for this meta function, but it could be a simple as taking in a list of lists of paramaters, and then passing each half to one function in the grob generator. Or just assume the mapping will be used the same in eachAnother possibility is to render the graph and then reshuffle/zip the list of point grobs and text grobs together, although I didn't get that to work
What I came to, was to use
create_layout
to make thedata
value, and then generate onegeom_node_point
andgeom_text_point
function for each row with adata=
subset (inefficient but fast enough for me), before putting the whole mess together so they're properly interleaved. For anyone else, here's the sketch code but it's not ideal