1
$\begingroup$

(Apologies, but I cannot share the data that I am using for these graphs.)

I am finding communities in my data set by using CommunityGraphPlot, and the results looks pretty good:

CommunityGraphPlot[OGopt, EdgeWeight -> FOGlist, VertexSize -> OGfreq,
CommunityRegionStyle -> {{Red, Opacity[0.15]}, {Yellow, 
Opacity[0.15]}, {Purple, Opacity[0.15]}, {Orange, Opacity[0.15]}},
VertexStyle -> color]

enter image description here

I really like how the nodes look when I use PlotTheme->"Market" and I think I would like to use this theme moving forward:

CommunityGraphPlot[OGopt, EdgeWeight -> FOGlist, VertexSize -> OGfreq,
CommunityRegionStyle -> {{Red, Opacity[0.15]}, {Yellow, 
Opacity[0.15]}, {Purple, Opacity[0.15]}, {Orange, Opacity[0.15]}},
PlotTheme -> "Marketing", Background -> White, 
VertexLabelStyle -> Black]

enter image description here

However, I wanted to change the color of the nodes to represent the three groups I'm comparing, as I have done in the first community graph plot, and I have been trying to make the edge weights more noticable, and attempted to implement the solution I saw over here but using the ColorData "BlueGreenYellow", but with no luck - EdgeRenderFunction lights up in red, and doesn't appear to be compatible with CommunityGraphPlot.

When I try using my custom color function, that I used on the first community graph plot, I get some weird halo'ing around the nodes, and the shape reverts back to being just circles, which I don't like at all:

enter image description here

I want to maintain the unique style of the nodes in the "Marketing" theme. I'm not sure how I would begin tackling this color problem while using the "Marketing" theme, so any advice and help would be greatly appreciated.

$\endgroup$

1 Answer 1

2
$\begingroup$

Those circle around disk shapes are from highlight plot theme. For individual color with that style, you could define your own vertex shape function and you could use EdgeStyle to style edges:

g = ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];
SeedRandom[123]; weight = RandomReal[{.5, 2}, EdgeCount[g]];
vsize = Thread[
   VertexList[g] -> RandomReal[{.1, .4}, VertexCount[g]]];
vcolor = Thread[
   VertexList[g] -> (Hue /@ RandomReal[{.1, 1}, VertexCount[g]])];
estyle = Thread[
   EdgeList[g] -> (ColorData["BlueGreenYellow"] /@ Rescale[weight])];

CommunityGraphPlot[g, EdgeWeight -> weight, VertexSize -> vsize, 
 VertexStyle -> vcolor, EdgeStyle -> estyle, 
 CommunityBoundaryStyle -> None, 
 CommunityRegionStyle -> ColorData[10, "ColorList"][[;; ;; 2]], 
 VertexShapeFunction -> ({EdgeForm[], Thickness[.002], 
     Circle[#1, 3.5 #3], Disk[#1, 2 #3]} &)]

enter image description here

$\endgroup$

Your Answer

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

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