Plots#

1D Visualization Module#

This module provides visualization tools for analyzing and understanding the dynamics of agents and resource distributions in 1D domains for influencer games. It includes utilities for plotting agent positions, gradients, influence distributions, and bifurcation dynamics in 1D domains.

The module is designed to work with the InflGame.adaptive package and supports creating visual representations of agent behaviors and resource distributions in 1D environments.

Dependencies:#

  • matplotlib

  • NumPy

  • PyTorch

  • InflGame.utils

  • InflGame.domains

Usage:#

The functions in this module can be used to visualize agent dynamics and resource distributions in 1D domains. For example, the pos_plot_1d function can be used to plot agent positions over time, while the dist_and_pos_plot_1d function can visualize both agent positions and influence distributions.

Examples#

from InflGame.domains.one_d.one_plots import pos_plot_1d, equilibrium_bifurcation_plot_1d
import torch
import numpy as np

# Plot agent positions over time
fig = pos_plot_1d(
    num_agents=3,
    pos_matrix=torch.randn(100, 3),
    domain_bounds=(0, 1),
    title_ads=['Example Plot']
)
fig.show()

Functions

InflGame.domains.one_d.one_plots.bifurcation_rectangle_plot(main_matrix, left_matrices, right_matrices, reach_parameters, num_agents, reach_start, reach_end, label_to_color=None, figsize=(20, 24), rect_width=0.8, horizontal_spacing=2.5, box_height=10, font_size=14, show_labels=False)#

Internal function: Rectangle display mode for bifurcation tree.

InflGame.domains.one_d.one_plots.bifurcation_tree_plot_with_images(main_matrix, left_matrices, right_matrices, num_agents, reach_parameters, reach_start, reach_end, node_images=None, label_to_color=None, figsize=(20, 24), font={'default_size': 12, 'font_family': 'sans-serif', 'title_size': 16}, image_zoom=0.15, show_labels=True, image_offset=(0, 0), branch_spacing=1.5, label_offset=0.7, hide_text=False)#

NetworkX-based hierarchical tree visualization for bifurcation structures with support for placing custom figures/images on top of nodes.

Parameters:
main_matrixdict

Main bifurcation matrix containing ‘max’, ‘min’, etc.

left_matriceslist of dict

List of matrices for left branches

right_matriceslist of dict

List of matrices for right branches

reach_parameterstorch.Tensor

Reach parameters for each matrix

num_agentsint

Number of agents in the system

reach_startfloat

Starting sigma value

reach_endfloat

Ending sigma value

node_imagesdict, optional

Dictionary mapping node labels to image paths or matplotlib figures. Keys can be: - Exact node names (e.g., ‘$(6)$_m’, ‘(3,3)_l0’) - Display labels (e.g., ‘$(6)$’, ‘(3,3)’) - will apply to all nodes with that label - Branch-specific: (‘$(6)$’, ‘main’), (‘(3,3)’, ‘left’), etc. Values can be: - String path to an image file - matplotlib.figure.Figure object - numpy array (image data) - PIL Image object

label_to_colordict, optional

Mapping of classification labels to colors

figsizetuple

Figure size (width, height)

font_sizeint

Font size for labels

image_zoomfloat

Zoom factor for images (default 0.15)

show_labelsbool

Whether to show text labels below images (default True)

image_offsettuple

(x, y) offset for image placement relative to node center

branch_spacingfloat

Horizontal distance between branches (default 1.5)

label_offsetfloat

Horizontal offset for text labels to the left of nodes (default 0.7)

Returns:
fig, axmatplotlib figure and axes
node_positionsdict mapping node names to (x, y) positions for further customization
InflGame.domains.one_d.one_plots.create_gradient_vector_field_plot_clipped(vis, grid_resolution=20, figsize=(24, 12), max_magnitude=None, normalize_arrows=True)#

Create gradient vector field plot with clipped magnitudes for 1D domain visualization.

Deprecated since version This: function is kept as legacy code and should not be used in new development.

Generates a 2D vector field plot showing gradient directions and magnitudes at grid points in the projected 2D plane. Includes magnitude clipping for better visualization of large gradients and optional normalization to show pure direction information.

