Skip to content

Conversation

@nader-00
Copy link
Collaborator

This PR extends edisgo.tools.plots.plot_plotly to support custom colors for lines and nodes.

What changed

  • line_color now accepts, in addition to existing string options, a pandas.Series or dict
    mapping branch_name → color (e.g. "red", "#ff0000").
  • node_color now accepts, in addition to existing string options, a pandas.Series or dict
    mapping bus_name → color.
  • For custom colors:
    • Colors are taken directly from the provided Series/dict.
    • Lines/nodes that are not present in the Series/dict fall back to a default grey color.
    • No colorbar is shown (only explicit colors are used).
  • Existing behaviour for string options ("loading", "relative_loading", "reinforce",
    "voltage_deviation", "adjacencies") is unchanged.

Usage examples

import pandas as pd
from edisgo.tools import plots

# Example: color two specific lines
line_colors = pd.Series({
    "line_1": "red",
    "line_2": "orange",
})

# Example: color some buses
node_colors = {
    "bus_1": "blue",
    "bus_5": "purple",
}

fig = plots.plot_plotly(
    edisgo_obj,
    line_color=line_colors,
    node_color=node_colors,
    plot_map=False,
)

Kilian Helfenbein and others added 30 commits February 5, 2025 10:21
- Check if the database host contains 'toep' by examining engine.url.host.
- If connected to a TOEP database, apply logic to translate table names accordingly.
…orts-not-working-ssh-tunnel-limitations' into project/411-LoMa
- Automatically set `EDisGo.TimeSeries.timeindex` to the default year of the database if it is empty.  # - Added a logger warning to inform users about the default behavior and recommend setting the `timeindex` explicitly using
`EDisGo.set_timeindex()`.  # On branch feature/openego#456-feature-set-default-timeindex-in-edisgoset_time_series_active_power_predefined
…re-set-default-timeindex-in-edisgoset_time_series_active_power_predefined

Fix missing timeindex in set_time_series_active_power_predefined
…x in set_time_series_active_power_predefined
…re-set-default-timeindex-in-edisgoset_time_series_active_power_predefined

Overwrite timeindex if given timeindex differs from existing timeinde…
…re-set-default-timeindex-in-edisgoset_time_series_active_power_predefined

add logging and correct timeindex variable handling
…se-imports-not-working-ssh-tunnel-limitations
…re-set-default-timeindex-in-edisgoset_time_series_active_power_predefined

Feature/openego#456 feature set default timeindex in edisgoset time series active power predefined
…ompatibility-with-egon-project-data' into project/411-LoMa
…orts-not-working-ssh-tunnel-limitations' into project/411-LoMa
- Replaced direct use of copy.deepcopy with custom copy method in two places.
- Added a new `copy` method to the `EDisGo` class, supporting both shallow and deep copies while excluding the SQLAlchemy engine from being copied.
- Ensured proper restoration of the SQLAlchemy engine after copying.
…ase-imports-not-working-ssh-tunnel-limitations

Refactor object copying in EDisGo class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants