The "multi" flag is good so that you don't accidentally invert an axis twice (i.e. do nothing) or similar toggle a grid twice. The problem I see is that all the other plotting features (limits, titles, labels) are locked up, doomed to the same fate as grid and invert.
A simple way to get around double toggling the inversion is to use yaxis_inverted() which returns true if the axis is already inverted. You can check if the inversion operation has already been done and if so, do nothing.
The grid property is a little bit harder and requires dangerously checking some private variables, it seems this is the only solution, however. The following code should work to detect either major or minor grids:
xGridOn = ax.xaxis._gridOnMajor or ax.xaxis._gridOnMinor
yGridOn = ax.yaxis._gridOnMajor or ax.yaxis._gridOnMinor
Some basic tests show that this works well in practice.
The "multi" flag is good so that you don't accidentally invert an axis twice (i.e. do nothing) or similar toggle a grid twice. The problem I see is that all the other plotting features (limits, titles, labels) are locked up, doomed to the same fate as grid and invert.
A simple way to get around double toggling the inversion is to use yaxis_inverted() which returns true if the axis is already inverted. You can check if the inversion operation has already been done and if so, do nothing.
The grid property is a little bit harder and requires dangerously checking some private variables, it seems this is the only solution, however. The following code should work to detect either major or minor grids: xGridOn = ax.xaxis._gridOnMajor or ax.xaxis._gridOnMinor yGridOn = ax.yaxis._gridOnMajor or ax.yaxis._gridOnMinor
Some basic tests show that this works well in practice.