1
$\begingroup$

In Mathematica 13.3, is there a robust way to force longer edges so that long edge labels are always readable and not clipped/overlapped? As far as I could see, options for edge spacing in "SpringElectricalEmbedding" or "SpringEmbedding" do not seem to provide that.

Graph[ {1, 2}, {1 \[DirectedEdge] 2}, DirectedEdges -> True, EdgeLabels -> { 1 \[DirectedEdge] 2 -> Placed[ Style["LongLabelForTestingEdgeSpacingAndClipping", 14, Red, Bold], Center ] }, VertexLabels -> { 1 -> Placed["A", Center], 2 -> Placed["B", Center] }, VertexSize -> .4, VertexStyle -> LightBlue, EdgeStyle -> Black, VertexLabelStyle -> Directive[FontSize -> 12], ImageSize -> Medium ] 
$\endgroup$

1 Answer 1

3
$\begingroup$

I don't think there is a general solution to this problem, you have to deal with it on a case-by-case basis. It's impossible to automate something that can't be done manually.

Which of the options specified are important for you? If I could change just one thing, I would do it this way (only ImageSize is changed):

Graph[{1, 2}, {1 \[DirectedEdge] 2}, DirectedEdges -> True, EdgeLabels -> {1 \[DirectedEdge] 2 -> Placed[Style["LongLabelForTestingEdgeSpacingAndClipping", 14, Red, Bold], Center]}, VertexLabels -> {1 -> Placed["A", Center], 2 -> Placed["B", Center]}, VertexSize -> .4, VertexStyle -> LightBlue, EdgeStyle -> Black, VertexLabelStyle -> Directive[FontSize -> 12], ImageSize -> 1000] 

result

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.