Skip to content

Commit

Permalink
Fix units example, drop units using magnitude
Browse files Browse the repository at this point in the history
  • Loading branch information
ksunden committed Jul 5, 2024
1 parent 3b8662e commit f7c8a07
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@

xconv = FuncEdge.from_func(
"xconv",
lambda x, xunits: x.to(xunits),
lambda x, xunits: x.to(xunits).magnitude,
{"x": unit_vector, "xunits": scalar},
{"x": Desc(("N",), "data")},
)
yconv = FuncEdge.from_func(
"yconv",
lambda y, yunits: y.to(yunits),
lambda y, yunits: y.to(yunits).magnitude,
{"y": unit_vector, "yunits": scalar},
{"y": Desc(("N",), "data")},
)
lw = Line(cont, [xconv, yconv])

ax.add_artist(lw)
nax.xaxis.set_units(ureg.m)
nax.yaxis.set_units(ureg.cm)
nax.xaxis.set_units(ureg.ft)
nax.yaxis.set_units(ureg.m)

plt.show()

0 comments on commit f7c8a07

Please sign in to comment.