10000 Add option for fine control of frame label placement wrt frame origin · krishanrana/spatialmath-python@2e6aadf · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e6aadf

Browse files
committed
Add option for fine control of frame label placement wrt frame origin
1 parent 5034c78 commit 2e6aadf

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

spatialmath/base/transforms3d.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,8 +2330,8 @@ def _vec2s(fmt, v):
23302330

23312331
def trplot(T, axes=None, block=False, dims=None, color='blue', frame=None, # pylint: disable=unused-argument,function-redefined
23322332
textcolor=None, labels=('X', 'Y', 'Z'), length=1, style='arrow',
2333-
originsize=20, origincolor=None, projection='ortho', wtl=0.2, width=None, d1=0.05,
2334-
d2=1.15, anaglyph=None, **kwargs):
2333+
originsize=20, origincolor=None, projection='ortho', wtl=0.2, width=None,
2334+
d2=1.15, flo=(-0.05, -0.05, -0.05), anaglyph=None, **kwargs):
23352335
"""
23362336
Plot a 3D coordinate frame
23372337
@@ -2371,8 +2371,11 @@ def trplot(T, axes=None, block=False, dims=None, color='blue', frame=None, # p
23712371
:type projection: str
23722372
:param width: width of lines, default 1
23732373
:type width: float
2374-
:param d1: distance of frame axis label text from origin, default 1.15
2375-
:type d2: distance of frame label text from origin, default 0.05
2374+
:param flo: frame label offset, a vector for frame label text string relative
2375+
to frame origin, default (-0.05, -0.05, -0.05)
2376+
:type flo: array_like(3)
2377+
:param d2: distance of frame axis label text from origin, default 1.15
2378+
:type d2: float
23762379
:return: axes containing the frame
23772380
:rtype: Axes3DSubplot
23782381
:raises ValueError: bad arguments
@@ -2494,7 +2497,7 @@ def trplot(T, axes=None, block=False, dims=None, color='blue', frame=None, # p
24942497
trplot(Tk, axes=ax, block=block, dims=dims, color=color, frame=frame,
24952498
textcolor=textcolor, labels=labels, length=length, style=style,
24962499
projection=projection, originsize=originsize, origincolor=origincolor, wtl=wtl, width=width, d1=d1,
2497-
d2=d2, anaglyph=anaglyph, **kwargs)
2500+
d2=d2, flo=flo, anaglyph=anaglyph, **kwargs)
24982501
return
24992502

25002503
if dims is not None:
@@ -2540,7 +2543,7 @@ def trplot(T, axes=None, block=False, dims=None, color='blue', frame=None, # p
25402543
else:
25412544
origincolor = 'black'
25422545

2543-
o1 = T @ np.array([-d1, -d1, -d1, 1])
2546+
o1 = T @ np.array(np.r_[flo, 1])
25442547
ax.text(o1[0], o1[1], o1[2], r'$\{' + frame + r'\}$', color=textcolor, verticalalignment='top', horizontalalignment='center')
25452548

25462549
# add the labels to each axis

0 commit comments

Comments
 (0)
0