kakearney / plotboxpos-pkg

Return the position of the plotted region of a Matlab axis
MIT License
8 stars 1 forks source link

Function changes `CurrentAxes` object #3

Closed srkuberski closed 6 years ago

srkuberski commented 6 years ago

I noticed that by the creation of the temporary axes object the current axes of the figure object is changed. I think it would be good to restore the initial state before exiting since no one would expect an axes change after determining axes dimensions. Furthermore, the changed, new current axes object is not a valid object then.

kakearney commented 6 years ago

I don't think the current axis not being a viable object is an issue... the current axis designation should be switched to an existing axis as soon as the temporary axis is deleted. At least, that's the behavior I see in R2016b.

However, you're correct that the axis it chooses to make current after the temporary axis is deleted may not be the same one that was current before the function is called. That has now been fixed (f08a0ced0b0e71f807d55ee3fc4c51e2c998903a).