Home > database >  how to censor data point labels (annotations) if label text overlaps in the plot when using ggraph
how to censor data point labels (annotations) if label text overlaps in the plot when using ggraph

Time:06-09

I am attempting to plot some data using ggraph. The style is a circular partition plot. I have numerous plots/graphs. Each has a different density of dendritic branching. Nodes on the graph are labeled with geom_node_text(aes(label = labelText)). I know I can use scaling or text size to adjust effective font point. However, I would like to hold font point constant and just censor labels (i.e., assign label value to be something like " ") for dense regions of each graph, given some density threshold parameter. How could this be done? For instance, is there a way to extract the x, y coordinates of text labels such that a density function can be computed over the plot area?

CodePudding user response:

This falls under the heading of RTFM.

check_overlap
If TRUE, text that overlaps previous text in the same layer will not be plotted. check_overlap happens at draw time and in the order of the data. Therefore data should be arranged by the label column before calling geom_label() or geom_text().

  • Related