Skip to content

Commit

Permalink
Fix histogram not plotting for imported invars
Browse files Browse the repository at this point in the history
  • Loading branch information
scottshambaugh committed Feb 26, 2024
1 parent bcf538d commit 5ed4fb4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
### Removed


## [0.11.7] - 2024-02-19
### Changed
* Fix histogram not plotting for imported invars GH#8

## [0.11.6] - 2024-02-19
### Changed
* Fix broken docs build
Expand All @@ -39,7 +43,7 @@

## [0.11.1] - 2024-02-19
### Changed
* Fix underflow issue in dvars
* Fix underflow issue in dvars GH#7


## [0.11.0] - 2023-11-05
Expand All @@ -58,7 +62,7 @@
* Allow passing in varname strings to `sim.plot`.
### Changed
* License changed from GPLv3 to more permissive MIT (ok because single author project).
* Fix `sim.plot` scalarvars not being used.
* Fix `sim.plot` scalarvars not being used GH#6
### Removed


Expand Down
6 changes: 6 additions & 0 deletions src/monaco/mc_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ def plot_hist(var : InVar | OutVar,
counts, bins = np.histogram(nums, bins=bins)

if isinstance(var, monaco.mc_var.InVar):
# Loaded from file
if var.dist is None:
plt.hist(bins[:-1], bins=bins, weights=counts/sum(counts), density=True,
cumulative=cumulative, orientation=orientation, histtype='bar',
facecolor='k', alpha=0.5, **plotkwargs)

# Continuous distribution
if isinstance(var.dist, rv_continuous):
plt.hist(bins[:-1], bins=bins, weights=counts/sum(counts), density=True,
Expand Down

0 comments on commit 5ed4fb4

Please sign in to comment.