GPGraph icon indicating copy to clipboard operation
GPGraph copied to clipboard

Group Visualization

Open Luo624 opened this issue 1 year ago • 5 comments

Hello, I am very interested in your work. I would like to know how it is done in the group visualization piece and what is the name of the graph, I would like to try to plot it but I don't know the name of the graph. cgi-bin_mmwebwx-bin_webwxgetmsgimg_ MsgID=908891790643046299 skey=@crypt_9876ca9_6e71b062e702241b7520f3d617c3a30b mmweb_appid=wx_webfilehelper

Luo624 avatar Jan 10 '24 08:01 Luo624

Hi, @Luo624!

I used a convex hull algorithm to group the members into regions for visualization. I hope the code snippet below is helpful to you.

from scipy.spatial import ConvexHull
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon

plt.figure()
r, theta = 16, np.arange(0, 32, 1) / 32 * 2 * np.pi
circle_points = np.column_stack([r * np.cos(theta), r * np.sin(theta)])
group_member = points[indices == group_idx]
group_circle_points = np.concatenate([circle_points + member for member in group_member], axis=0)
hull = ConvexHull(group_circle_points)
point = group_circle_points[hull.vertices]
p = Polygon(point, facecolor='#DCE3E9', edgecolor='#23445D', linewidth=3, zorder=-hull.area)
plt.gca().add_patch(p)

InhwanBae avatar Jan 10 '24 12:01 InhwanBae

Hi, InhwanBae! Thanks for your reply, I think I know how to realize.

Luo624 avatar Jan 11 '24 02:01 Luo624

Hi, InhwanBae! I don't know how to define some of the variables in the above code snippet, can you please publish the complete group visualization code? Thank you very much!!

chenxi-xr avatar Feb 01 '24 02:02 chenxi-xr

@Luo624 Hi, have you realize the visualization of group? Can you please share the code? Thank you very much!!

Pradur241 avatar Feb 23 '24 17:02 Pradur241

@Pradur241 You can refer to the author's reply above, trust me, it's not hard.

Luo624 avatar Feb 25 '24 09:02 Luo624