Following Influencer Games patterns:

  • Use torch tensor operations for autograd compatibility

  • Preserve original state using .clone()

  • Handle 1d domain type properly

  • Return matplotlib figure for visualization

Parameters:
visShell

Visualization Shell instance containing the field and parameters.

grid_resolutionint

Number of grid points per dimension (default: 20).

figsizetuple

Figure size as (width, height) in inches (default: (24, 12)).

max_magnitudeOptional[float]

Maximum gradient magnitude for clipping; if None, auto-clips at 95th percentile.

normalize_arrowsbool

If True, normalize all arrows to same length for direction visualization.

Returns:
Tuple[matplotlib.figure.Figure, Dict]

Tuple of (matplotlib figure, dictionary with computed data including positions, gradients, statistics).

InflGame.domains.one_d.one_plots.dist_and_pos_plot_1d(num_agents, bin_points, resource_distribution, pos_matrix, len_grad_matrix, infl_dist, cm, NUM_COLORS, title_ads, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14})#

Plot agent influence distributions and positions over time in a 1D domain.

Creates a side-by-side visualization with:

  • Left panel: Influence distributions for each agent overlaid with resource distribution

  • Right panel: Agent positions changing over gradient ascent iterations

This provides comprehensive insight into both the spatial influence patterns and the temporal evolution of agent positions.

Parameters:
num_agentsint

Number of agents in the simulation.

bin_pointsnp.ndarray

Discretized points defining resource allocation regions.

resource_distributionnp.ndarray

Resource values at each bin point.

pos_matrixtorch.Tensor

Matrix of agent positions over time (shape: [time_steps, num_agents]).

len_grad_matrixint

Number of time steps for x-axis scaling.

infl_distList[torch.Tensor]

Influence distribution arrays for each agent.

cmmpl.colors.Colormap

Matplotlib colormap for agent colors.

NUM_COLORSint

Total number of colors in the colormap (typically num_agents + 1).

title_adsOptional[List[str]]

Additional strings to append to the plot title.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘cbar_size’, ‘title_size’, ‘legend_size’, ‘font_family’.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure.

InflGame.domains.one_d.one_plots.equilibrium_bifurcation_envelope_plot_1d(num_agents, bin_points, resource_distribution, infl_type, reach_parameters, extreme_positions, reach_start, reach_end, refinements, plot_type, title_ads, short_title=False, norm=True, infl_cshift=False, cmaps={'crit': 'Greys', 'envelope': '#FF6B6B', 'heat': 'Blues', 'trajectory': '#851321'}, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14}, cbar_config={'center_labels': True, 'label_alignment': 'center', 'shrink': 0.8}, axis_return=False, show_pred=False, optional_vline=None, envelope_alpha=0.3, show_bif_labels=True, bifurcation_key_tolerance=3)#

Plot equilibrium bifurcation envelope showing extreme agent positions in a 1D domain.

Creates an envelope plot showing the maximum and minimum positions achieved by agents across different reach parameters, providing insight into the spread and stability of equilibria. The envelope reveals the range of positions agents explore as the influence parameter varies.

Parameters:
num_agentsint

Number of agents in the simulation.

bin_pointsnp.ndarray

Discretized points defining resource allocation regions.

resource_distributionnp.ndarray

Resource values at each bin point.

infl_typestr

Type of influence kernel (‘gaussian’, ‘beta’, ‘multi_gaussian’, etc.).

reach_parametersList[float]

Array of reach parameter values to test.

extreme_positionsDict[str, torch.Tensor]

Dictionary with ‘max’ and ‘min’ keys containing extreme position tensors.

reach_startfloat

Starting value of reach parameter range.

reach_endfloat

Ending value of reach parameter range.

refinementsint

Number of refinements for critical value estimation.

plot_typestr

Type of plot (‘line’, ‘envelope’, or ‘heat’).

title_adsOptional[List[str]]

Additional strings to append to the plot title.

short_titlebool

Use abbreviated title format.

normbool

Normalize heatmap values.

infl_cshiftbool

Whether influence uses center shift.

cmapsdict

Color map configuration dictionary with keys ‘heat’, ‘trajectory’, ‘crit’, ‘envelope’.

fontdict

Font configuration dictionary.

cbar_configdict

Colorbar configuration dictionary.

axis_returnbool

If True, return axes object; if False, return figure object.

show_predbool

Show predicted critical values (only for Gaussian kernels).

optional_vlineOptional[List[float]]

Optional vertical lines to add to plot.

envelope_alphafloat

Transparency level for envelope fill (0-1).

show_bif_labelsbool

Whether to show bifurcation labels on the plot.

bifurcation_key_toleranceint

Minimum key distance between bifurcations to include both. Bifurcations with keys closer than this tolerance to the previous one will be ignored.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure or axes object.

InflGame.domains.one_d.one_plots.equilibrium_bifurcation_envelope_plot_1d_COMPLETE(num_agents, bin_points, resource_distribution, infl_type, reach_parameters, matrix_list, reach_start, reach_end, refinements, plot_type, title_ads, short_title=False, norm=True, infl_cshift=False, cmaps={'crit': 'Greys', 'envelope': '#FF6B6B', 'heat': 'Blues', 'trajectory': '#851321'}, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14}, cbar_config={'center_labels': True, 'label_alignment': 'center', 'shrink': 0.8}, axis_return=False, show_pred=False, optional_vline=None, envelope_alpha=0.3, show_bif_labels=True, bifurcation_key_tolerance=3)#

Plot complete equilibrium bifurcation envelope with multiple trajectory data in a 1D domain.

Advanced version that combines envelope data with multiple position matrices to create a comprehensive visualization showing both the envelope of extreme positions and detailed trajectory evolution. Includes density heatmap generation from multiple equilibrium searches.

Parameters:
num_agentsint

Number of agents in the simulation.

bin_pointsnp.ndarray

Discretized points defining resource allocation regions.

resource_distributionnp.ndarray

Resource values at each bin point.

infl_typestr

Type of influence kernel (‘gaussian’, ‘beta’, ‘multi_gaussian’, etc.).

reach_parametersList[float]

Array of reach parameter values to test.

matrix_listDict[str, torch.Tensor]

Dictionary containing multiple position matrices and envelope data.

reach_startfloat

Starting value of reach parameter range.

reach_endfloat

Ending value of reach parameter range.

refinementsint

Number of refinements for critical value estimation.

plot_typestr

Type of plot (‘line’, ‘envelope’, or ‘heat’).

title_adsOptional[List[str]]

Additional strings to append to the plot title.

short_titlebool

Use abbreviated title format.

normbool

Normalize heatmap values.

infl_cshiftbool

Whether influence uses center shift.

cmapsdict

Color map configuration dictionary with keys ‘heat’, ‘trajectory’, ‘crit’, ‘envelope’.

fontdict

Font configuration dictionary.

cbar_configdict

Colorbar configuration dictionary.

axis_returnbool

If True, return axes object; if False, return figure object.

show_predbool

Show predicted critical values (only for Gaussian kernels).

optional_vlineOptional[List[float]]

Optional vertical lines to add to plot.

envelope_alphafloat

Transparency level for envelope fill (0-1).

show_bif_labelsbool

Whether to show bifurcation labels on the plot.

bifurcation_key_toleranceint

Minimum key distance between bifurcations to include both. Bifurcations with keys closer than this tolerance to the previous one will be ignored.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure or axes object.

InflGame.domains.one_d.one_plots.equilibrium_bifurcation_plot_1d(num_agents, bin_points, resource_distribution, infl_type, reach_parameters, final_pos_matrix, reach_start, reach_end, refinements, plot_type, title_ads, short_title=False, norm=True, infl_cshift=False, cmaps={'crit': 'Greys', 'heat': 'Blues', 'trajectory': '#851321'}, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14}, cbar_config={'center_labels': True, 'label_alignment': 'center', 'shrink': 0.8}, axis_return=False, show_pred=False, optional_vline=None)#

Plot equilibrium bifurcation diagram for agents in a 1D domain.

Visualizes how equilibrium positions change as a function of the reach parameter (e.g., variance \(\sigma\) for Gaussian influence kernels). As \(\sigma\) decreases, agents bifurcate from symmetric positions to asymmetric equilibria.

