Plotter Methods

Contents

Plotter Methods#

The following methods are provided for applying Kepler.gl configurations to Graphistry graphs.

graphistry.PlotterBase.PlotterBase.encode_kepler(self, kepler_encoding)

Apply a complete Kepler.gl encoding to the plotter.

Accepts a graphistry.kepler.KeplerEncoding object or plain dictionary. Returns a new Plotter instance with the encoding applied (immutable pattern).

Parameters:

kepler_encoding (Union[Dict[str, Any], KeplerEncoding]) – KeplerEncoding object or dict with structure: {‘datasets’: […], ‘layers’: […], ‘options’: {…}, ‘config’: {…}}

Returns:

New Plotter instance with the Kepler encoding applied

Return type:

Plottable

Example: Using KeplerEncoding container
from graphistry import KeplerEncoding, KeplerDataset, KeplerLayer

kepler = (KeplerEncoding()
         .with_dataset(KeplerDataset(id="points", type="nodes"))
         .with_layer(KeplerLayer({
             "id": "point-layer",
             "type": "point",
             "config": {"dataId": "points", "columns": {"lat": "lat", "lng": "lng"}}
         })))
g = g.encode_kepler(kepler)
Example: Using plain dict
kepler_dict = {
    'datasets': [{'info': {'id': 'points'}, 'type': 'nodes'}],
    'layers': [{'id': 'point-layer', 'type': 'point', 'config': {'dataId': 'points'}}],
    'options': {'centerMap': True},
    'config': {'cullUnusedColumns': True}
}
g = g.encode_kepler(kepler_dict)

See graphistry.kepler.KeplerEncoding for complete documentation.

graphistry.PlotterBase.PlotterBase.encode_kepler_dataset(self, *args, **kwargs)

Add a Kepler.gl dataset to the encoding.

Accepts same parameters as graphistry.kepler.KeplerDataset. Returns a new Plotter instance with the dataset appended (immutable pattern).

Parameters:
  • raw_dict (Optional[Dict[str, Any]]) – Native Kepler.gl dataset dictionary (if provided, all other params ignored)

  • id (Optional[str]) – Dataset identifier (auto-generated if None)

  • type (Optional[str]) – Dataset type - ‘nodes’, ‘edges’, ‘countries’, ‘states’, etc.

  • label (Optional[str]) – Display label (defaults to id)

  • include (Optional[List[str]]) – Columns to include (whitelist)

  • exclude (Optional[List[str]]) – Columns to exclude (blacklist)

  • computed_columns (Optional[Dict[str, Any]]) – Computed/aggregated columns for data enrichment

  • map_node_coords (Optional[bool]) – Auto-map source/target node coordinates to edges (edges only)

  • map_node_coords_mapping (Optional[Dict[str, str]]) – Custom column names for mapped coordinates (edges only)

  • resolution (Optional[Literal[10, 50, 110]]) – Map resolution - 10 (high), 50 (medium), 110 (low) (geographic datasets only)

  • boundary_lakes (Optional[bool]) – Include lake boundaries (geographic datasets only)

  • args (Any)

  • kwargs (Any)

Returns:

New Plotter instance with the dataset added

Return type:

Plottable

Example: Node dataset
g = g.encode_kepler_dataset(id="companies", type="nodes", label="Companies")
Example: Edge dataset with coordinate mapping
g = g.encode_kepler_dataset(
    id="relationships",
    type="edges",
    map_node_coords=True
)
Example: Countries dataset
g = g.encode_kepler_dataset(
    id="countries",
    type="countries",
    resolution=50
)

See graphistry.kepler.KeplerDataset for complete parameter documentation.

graphistry.PlotterBase.PlotterBase.encode_kepler_layer(self, raw_dict)

Add a Kepler.gl layer to the encoding.

Accepts native Kepler.gl layer dictionary (same as graphistry.kepler.KeplerLayer). Returns a new Plotter instance with the layer appended (immutable pattern).

Parameters:

raw_dict (Dict[str, Any]) – Native Kepler.gl layer dictionary with structure: {‘id’: …, ‘type’: …, ‘config’: {…}}

Returns:

New Plotter instance with the layer added

Return type:

Plottable

Example: Point layer
g = g.encode_kepler_layer({
    "id": "my-layer",
    "type": "point",
    "config": {
        "dataId": "my-dataset",
        "columns": {"lat": "latitude", "lng": "longitude"},
        "color": [255, 140, 0]
    }
})
Example: Arc layer
g = g.encode_kepler_layer({
    "id": "connections",
    "type": "arc",
    "config": {
        "dataId": "edges",
        "columns": {
            "lat0": "edgeSourceLatitude",
            "lng0": "edgeSourceLongitude",
            "lat1": "edgeTargetLatitude",
            "lng1": "edgeTargetLongitude"
        }
    }
})

See graphistry.kepler.KeplerLayer and Kepler.gl Layer Format for layer format details.

graphistry.PlotterBase.PlotterBase.encode_kepler_options(self, *args, **kwargs)

Apply Kepler.gl visualization options to the plotter.

Accepts same parameters as graphistry.kepler.KeplerOptions. Returns a new Plotter instance with the options applied (immutable pattern).

Parameters:
  • raw_dict (Optional[Dict[str, Any]]) – Native Kepler.gl options dictionary (if provided, all other params ignored)

  • center_map (Optional[bool]) – Auto-center map on data (default: True)

  • read_only (Optional[bool]) – Disable map interactions (default: False)

  • args (Any)

  • kwargs (Any)

Returns:

New Plotter instance with the options applied

Return type:

Plottable

Example: Structured params
g = g.encode_kepler_options(center_map=True, read_only=False)
Example: Native format
g = g.encode_kepler_options({"centerMap": True, "readOnly": False})

See graphistry.kepler.KeplerOptions for complete parameter documentation.

graphistry.PlotterBase.PlotterBase.encode_kepler_config(self, *args, **kwargs)

Apply Kepler.gl configuration settings to the plotter.

Accepts same parameters as graphistry.kepler.KeplerConfig. Returns a new Plotter instance with the config applied (immutable pattern).

Parameters:
  • raw_dict (Optional[Dict[str, Any]]) – Native Kepler.gl config dictionary (if provided, all other params ignored)

  • cull_unused_columns (Optional[bool]) – Remove columns not used by layers (default: True)

  • overlay_blending (Optional[Literal['normal', 'additive', 'subtractive']]) – Blend mode - ‘normal’, ‘additive’, ‘subtractive’ (default: ‘normal’)

  • tile_style (Optional[Dict[str, Any]]) – Base map tile style configuration

  • args (Any)

  • kwargs (Any)

Returns:

New Plotter instance with the config applied

Return type:

Plottable

Example: Structured params
g = g.encode_kepler_config(
    cull_unused_columns=True,
    overlay_blending='additive'
)
Example: Native format
g = g.encode_kepler_config({
    "cullUnusedColumns": True,
    "overlayBlending": "additive"
})

See graphistry.kepler.KeplerConfig for complete parameter documentation.

See Also#