Skip to content

Commit f7c8a07

Browse files
committed
Fix units example, drop units using magnitude
1 parent 3b8662e commit f7c8a07

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/units.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@
5050

5151
xconv = FuncEdge.from_func(
5252
"xconv",
53-
lambda x, xunits: x.to(xunits),
53+
lambda x, xunits: x.to(xunits).magnitude,
5454
{"x": unit_vector, "xunits": scalar},
5555
{"x": Desc(("N",), "data")},
5656
)
5757
yconv = FuncEdge.from_func(
5858
"yconv",
59-
lambda y, yunits: y.to(yunits),
59+
lambda y, yunits: y.to(yunits).magnitude,
6060
{"y": unit_vector, "yunits": scalar},
6161
{"y": Desc(("N",), "data")},
6262
)
6363
lw = Line(cont, [xconv, yconv])
6464

6565
ax.add_artist(lw)
66-
nax.xaxis.set_units(ureg.m)
67-
nax.yaxis.set_units(ureg.cm)
66+
nax.xaxis.set_units(ureg.ft)
67+
nax.yaxis.set_units(ureg.m)
6868

6969
plt.show()

0 commit comments

Comments
 (0)