gsplot.config.config#

Functions

config_dict()

Retrieves the current configuration dictionary.

config_entry_option(key)

Retrieves a specific entry from the configuration dictionary based on the provided key.

config_load([config_path])

Loads the configuration data from a specified file or reloads the existing configuration.

config_dict()[source]#

Retrieves the current configuration dictionary.

This function accesses the Config singleton and returns the configuration dictionary currently in memory.

Returns:

The current configuration dictionary.

Return type:

dict of str, Any

Examples

>>> import gsplot as gs
>>> config_data = gs.config_dict()
>>> print(config_data)
{'rcParams': {'figure.dpi': 100}, 'rich': {'traceback': {}}}
config_entry_option(key)[source]#

Retrieves a specific entry from the configuration dictionary based on the provided key.

This function accesses the Config singleton and retrieves the configuration entry associated with the given key.

Parameters:

key (str) – The key for the configuration entry to retrieve.

Returns:

The configuration entry corresponding to the provided key.

Return type:

dict of str, Any

Examples

>>> import gsplot as gs
>>> entry_option = gs.config_entry_option("rcParams")
>>> print(entry_option)
{'figure.dpi': 100, 'backend': 'TkAgg'}
config_load(config_path=None)[source]#

Loads the configuration data from a specified file or reloads the existing configuration.

This function initializes the Config singleton, loads the configuration file, and returns the loaded configuration dictionary.

Parameters:

config_path (str or None, optional) – The path to the configuration file. If None, the existing configuration is reloaded (default is None).

Returns:

The loaded configuration dictionary.

Return type:

dict of str, Any

Examples

>>> import gsplot as gs
>>> config_data = gs.config_load("path/to/config.json")
>>> print(config_data)
{'rcParams': {'figure.dpi': 100}, 'rich': {'traceback': {}}}