Skip to content

Commit f1f24e4

Browse files
authored
Bugfix: allow to call ResultQuantityCollection.plot with kwargs. (#94)
1 parent 89f2f3c commit f1f24e4

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
### Changed
1010

11-
## [0.6.1] - 2024-03-22
11+
## [0.6.1] - 2024-03-23
1212

1313
### Fixed
1414

1515
- Loading MIKE IO 1D together with MIKE+Py
1616
- Fixed override_name parameter that was not working in ResultFrameAggregator
1717
- Fixed converting res11 to res1d
18+
- Fixed calling ResultQuantityCollection.plot with kwargs
1819

1920
## [0.6] - 2024-02-08
2021

mikeio1d/result_network/result_quantity_collection.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ def read(self, column_mode: Optional[str | ColumnMode] = None) -> pd.DataFrame:
6363
timeseries_ids = [q.timeseries_id for q in self.result_quantities]
6464
return self.res1d.read(timeseries_ids, column_mode=column_mode)
6565

66-
def plot(self):
66+
def plot(self, **kwargs):
6767
"""Plot the time series data."""
6868
if len(self.result_quantities) <= 0:
6969
return
7070

71+
# Taking the first data item is enough, because all of them have
72+
# the same quantity and for plotting.
7173
self.data_item = self.result_quantities[0].data_item
72-
ResultQuantity.plot(self)
74+
return ResultQuantity.plot(self, **kwargs)
7375

7476
def get_query(self):
7577
"""Get queries corresponding to ResultQuantityCollection."""

tests/test_res1d_network_river.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ def test_result_quantity_collection_methods(test_file):
390390
assert pytest.approx(max_value) == 100.247
391391

392392
# Test the calling of methods
393-
discharge_in_structure.plot()
393+
ax = discharge_in_structure.plot()
394+
discharge_in_structure.plot(ax=ax)
395+
394396
discharge_in_structure.to_csv(
395397
file_path.replace("network_river.res1d", "discharge_in_structure.extract.csv")
396398
)

0 commit comments

Comments
 (0)