Skip to content

Commit

Permalink
fix units dimensionless in plots
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskoenig committed Mar 4, 2021
1 parent 0d813ee commit 3387445
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions release-notes/next-release.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Release notes for sbmlsim x.y.z
- breaking changes in units handling
- bugfix plotting `dimensionless` units in labels
5 changes: 4 additions & 1 deletion src/sbmlsim/plot/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ def __init__(
if unit is None:
unit = "?"
if not name:
name = f"{label} [{unit}]"
if unit != "dimensionless":
name = f"{label} [{unit}]"
else:
name = f"{label} [-]"

self.label = label
self.name = name
Expand Down
8 changes: 4 additions & 4 deletions src/sbmlsim/plot/plotting_matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ def get_scale(axis):

ridx = subplot.row - 1
cidx = subplot.col - 1
ax = fig.add_subplot(
ax: plt.Axes = fig.add_subplot(
gs[ridx : ridx + subplot.row_span, cidx : cidx + subplot.col_span]
) # type: plt.Axes
)

plot = subplot.plot
xax = plot.xaxis # type: Axis
yax = plot.yaxis # type: Axis
xax: Axis = plot.xaxis
yax: Axis = plot.yaxis

# units
if xax is None:
Expand Down

0 comments on commit 3387445

Please sign in to comment.