pygraphistry-visualization
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePyGraphistry Visualization
PyGraphistry 可视化
Doc routing (local + canonical)
文档路由(本地 + 规范)
- First route with .
../pygraphistry/references/pygraphistry-readthedocs-toc.md - Use for section-level shortcuts.
../pygraphistry/references/pygraphistry-readthedocs-top-level.tsv - Only scan when a needed page is missing.
../pygraphistry/references/pygraphistry-readthedocs-sitemap.xml - Use one batched discovery read before deep-page reads; avoid and serial micro-reads.
cat * - Use local icon lookup notes from .
references/fa-icons.md - In user-facing answers, prefer canonical links.
https://pygraphistry.readthedocs.io/en/latest/...
- 优先使用 进行路由。
../pygraphistry/references/pygraphistry-readthedocs-toc.md - 使用 作为章节级快捷方式。
../pygraphistry/references/pygraphistry-readthedocs-top-level.tsv - 仅在所需页面缺失时扫描 。
../pygraphistry/references/pygraphistry-readthedocs-sitemap.xml - 在深度页面读取前执行一次批量发现读取;避免使用 和串行微读取。
cat * - 使用 中的本地图标查找说明。
references/fa-icons.md - 在面向用户的回复中,优先使用规范链接 。
https://pygraphistry.readthedocs.io/en/latest/...
Core pattern
核心模式
python
g2 = (
# Keep a plain 'type' column on both nodes and edges for legend-friendly defaults
g.bind(point_label='label', point_color='type', edge_color='type')
.encode_point_color('type', categorical_mapping={'agent': '#3b82f6'}, default_mapping='#94a3b8')
# Optional: default node sizing is often degree for exploratory passes
.encode_point_size('degree')
.settings(url_params={'play': 3000, 'info': True})
)
g2.plot()python
g2 = (
# 在节点和边中保留一个普通的'type'列,以获得便于图例展示的默认设置
g.bind(point_label='label', point_color='type', edge_color='type')
.encode_point_color('type', categorical_mapping={'agent': '#3b82f6'}, default_mapping='#94a3b8')
# 可选:默认节点大小通常设置为度数,用于探索性分析
.encode_point_size('degree')
.settings(url_params={'play': 3000, 'info': True})
)
g2.plot()External layout pattern
外部布局模式
python
undefinedpython
undefinednodes_df contains x/y layout columns
nodes_df 包含 x/y 布局列
g2 = graphistry.edges(edges_df, 'src', 'dst').nodes(nodes_df, 'id').bind(point_x='x', point_y='y').settings(url_params={'play': 0})
g2.plot()
undefinedg2 = graphistry.edges(edges_df, 'src', 'dst').nodes(nodes_df, 'id').bind(point_x='x', point_y='y').settings(url_params={'play': 0})
g2.plot()
undefinedURL parameters reference
URL 参数参考
Use to control visualization behavior. Full reference: https://hub.graphistry.com/docs/api/1/rest/url/#urloptions
settings(url_params={...})使用 控制可视化行为。完整参考:https://hub.graphistry.com/docs/api/1/rest/url/#urloptions
settings(url_params={...})Layout
布局
| Param | Type | Default | Range | Description |
|---|---|---|---|---|
| int | 5000 | 0-10000 (0, 1000, 2000, 5000) | Layout duration ms. 0=fixed |
| bool | false | Lock X axis (with | |
| bool | false | Lock Y axis (with | |
| bool | false | Lock radial position | |
| bool | false | Strong separation; good for <1000 nodes | |
| float | 1.0 | 0.1-10 (0.5, 1, 2, 5) | Expansion ratio. Combine with |
| bool | false | Compact layout with pull to center | |
| bool | false | Reduce hub dominance in layout | |
| float | 1.0 | 0.1-10 (0.1, 1, 2, 10) | Pull strength toward center |
| float | 1.0 | 0-10 (0, 0.7, 1, 2, 5, 7) | Edge weight impact on layout |
| float | 1.0 | 0.1-10 (0.1, 1, 10) | Higher=precise but slower |
| int | auto | Manual camera bounds on load |
| 参数 | 类型 | 默认值 | 范围 | 描述 |
|---|---|---|---|---|
| int | 5000 | 0-10000(可选值:0, 1000, 2000, 5000) | 布局持续时间(毫秒)。0=固定布局 |
| bool | false | 锁定X轴(需配合 | |
| bool | false | 锁定Y轴(需配合 | |
| bool | false | 锁定径向位置 | |
| bool | false | 强分离模式;适用于节点数<1000的场景 | |
| float | 1.0 | 0.1-10(可选值:0.5, 1, 2, 5) | 扩展比例。需与 |
| bool | false | 紧凑布局,节点向中心聚拢 | |
| bool | false | 降低中心节点在布局中的主导性 | |
| float | 1.0 | 0.1-10(可选值:0.1, 1, 2, 10) | 节点向中心的拉力强度 |
| float | 1.0 | 0-10(可选值:0, 0.7, 1, 2, 5, 7) | 边权重对布局的影响程度 |
| float | 1.0 | 0.1-10(可选值:0.1, 1, 10) | 值越高精度越高,但速度越慢 |
| int | auto | 加载时手动设置相机边界 |
Scene / Rendering
场景/渲染
| Param | Type | Default | Range | Description |
|---|---|---|---|---|
| float | 1.0 | 0.1-10 (0.3, 0.5, 1, 2, 3) | Point size multiplier (not encoding) |
| float | 1.0 | 0-1 (0.3, 0.5, 0.8, 1) | Node transparency |
| float | 0 | 0-5 (0, 1, 2) | Node border width |
| float | 0 | 0-1 (0, 0.5, 1) | Edge bending amount |
| float | 1.0 | 0-1 (0.3, 0.5, 0.8, 1) | Edge transparency |
| bool | true | Show edge direction arrows | |
| str | both | incoming/outgoing/both/node | Hover highlight mode |
| int | 1 | 1-5 (1, 2, 3) | Hops in hover highlight |
| 参数 | 类型 | 默认值 | 范围 | 描述 |
|---|---|---|---|---|
| float | 1.0 | 0.1-10(可选值:0.3, 0.5, 1, 2, 3) | 节点大小乘数(非编码设置) |
| float | 1.0 | 0-1(可选值:0.3, 0.5, 0.8, 1) | 节点透明度 |
| float | 0 | 0-5(可选值:0, 1, 2) | 节点边框宽度 |
| float | 0 | 0-1(可选值:0, 0.5, 1) | 边弯曲程度 |
| float | 1.0 | 0-1(可选值:0.3, 0.5, 0.8, 1) | 边透明度 |
| bool | true | 显示边方向箭头 | |
| str | both | incoming/outgoing/both/node | 悬停高亮模式 |
| int | 1 | 1-5(可选值:1, 2, 3) | 悬停高亮的跳数 |
Labels / Points of Interest
标签/兴趣点
| Param | Type | Default | Range | Description |
|---|---|---|---|---|
| bool | true | Toggle all label visibility | |
| bool | true | Show labels only on hover | |
| bool | true | Highlight key nodes as POI | |
| bool | true | Show labels on POI nodes | |
| int | 5 | 0-100 (0, 5, 10, 20) | Max POIs. 0=disable |
| bool | true | Truncate long labels | |
| bool | false | Show extra properties on hover | |
| float | 1.0 | 0-1 (0.5, 0.8, 1) | Label transparency |
| str | hex no # (000000, FFFFFF) | Label text color | |
| str | hex no # (000000, FFFFFF) | Label bg color |
Note: URL params use hex without . Python API (, ) uses prefix.
#encode_*palette#| 参数 | 类型 | 默认值 | 范围 | 描述 |
|---|---|---|---|---|
| bool | true | 切换所有标签的可见性 | |
| bool | true | 仅在悬停时显示标签 | |
| bool | true | 将关键节点高亮为兴趣点(POI) | |
| bool | true | 显示兴趣点节点的标签 | |
| int | 5 | 0-100(可选值:0, 5, 10, 20) | 最大兴趣点数量。0=禁用 |
| bool | true | 截断长标签 | |
| bool | false | 悬停时显示额外属性 | |
| float | 1.0 | 0-1(可选值:0.5, 0.8, 1) | 标签透明度 |
| str | 不带#的十六进制值(如000000, FFFFFF) | 标签文本颜色 | |
| str | 不带#的十六进制值(如000000, FFFFFF) | 标签背景颜色 |
注意:URL参数使用不带的十六进制值。Python API(、)使用带前缀的格式。
#encode_*palette#UI Controls
UI 控件
| Param | Type | Default | Description |
|---|---|---|---|
| bool | true | Show all menus |
| bool | true | Show graph size stats |
| bool | true | Show histogram panel |
| bool | true | Show entity inspector |
| bool | false | Show collections panel |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| bool | true | 显示所有菜单 |
| bool | true | 显示图表大小统计信息 |
| bool | true | 显示直方图面板 |
| bool | true | 显示实体检查器 |
| bool | false | 显示集合面板 |
Examples
示例
python
undefinedpython
undefinedRing layout with strong separation for small graphs (<1000 nodes)
环形布局,强分离模式适用于小型图表(<1000节点)
g2 = g.settings(url_params={'play': 3000, 'linLog': True, 'scalingRatio': 2.0})
g2 = g.settings(url_params={'play': 3000, 'linLog': True, 'scalingRatio': 2.0})
Fixed position layout (external coordinates)
固定位置布局(外部坐标)
g2 = g.bind(point_x='x', point_y='y').settings(url_params={'play': 0, 'lockedX': True, 'lockedY': True})
g2 = g.bind(point_x='x', point_y='y').settings(url_params={'play': 0, 'lockedX': True, 'lockedY': True})
Disable POI labels entirely
完全禁用兴趣点标签
g2 = g.settings(url_params={'showLabels': False, 'pointsOfInterestMax': 0})
g2 = g.settings(url_params={'showLabels': False, 'pointsOfInterestMax': 0})
Larger points, more transparent edges
更大的节点,更透明的边
g2 = g.settings(url_params={'pointSize': 3.0, 'edgeOpacity': 0.3})
g2 = g.settings(url_params={'pointSize': 3.0, 'edgeOpacity': 0.3})
Minimal UI for embedding
用于嵌入的极简UI
g2 = g.settings(url_params={'menu': False, 'info': False, 'showHistograms': False, 'showInspector': False})
undefinedg2 = g.settings(url_params={'menu': False, 'info': False, 'showHistograms': False, 'showInspector': False})
undefinedIcon/badge pattern
图标/徽章模式
python
g2 = (
g.encode_point_icon('type', categorical_mapping={'person': 'user', 'org': 'building'})
.encode_point_badge('risk', categorical_mapping={'high': 'exclamation-triangle'})
)
g2.plot()Use valid Font Awesome names and keep icon mappings category-driven by .
See for lookup links and examples.
typereferences/fa-icons.mdpython
g2 = (
g.encode_point_icon('type', categorical_mapping={'person': 'user', 'org': 'building'})
.encode_point_badge('risk', categorical_mapping={'high': 'exclamation-triangle'})
)
g2.plot()使用有效的Font Awesome名称,并按分类设置图标映射。
有关查找链接和示例,请查看。
typereferences/fa-icons.mdContinuous-color pattern (beyond categorical maps)
连续颜色模式(超越分类映射)
python
g2 = g.encode_edge_color('amount', palette=['#46327e', '#1fa187', '#fde724'], as_continuous=True)
g2.plot()python
g2 = g.encode_edge_color('amount', palette=['#46327e', '#1fa187', '#fde724'], as_continuous=True)
g2.plot()Focused subgraph views (collection-like workflow)
聚焦子图视图(类集合工作流)
python
undefinedpython
undefinedUse GFQL slices to publish multiple focused views from one base graph (use .gfql(), not deprecated .chain())
使用GFQL切片从一个基础图表发布多个聚焦视图(使用.gfql(),而非已弃用的.chain())
high_risk = g.gfql([...]).name('high-risk-slice')
partner_flow = g.gfql([...]).name('partner-flow-slice')
urls = [high_risk.plot(render=False), partner_flow.plot(render=False)]
undefinedhigh_risk = g.gfql([...]).name('high-risk-slice')
partner_flow = g.gfql([...]).name('partner-flow-slice')
urls = [high_risk.plot(render=False), partner_flow.plot(render=False)]
undefinedPrivacy-safe sharing pattern
隐私安全共享模式
python
graphistry.privacy(mode='private')
plot_url = g.plot(render=False)- Use explicit before plotting share links.
graphistry.privacy(mode='private'|'organization'|'public') - Do not treat kwargs like
plot()oras_filesas privacy controls.memoize
python
graphistry.privacy(mode='private')
plot_url = g.plot(render=False)- 在生成共享链接前,显式使用设置隐私模式。
graphistry.privacy(mode='private'|'organization'|'public') - 不要将的参数(如
plot()或as_files)视为隐私控制手段。memoize
Common tasks
常见任务
- Encodings: ,
encode_point_color,encode_edge_color,encode_point_size,encode_point_icon.encode_point_badge - Layouts: runtime force layout settings, ring/GIB/modularity, graphviz/igraph/cugraph plugin layouts.
- Static outputs: for SVG/PNG and text engines like
plot_static()/graphviz-dot.mermaid-code - Sharing controls: .
graphistry.privacy(mode='private'|'organization'|'public') - For advanced gradients, use with
palette=[...]onas_continuous=True/encode_point_color.encode_edge_color - For large investigations, generate multiple focused GFQL slices instead of one overloaded plot.
- 编码:、
encode_point_color、encode_edge_color、encode_point_size、encode_point_icon。encode_point_badge - 布局:运行时力导向布局设置、环形/GIB/模块化布局、graphviz/igraph/cugraph插件布局。
- 静态输出:使用生成SVG/PNG,以及
plot_static()/graphviz-dot等文本引擎输出。mermaid-code - 共享控制:。
graphistry.privacy(mode='private'|'organization'|'public') - 如需高级渐变效果,在/
encode_point_color中使用encode_edge_color并设置palette=[...]。as_continuous=True - 针对大型分析场景,生成多个聚焦GFQL切片,而非单个过载的图表。
Big-graph defaults
大图默认设置
- Filter and aggregate before plotting.
- Keep only essential columns (drop large text blobs unless needed).
- Use focused subgraphs (time slice, one-hop neighborhood, top-k signals).
- Prefer plain columns on both nodes and edges so legends and default category encodings stay stable.
type - Avoid dotted column names like /
node.type; prefer plain names.edge.type - Use native datetime types for time encodings and time-sliced comparisons.
- 绘图前先进行过滤和聚合。
- 仅保留必要列(除非需要,否则删除大文本块)。
- 使用聚焦子图(时间切片、单跳邻域、Top-K信号)。
- 优先在节点和边中使用普通的列,确保图例和默认分类编码保持稳定。
type - 避免使用/
node.type这类带点的列名;优先使用普通名称。edge.type - 时间编码和时间切片对比使用原生日期时间类型。
Canonical docs
规范文档
- Visualization hub: https://pygraphistry.readthedocs.io/en/latest/visualization/index.html
- 10min visualization: https://pygraphistry.readthedocs.io/en/latest/visualization/10min.html
- Layout guide: https://pygraphistry.readthedocs.io/en/latest/visualization/layout/intro.html
- Layout catalog: https://pygraphistry.readthedocs.io/en/latest/visualization/layout/catalog.html
- URL parameters reference: https://hub.graphistry.com/docs/api/1/rest/url/#urloptions
- Privacy/sharing: https://pygraphistry.readthedocs.io/en/latest/server/privacy.html
- Visualization notebooks index: https://pygraphistry.readthedocs.io/en/latest/notebooks/visualization.html
- Icon lookup reference:
references/fa-icons.md
- 可视化中心:https://pygraphistry.readthedocs.io/en/latest/visualization/index.html
- 10分钟快速上手可视化:https://pygraphistry.readthedocs.io/en/latest/visualization/10min.html
- 布局指南:https://pygraphistry.readthedocs.io/en/latest/visualization/layout/intro.html
- 布局目录:https://pygraphistry.readthedocs.io/en/latest/visualization/layout/catalog.html
- URL参数参考:https://hub.graphistry.com/docs/api/1/rest/url/#urloptions
- 隐私/共享:https://pygraphistry.readthedocs.io/en/latest/server/privacy.html
- 可视化笔记本索引:https://pygraphistry.readthedocs.io/en/latest/notebooks/visualization.html
- 图标查找参考:
references/fa-icons.md