bdaiinstitute/spatialmath-python

plot() doesn't work.

benthebear93 opened this issue · 6 comments

Hi, i have tried simple plotting for SE3

but it dosent show anything.

from spatialmath import * import matplotlib.pyplot as plt X = SE3(1,2,3)*SE3.Rx(30, 'deg') print(X) X.plot()

this code print out the X but not the figure. and it doesn't show any error.
is there anything i missed?

my python version is 3.6.8

Maybe something in your Matplotlib config? I'm using Python 3.8.5 and MPL 3.3.4

I check with several different computer with different python(3.6, 3.7, 3.8) but not sure about MPL versions, i will recheck and comback!

do you use MPL for other things?

In the code, no i only tried to plot the SE3(1,2,3)*SE3.Rx(30, 'deg').

`>>> from spatialmath import *

import matplotlib.pyplot as plt
X = SE3(1,2,3)*SE3.Rx(30,'deg')
print(X)
1 0 0 1
0 0.866 -0.5 2
0 0.5 0.866 3
0 0 0 1

X.plot()
`

and my MPL version is 3.3.4

In fresh python session try

>>> import matplotlib.pyplot as plt
>>> plt.plot(1,2,'ok')

Oh, i got it.
reading this

T = SE3(1,2,3) * SE3.Rx(30, 'deg')
T.print()
1 0 0 1
0 0.866025 -0.5 2
0 0.5 0.866025 3
0 0 0 1

T.printline()
t = 1, 2, 3; rpy/zyx = 30, 0, 0 deg

T.plot()

I thought plot() has plt.show() too but i guess i forgot to add plt.show()

sorry for bad issue.