Each agent has a vector of final positions \(X_i = [x_1, x_2, \dots, x_A]\) where \(A\) is the number of test parameters and \(x_i\) is the equilibrium position at parameter value \(i\).

Parameters:
num_agentsint

Number of agents in the simulation.

bin_pointsnp.ndarray

Discretized points defining resource allocation regions.

resource_distributionnp.ndarray

Resource values at each bin point.

infl_typestr

Type of influence kernel (‘gaussian’, ‘beta’, ‘multi_gaussian’, etc.).

reach_parametersList[float]

Array of reach parameter values to test.

final_pos_matrixnp.ndarray

Matrix of final equilibrium positions (shape: [num_params, num_agents]).

reach_startfloat

Starting value of reach parameter range.

reach_endfloat

Ending value of reach parameter range.

refinementsint

Number of refinements for critical value estimation.

plot_typestr

Type of plot (‘line’ or ‘heat’).

title_adsOptional[List[str]]

Additional strings to append to the plot title.

short_titlebool

Use abbreviated title format.

normbool

Normalize heatmap values.

infl_cshiftbool

Whether influence uses center shift.

cmapsdict

Color map configuration dictionary with keys ‘heat’, ‘trajectory’, ‘crit’.

fontdict

Font configuration dictionary.

cbar_configdict

Colorbar configuration dictionary.

axis_returnbool

If True, return axes object; if False, return figure object.

show_predbool

Show predicted critical values (only for Gaussian kernels).

optional_vlineOptional[List[float]]

Optional vertical lines to add to plot.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure or axes object.

InflGame.domains.one_d.one_plots.final_position_histogram_1d(num_agents, domain_bounds, current_alpha, reach_parameter, final_pos_vector, title_ads, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14})#

Plot histogram of agent final positions at equilibrium in a 1D domain.

Creates a histogram showing the distribution of agent equilibrium positions for a specific reach parameter and resource configuration. Useful for analyzing clustering patterns and position distributions at equilibrium.

Parameters:
num_agentsint

Number of agents in the simulation.

domain_boundsTuple[float, float]

Minimum and maximum bounds of the 1D domain.

current_alphafloat

Current resource parameter value (e.g., mode separation \(\\alpha\)).

reach_parameterfloat

Influence reach parameter value (e.g., \(\\sigma\)).

final_pos_vectornp.ndarray

Vector of final equilibrium positions for all agents.

title_adsOptional[List[str]]

Additional strings to append to the plot title.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘cbar_size’, ‘title_size’, ‘legend_size’, ‘font_family’.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure.

InflGame.domains.one_d.one_plots.generate_combined_bifurcation_figure(vis, alpha, test_processed, results_list, search, figsize=(32, 22), width_ratios=[1, 1], height_ratios=[1, 1, 1], hspace=0.4, wspace=0.12, region_labels=['a', 'b', 'c', 'd'], save=False, save_types=['.png', '.svg'], paper_figure={'figure_id': 'fig_combined', 'paper': True, 'section': '3_2_6'}, font={'cbar_size': 16, 'default_size': 32, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 40})#

Generate the standardized combined bifurcation and equilibrium analysis figure.

Parameters:
visShell

Configured Shell instance (used for first_order_bifurcation_plot and metadata).

alphaarray-like

Alpha parameter values corresponding to the bifurcation data.

test_processeddict

Pre-processed bifurcation data (output of bifurcation pipeline).

results_listList[dict]

List of four region results dicts ([results1, results2, results3, results4]).

searchsearch_env

Configured monte_search.search_env instance used to plot equilibrium analyses.

figsizeTuple[float, float]

Overall figure size in inches.

width_ratiosList[float]

Width ratios for the two-column GridSpec layout.

height_ratiosList[float]

Height ratios for the three-row GridSpec layout.

hspacefloat

Vertical spacing between subplots.

wspacefloat

Horizontal spacing between subplots.

region_labelsList[str]

Labels (a–d) placed on the bifurcation diagram and sub-panels.

savebool

Whether to save the figure.

save_typesList[str]

File extensions for saving.

paper_figuredict

Paper-figure metadata with keys 'paper', 'section', 'figure_id'.

