20
$\begingroup$

I have created 3 graphs for vertexes number 998, 999 and 1000 as below:-

f[m_] := Graph[Range@MeshCellCount[m, 0], MeshCells[m, 1][[All, 1]], EdgeWeight -> PropertyValue[{m, 1}, MeshCellMeasure], VertexCoordinates -> MeshCoordinates[m]];
BlockRandom[SeedRandom[12]; pts998 = RandomReal[100, {998, 3}];]
BlockRandom[SeedRandom[12]; pts999 = RandomReal[100, {999, 3}];]
BlockRandom[SeedRandom[12]; pts1000 = RandomReal[100, {1000, 3}];]
f@DelaunayMesh[pts998]
f@DelaunayMesh[pts999]
f@DelaunayMesh[pts1000]

I noted that the color of 998 and 999 are same, but that of 1000 is different. Why would that happen and how to avoid the change? Many thanks!

998:-

enter image description here

999:-

enter image description here

1000:-

enter image description here

$\endgroup$

1 Answer 1

15
$\begingroup$

It's for performance reasons. If there are too many edges, then it is too costly to render all of them as tubes. Moreover, tubes have a certain thickness, so they also don't help to distinguish edges. This might be another reason.

The threshold appears to be 1000 vertices. With less than 1000 vertices, Graph uses PlotTheme -> "Default" as plot theme. With 1000 or more vertices, as Szabolcs said in the comments, Graph uses PlotTheme -> "LargeNetworkDefault" for graphs with 1000 vertices or more.

You can still enforce the rendering with default plot style if you use

f[m_] := Graph[Range@MeshCellCount[m, 0], MeshCells[m, 1][[All, 1]], 
   EdgeWeight -> PropertyValue[{m, 1}, MeshCellMeasure], 
   VertexCoordinates -> MeshCoordinates[m],
   PlotTheme -> "Default"
   ];
$\endgroup$
2
  • $\begingroup$ It's LargeNetworkDefault. Can you edit this into the answer to make it easier to search for? $\endgroup$
    – Szabolcs
    Commented Jun 18, 2018 at 6:44
  • $\begingroup$ @Szabolcs Ah, great! I added it. Thank you for the hint! $\endgroup$ Commented Jun 18, 2018 at 6:48

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.