Mathematica GraphPlot 和 EdgeRenderingFunction
当我等待 排序时 最后,我想调整我正在处理的 Mathematica 图表的一部分。问题是节点位于边缘之上,我想知道是否有办法扭转这种情况。在图像中,您可以看到箭头未正确显示...
我正在使用自定义 VertexRenderingFunction
和 EdgeRenderingFunction
参数执行 GraphPlot[]
。它看起来像这样:
箭头在哪里?你能看到他们吗?你拿走了我的箭吗? http://img816.imageshack.us/img816/9703/graphbadarrows.png
如您所见,如果箭头位于节点顶部,那就酷。有没有一种简单的方法可以欺骗它?
While I'm waiting for the sorting to finish, I would like to adjust a part of Mathematica graph I'm working on. The problem is that nodes are on top of edges, I wonder if there is a way to reverse that. In the image you can see that arrows are not showing proper...
I'm doing a GraphPlot[]
with custom VertexRenderingFunction
and EdgeRenderingFunction
paramaters. It looks something like this:
As you can see, it would be as they say cool if the arrows were on top of the nodes. Is there an easy way to hax it in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道是否有办法直接使用 GraphPlot 选项来执行此操作,但您可以直接操作 GraphPlot 生成的 Graphics 对象。例如,这是一个与您的特征相似的图表。
您可以检查 Graphics 基元和指令的结构,如下所示:
您可以看到箭头放置在顶点之前。只需按如下方式反转即可。
当然,您的 Graphics 对象可能具有不同的结构。
马克·麦克卢尔
I don't know if there is a way to do this directly with GraphPlot options or not but you could manipulate the Graphics object produced by GraphPlot directly. For example, here's a graph whose features are similar to yours.
You can examine the structure of the Graphics primitives and directives as follows:
You can see that the arrows are placed down before the vertices. Simply reverse this as follows.
Of course, your Graphics object will likely have a different structure.
Mark McClure
马克的答案完全符合您的要求——您可以编写自己的函数来自动执行反向操作。
一个不太直接的解决方案可能是将箭头从末端向后拉一点:
这也将减少节点处的拥塞。
Mark's answer does exactly what you asked for -- and you could write your own function that automates the Reverse.
A less direct solution might be to just draw the arrow heads back from the end a little:
This would also reduce the congestion at the nodes.