fontdict

Font configuration dict.

Returns:
matplotlib.figure.Figure
InflGame.domains.one_d.one_plots.gradient_plot_1d(num_agents, grad_matrix, title_ads=[], font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14})#

Plot agent gradients over time in a 1D domain.

Creates a line plot showing how the gradient values for each agent change over gradient ascent iterations. Each agent’s gradient trajectory is plotted as a separate line.

Parameters:
num_agentsint

Number of agents in the simulation.

grad_matrixtorch.Tensor

Matrix of agent gradients over time (shape: [time_steps, num_agents]).

title_adsOptional[List[str]]

Additional strings to append to the plot title.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘cbar_size’, ‘title_size’, ‘legend_size’, ‘font_family’.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure.

InflGame.domains.one_d.one_plots.plot_equilibrium_heatmap_1d(unique_results, num_agents, stability_analysis=None, title_ads=[], font={'cbar_size': 16, 'default_size': 15, 'font_family': 'sans-serif', 'label_size': 10, 'legend_size': 12, 'table_size': 15, 'title_size': 18})#

Generate a heatmap showing equilibrium positions with player positions as axes and color.

InflGame.domains.one_d.one_plots.pos_plot_1d(num_agents, pos_matrix, domain_bounds, title_ads=[], font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14}, axis_return=False, line_thickness=2, fig_size=(18, 18))#

Plot agent positions over time in a 1D domain.

Creates a line plot showing how agent positions change over gradient ascent iterations. Each agent’s trajectory is plotted as a separate line with a distinct color.

Parameters:
num_agentsint

Number of agents in the simulation.

pos_matrixtorch.Tensor

Matrix of agent positions over time (shape: [time_steps, num_agents]).

domain_boundsTuple[float, float]

Minimum and maximum bounds of the 1D domain.

title_adsOptional[List[str]]

Additional strings to append to the plot title.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘cbar_size’, ‘title_size’, ‘legend_size’, ‘font_family’.

axis_returnOptional[bool]

If True, return axes object; if False, return figure object.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure or axes object.

InflGame.domains.one_d.one_plots.prob_plot_1d(num_agents, agents_pos, bin_points, domain_bounds, prob, voting_configs, title_ads, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14})#

Plot probability distribution of agent influence in a 1D domain.

Visualizes the probability that each agent influences each bin/resource point via their relative influence. The probability is computed as:

\[G_{i,k}(\mathbf{x},b_k) = \frac{f_i(x_i, b_k)}{\sum_{j=1}^N f_j(x_j, b_k)}\]

where \(f_i(x_i, b_k)\) is the influence of agent \(i\) at bin point \(b_k\).

Parameters:
num_agentsint

Number of agents in the simulation.

agents_posList[float]

Current positions of all agents.

bin_pointsnp.ndarray

Discretized points defining resource allocation regions.

domain_boundsList[float]

Minimum and maximum bounds of the 1D domain.

probList[np.ndarray]

Probability distributions for each agent (one array per agent).

voting_configsDict[str, bool]

Configuration dictionary with keys ‘fixed_party’ and ‘abstain’ for voting behavior.

title_adsOptional[List[str]]

Additional strings to append to the plot title.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘cbar_size’, ‘title_size’, ‘legend_size’, ‘font_family’.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure.

InflGame.domains.one_d.one_plots.resource_distribution_plot_1d(bin_points, resource_distribution, alpha=None, show_alpha_line=True, title='Resource distribution', fig_size=(12, 8), line_width=2, font={'alpha_size': 20, 'cbar_size': 16, 'default_size': 15, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 18}, y_padding=1.25, save=False, name_ads=[], save_types=['.png', '.svg'], paper_figure={'figure_id': 'resource_dist', 'paper': False, 'section': 'A'})#

Plot the resource distribution with optional alpha line annotation for bimodal distributions.

For bimodal Gaussian distributions, this function draws a dashed line between the two peaks and labels it with \(\alpha\), representing the separation distance between peaks. The peak positions are calculated as \(0.5 - \alpha/2\) and \(0.5 + \alpha/2\).

Parameters:
bin_pointsnp.ndarray

