Diagonal Node Labels for Bipartite Graph?? (Undirected Graph Formatting Help)
Mostrar comentarios más antiguos
Good evening,
I have really long node labels for my 2nd group of vertices on my bipartite graph. This causes my node labels to overlap with eachother and look incredibly ugly. A picture of this is shown below:

I've been trying for a while to make the graph look presentable, and I'm totally stumped. The node labels are formated "Race Sex PoliceComplaintType". So for example, "White Female Abuse of Authority". I tried rotating the node labels diagonally but couldn't figure out how to do it. I've tried adding carriage returns or new lines so that the node labels print like:
"Race
Sex
PoliceComplaintType".
This works in my table, but it doesn't show up on the plot. The code that adds the new lines to the table are shown below:
race = string(D.RACE);
sex = string(D.SEX);
type = string(D.TYPE);
dummyStr = race + newline + sex + newline + type
D.COMBO = dummyStr;

I've already extended the spacing between each node by manually setting the XData. But the graph is already so wide, and I worry making it any wider will just make it even harder to read. Does anyone know of a way I can manipulate my Node Labels to make them appear legibly on my graph?
Code for the graph plotting is included below:
LWidths = 5*G2.Edges.Weight/max(G2.Edges.Weight);
figure(3)
% G2 is my graph
p = plot(G2);
% Don't label edges with weights less than or equal to 4. Helps keep graph clean
idx3 = find(G2.Edges.Weight > 4);
labeledge(p,idx3,G2.Edges.Weight(idx3))
% Thicken edge widths proportionally to the edge weights
p.LineWidth = LWidths;
% set font size
p.EdgeFontSize = 10;
layout(p,"layered");
% splits vertices groupings. Group 1 (units) have YData = 2. Group 2 (complaint & demographic) YData = 1
% gives traditional bipartite appearance
p.YData = yData3;
% manually set xData for spacing of vertices
p.XData = xData3;
title(" Bipartite Graph: Units vs Combined Demographic & Complaint Data");
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Graph and Network Algorithms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

