1
$\begingroup$

How can I manually adjust the position of a vertex with a label by dragging within GraphPlot?

I am using Mathematica 12.0. Dragging works fine with vertex-unlabeled graphs, e.g.

GraphPlot[{"1" -> "2", "1" -> "3", "2" -> "3"}]

however, when I add vertex labels

GraphPlot[{"1" -> "2", "1" -> "3", "2" -> "3"}, VertexLabels -> Automatic]

I can only move the circle representing the vertex, without moving the vertex itself. When I try to move the actual point, it just disconnects one of the incident edges and moves that edge around.

The same question was asked here, however I can't get the offered solution to work in 12.0 either (and it uses the outdated VertexRenderingFunction).

$\endgroup$
0
2
$\begingroup$

In versions 12.0+, you can access the legacy GraphPlot functionality using

GraphComputation`GraphPlotLegacy[{"1" -> "2", "1" -> "3", "2" -> "3"},
   VertexLabeling -> True]
$\endgroup$
4
  • $\begingroup$ Hi @kglr, how did you find this? $\endgroup$ – Victor K. Apr 17 '20 at 12:51
  • 1
    $\begingroup$ Victor, with major v12 changes in GraphPlot I thought old GraphPlot should be accessible somehow for backward compatibility... and I tried Names["*`*raphPlot*"] $\endgroup$ – kglr Apr 17 '20 at 13:07
  • $\begingroup$ Thanks, that’s pretty smart. $\endgroup$ – Victor K. Apr 17 '20 at 17:24
  • $\begingroup$ Thank you, that worked perfectly. Any thoughts on why in 12.0+ dragging labelled vertices works like it does? Is it a bug or a feature? $\endgroup$ – Randy Marsh Apr 26 '20 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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