Discretized points defining resource allocation regions.

resource_distributionnp.ndarray

Resource density values at each bin point.

alphafloat, optional

The separation parameter for bimodal distributions. If provided, a dashed line will be drawn between the peaks at positions (0.5 - alpha/2) and (0.5 + alpha/2).

show_alpha_linebool

Whether to show the alpha annotation line between peaks.

titlestr

Title for the plot.

fig_sizeTuple

Figure size as (width, height).

line_widthfloat

Width of the distribution line.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘title_size’, ‘alpha_size’, ‘font_family’.

y_paddingfloat

Multiplier for y-axis upper limit to add space for labels.

savebool

Whether to save the plot.

name_adsList[str]

Additional names for saved files.

save_typesList[str]

File types to save the plot.

paper_figuredict

Configuration for paper figure saving.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure.

Examples

import numpy as np
from InflGame.domains.one_d.one_plots import resource_distribution_plot_1d
import InflGame.domains.rd as rd

bin_points = np.linspace(0.001, 0.999, 100)
alpha = 0.5
resource_params = [[0.1, 0.1], [0.5 - alpha/2, 0.5 + alpha/2], [1, 1]]
resource_dist = rd.resource_distribution_choice(
    bin_points=bin_points,
    resource_type='multi_modal_gaussian_distribution_1D',
    resource_parameters=resource_params
)

fig = resource_distribution_plot_1d(bin_points, resource_dist, alpha=alpha, save=True)
fig.show()
InflGame.domains.one_d.one_plots.three_agent_dynamics(pos_matrix, x_star, title_ads, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14}, axis_return=False)#

Visualize three-agent dynamics in 3D trajectory space.

Creates a 3D plot where each axis represents one agent’s position over time, demonstrating the instability and complex dynamics of three-player influencer games in 1D domains. Only applicable for exactly 3 agents with 1D strategy spaces.

Parameters:
pos_matrixnp.ndarray

Matrix of agent positions over time (shape: [time_steps, 3]).

x_starfloat

Equilibrium or reference position (e.g., symmetric Nash equilibrium).

title_adsList[str]

Additional strings to append to the plot title.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘cbar_size’, ‘title_size’, ‘legend_size’, ‘font_family’.

axis_returnOptional[bool]

If True, return axes object; if False, return figure object.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure or axes object.

InflGame.domains.one_d.one_plots.transfer_axis_artists(source_ax, target_ax)#

Transfer all visual elements from source axis to target axis by recreating them.

Parameters:
source_axmatplotlib.axes.Axes

Source axis containing elements to transfer.

target_axmatplotlib.axes.Axes

Target axis to receive transferred elements.

InflGame.domains.one_d.one_plots.transfer_multi_subplot_figure(source_fig, target_ax, label=None)#

Transfer content from a multi-subplot figure into a single target axis region.

Parameters:
source_figmatplotlib.figure.Figure

Source figure whose subplots are transferred.

target_axmatplotlib.axes.Axes

Target axis that defines the bounding region.

labelstr, optional

Region label to draw in the upper-right corner (e.g. ‘a’, ‘b’).

InflGame.domains.one_d.one_plots.vector_plot_1d(ids, gradient, title_ads, font={'cbar_size': 12, 'default_size': 12, 'font_family': 'sans-serif', 'legend_size': 12, 'title_size': 14}, **kwargs)#

Plot vector field of gradients for two agents in a 1D domain.

Creates a streamplot showing the gradient vector field for a two-agent system, where each axis represents one agent’s position. The vectors indicate the direction and magnitude of gradient ascent at each point in the position space.

Parameters:
idsList[int]

Agent IDs to include in the vector field (must be exactly 2 agents).

gradienttorch.Tensor

Gradient matrix for the vector field (shape: [grid_points, 2]).

title_adsOptional[List[str]]

Additional strings to append to the plot title.

fontdict

Font configuration dictionary with keys: ‘default_size’, ‘cbar_size’, ‘title_size’, ‘legend_size’, ‘font_family’.

**kwargs

Additional keyword arguments passed to matplotlib streamplot function.

Returns:
matplotlib.figure.Figure

The generated matplotlib figure.