Skip to content

Commit

Permalink
fix: edge case 1 set of nodes with 1 node attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
JPXKQX committed Sep 13, 2024
1 parent 51af55c commit e2601b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/anemoi/graphs/plotting/displots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Union

import matplotlib.pyplot as plt
import numpy as np
import torch
from torch_geometric.data import HeteroData
from torch_geometric.data.storage import EdgeStorage
Expand Down Expand Up @@ -83,7 +84,9 @@ def plot_distribution_attributes(

# Define the layout
_, axs = plt.subplots(num_items, dim_attrs, figsize=(10 * num_items, 10))
if axs.ndim == 1:
if num_items == dim_attrs == 1:
axs = np.array([[axs]])
elif axs.ndim == 1:
axs = axs.reshape(num_items, dim_attrs)

for i, (item_name, item_store) in enumerate(graph_items):
Expand Down

0 comments on commit e2601b4

Please sign in to comment.