3
$\begingroup$

In the options for GraphPlot and related functions, it seems EdgeShapeFunction overwrites a VertexSize specification. Consider the following.

  1. Without an EdgeShapeFunction specification.
GraphPlot[
 CompleteGraph[3, DirectedEdges -> True],
 DirectedEdges -> True, VertexLabels -> Placed[All, Center], 
 VertexLabelStyle -> 14, VertexShapeFunction -> None, 
 VertexStyle -> White, VertexSize -> 0.2, ImageSize -> 200]

enter image description here

The edges do not overlap with the vertices.

  1. With an EdgeShapeFunction specification.
GraphPlot[
 CompleteGraph[3, DirectedEdges -> True],
 DirectedEdges -> True, VertexLabels -> Placed[All, Center], 
 VertexLabelStyle -> 14, VertexShapeFunction -> None, 
 VertexStyle -> White, VertexSize -> 0.2, ImageSize -> 200, 
 
EdgeShapeFunction -> 
  GraphElementData[{"UnfilledArrow", "ArrowSize" -> .05}]]

enter image description here

The edges overlap with the vertices.


Notice the code is identical except the second has the specification of EdgeShapeFunction. I want the UnfilledArrow specification of the second, but I do not want the edges to overlap the vertices, like in the first.

Any ideas on how I can achieve this?

$\endgroup$

2 Answers 2

4
$\begingroup$

Another work-around: Add a second argument to Arrow objects to specify setback:

vertexSize = .02;

GraphPlot[CompleteGraph[3, DirectedEdges -> True], 
 DirectedEdges -> True, 
 VertexLabels -> Placed[All, Center], 
 VertexLabelStyle -> 14,
 VertexShapeFunction -> None,  
 VertexSize -> vertexSize, 
 ImageSize -> 400, 
 EdgeShapeFunction -> (ReplaceAll[ Arrow[a_] :> Arrow[a, vertexSize]] @*
    GraphElementData[{"UnfilledArrow", "ArrowSize" -> .05}])] 

enter image description here

With vertexSize = .1 and VertexLabelStyle -> 30 we get

enter image description here

$\endgroup$
3
$\begingroup$

A workaround:

GraphPlot[CompleteGraph[3, DirectedEdges -> True]
 , DirectedEdges -> True
 , VertexLabels -> Placed[All, Center]
 , VertexLabelStyle -> 14

 , VertexShapeFunction -> Automatic
 , VertexStyle -> Directive[White, EdgeForm[Transparent]]

 , VertexSize -> 0.2
 , ImageSize -> 400
 , EdgeShapeFunction -> 
  GraphElementData[{"UnfilledArrow", "ArrowSize" -> .05}]
 ]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.