encode_point_size
Encode node sizes in a graph visualization based on a specified column, supporting categorical or continuous mappings. Adjust sizes dynamically for clearer representation of node attributes like 'score' or 'type'.
Instructions
Set node size encoding for a graph using Graphistry's encode_point_size API.
Args:
graph_id (str): The ID of the graph to modify.
column (str): The node column to use for size encoding (e.g., 'score', 'type').
categorical_mapping (dict, optional): Map of category values to sizes. Example: {'mac': 50, 'macbook': 100}. If not provided, Graphistry will auto-assign sizes.
default_mapping (float, optional): Size to use for values not in categorical_mapping. Example: 20.
as_continuous (bool, optional): If True, treat the column as continuous and use a size gradient. Example: True for numeric columns like 'score'.
Returns:
dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
Example:
encode_point_size(graph_id, column='score', as_continuous=True)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
categorical_mapping | No | ||
column | Yes | ||
default_mapping | No | ||
graph_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"categorical_mapping": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Categorical Mapping"
},
"column": {
"title": "Column",
"type": "string"
},
"default_mapping": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Mapping"
},
"graph_id": {
"title": "Graph Id",
"type": "string"
}
},
"required": [
"graph_id",
"column"
],
"title": "encode_point_sizeArguments",
"type": "object"
}