Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I need to plot a graph (to be specific: Fortune Algorithm output) with given vertex coordinates and a few unconnected vertices. I am thinking of using Mathematica for that.

GraphPlot does much of the task with VertexCordinateRules option but does not plot unconnected points.

  1. So is there any way to do this?
    And it would be even nicer if that graph comes with 2-D Axes. I was thinking to use ListLinePlot and Point commands but they give two different graphs as output.

  2. Is there any option for combining output from two graphs? (The Show command didn't help.)

share|improve this question
    
What version do you have? In version 8 you can use Graph instead of GraphPlot. Is your aim to construct an actual graph, or do you merely want to plot the result (and don't want to use it in a graph-context)? –  Szabolcs Apr 25 '12 at 13:17
    
I do have version 8, but Graph command doesn't seems to plot unconnected vertices. I don't think Computational geometry package will be helpful as I am looking for visualization only. –  samikaran- the equation Apr 25 '12 at 17:11
    
Actually, using adjacency matrix and graph plot I am able to plot unconnected vertices but the sense of Voronoi diagram is lost as graph plot does not follow coordinates systems(i.e. no directional or distance correctness). –  samikaran- the equation Apr 25 '12 at 17:42
    
@samikaran-theequation Just post a sample input dataset (in the format you have it in in Mathematica) and I'll show you how. –  Szabolcs Apr 25 '12 at 18:54
    
the option i was looking for is UndirectedEdge[] in graph command. :) –  samikaran- the equation Apr 26 '12 at 0:41
add comment

migrated from stackoverflow.com Apr 25 '12 at 13:17

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 9 down vote accepted

I didn't quite follow the description of your graph, but are you aware of this functionality?:

data = MapIndexed[Flatten[{##}] &, RandomReal[1, {100, 2}]];

ListDensityPlot[
 data,
 InterpolationOrder -> 0,
 ColorFunction -> Hue,
 Mesh -> All,
 Epilog -> Point@data[[All, {1, 2}]]
]

Mathematica graphics

Specifically note InterpolationOrder -> 0.

share|improve this answer
    
The ComputationalGeometry package has Voronoi diagrams as well. I think he's looking to visualize them only, not to compute them (suppose you'd make your own program for computing them, for whatever reason, then you need to visualize the result quickly) –  Szabolcs Apr 25 '12 at 13:16
    
You're not very active lately, what happened? I'm hoping for the glorious return of Spartacus! :D –  Szabolcs Apr 25 '12 at 13:18
    
Yup, I am looking just to plot my result of Voronoi diagram and not to compute them. Lets say; a={1,2};b={4,2};c={3,0};d={3,7}. So is there a way to plot an edge(c,d) and points a and b? –  samikaran- the equation Apr 25 '12 at 17:05
    
@Szabolcs other hobbies. :-) –  Mr.Wizard Apr 25 '12 at 17:56
1  
Do you mean something like this? Graph[{a, b, c, d}, {UndirectedEdge[c,d]}, VertexCoordinates -> {{1, 2}, {4, 2}, {3, 0}, {3, 7}}] –  halmir Apr 25 '12 at 22:57
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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