Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set axis ranges, axes for animate? #126

Closed
johann-petrak opened this issue Jul 3, 2024 · 2 comments
Closed

Cannot set axis ranges, axes for animate? #126

johann-petrak opened this issue Jul 3, 2024 · 2 comments
Assignees

Comments

@johann-petrak
Copy link

johann-petrak commented Jul 3, 2024

I tried the .animate method and noticed that the dims=[from,to] parameter does not have any influence on the axis ranges.
I also tried to pass a pre-configured axis (with the axis ranges set manually via the matplotlib api) to the method using ax=myaxes, but this complains about ax getting passed twice in some nested function.

I trying this using the "%matplotlib widget" pragma, since I am using jupyter lab / notebook 7 or newer.

BTW I found that passing an axis to the .plot() method is the only way to avoid getting two figures in stead of one in that context. When I run

T1 = spatialmath.SE3.Trans(1,2,3)
fig=plt.figure() 
T1.plot()
plt.show()

I get two figures.

Running

fig=plt.figure() 
T1 = spatialmath.SE3.Trans(1,2,3)
ax = fig.add_subplot(111, projection='3d')
T1.plot(ax=ax)
plt.show()

shows correctly just one figure.

This allows me to set the axis ranges in a plot:

fig=plt.figure() 
T1 = spatialmath.SE3.Trans(1,2,3)
T1.plot(dims=[-3,5])
plt.show()

But the axis ranges are not set with animate (instead the default range 0,1 is shown):

T1 = spatialmath.SE3.Trans(1,2,3)
fig=plt.figure()
T1.animate(dims=[-3,3])
plt.show()

and it is also not possible to pass ax=ax to animate.

Package versions:
spatialmath 1.1.10
matplotlib 3.9.0
IPython 8.26.0
notebook 7.2.1
jupyter 1.0.0
jupyterlab 4.2.3
ipywidgets 8.1.3

@johann-petrak johann-petrak changed the title Cannot set axis ranges, axes for animate? Getting two figures (one empty) instead of one? Cannot set axis ranges, axes for animate? Jul 10, 2024
@jcao-bdai
Copy link
Collaborator

jcao-bdai commented Jul 19, 2024

Hi @johann-petrak , thank you for providing a detailed report

we've implemented an initial fix, in pull-request #131

please note that

  • this fix mainly focuses on implementing a consistent API with ax= and dims= arguments;
  • the other behavior you described at the beginning of this Issue (a redundant blank figure being created) is not yet fixed.

please feel free to give it a try if you are interested.

we will merge and cut a new release after we do more testing.

@jcao-bdai jcao-bdai self-assigned this Jul 19, 2024
jcao-bdai added a commit that referenced this issue Jul 29, 2024
Fix several issues related to #126
- expose "ax" and "dims" arguments to animate(...), to be consistent with other API's;
- update animate implementation to be consistent with trajectory frame's data type, in particular, SE3Array / SO3Array types instead of SE3 / SO3, in line with animate.run(...)'s implementation.
@jcao-bdai
Copy link
Collaborator

PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants