Plotting pie charts over GraphPlot
Show older comments
Hi,
I want to plot pie-charts over the nodes of a graph plotted as a GraphPlot object such that the middle of the pie sits exactly at the node.
Hence, I want to do something like this
s = [1 1 1 1 2 2 3 4 4 5 6];
t = [2 3 4 5 3 6 6 5 7 7 7];
G = graph(s,t);
p = plot(G);
and then add an axes and plot a pie chart over one of the nodes with
axes('Position',[?, ?, pie_size, pie_size]);
X = [1 0.5 2.5 2]; pie_chart = pie(X, repmat({''},size(X)));
The ? represent the coordinates of the new plot inside the graph plot.
While I can read out the coordinates of the nodes in the graph plot from p.XData and p.YData, these seem to be relative to the center of the plot in units which are incompatible to any available unit system in the axes function.
Does anyone know of a way to accomplish what I want (possibly also in a different way)?
Accepted Answer
More Answers (1)
Woda
on 21 Oct 2021
0 votes
Categories
Find more on Pie Charts in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

