openego / eTraGo

Optimization of flexibility options for transmission grids based on PyPSA
GNU Affero General Public License v3.0
30 stars 13 forks source link

plot_grid() throws an error when using bus_colors='gen_dist' #680

Closed ulfmueller closed 7 months ago

ulfmueller commented 8 months ago

I am not sure if it is just my case/fault but I am getting this error:

  Cell In[18], line 1
    plot_grid(n, line_colors='expansion_abs', bus_colors='gen_dist', bus_sizes=0.00000001, timesteps=range(len(n.network.snapshots)))

  File ~/github/eTraGo/etrago/tools/plot.py:2763 in plot_grid
    facecolor=network.carriers.color[i],

  File ~/venvs/etrago/lib/python3.8/site-packages/pandas/core/series.py:981 in __getitem__
    return self._get_value(key)

  File ~/venvs/etrago/lib/python3.8/site-packages/pandas/core/series.py:1089 in _get_value
    loc = self.index.get_loc(label)

  File ~/venvs/etrago/lib/python3.8/site-packages/pandas/core/indexes/base.py:3804 in get_loc
    raise KeyError(key) from err

KeyError: 'a'

It still shows me a plot but the e.g. the legend is missing... Have you or can you check if it occurs for you as well?

ClaraBuettner commented 8 months ago

This happened because the default parameter of scaling_store_expansion was not working when the bus_colors represented sth. else than storage expansion. I fixed this in https://github.com/openego/eTraGo/pull/692/commits/75e285b2d7a0d0c56a8ab1c6cceda73da5e0beb2