def _update_index(self, axis, key, value):
<EOL>if value is None:<EOL><INDENT>return delattr(self, key)<EOL><DEDENT>_key = "<STR_LIT>".format(key)<EOL>index = "<STR_LIT>".format(axis)<EOL>unit = "<STR_LIT>".format(axis)<EOL>if not isinstance(value, Quantity):<EOL><INDENT>try:<EOL><INDENT>value = Quantity(value, getattr(self, unit))<EOL><DEDENT>except TypeError:<EOL><INDENT>value = Quantity(float(value), getattr(self, unit))<EOL><DEDENT><DEDENT>try:<EOL><INDENT>curr = getattr(self, _key)<EOL><DEDENT>except AttributeError:<EOL><INDENT>delattr(self, index)<EOL><DEDENT>else:<EOL><INDENT>if (<EOL>value is None or<EOL>getattr(self, key) is None or<EOL>not value.unit.is_equivalent(curr.unit) or<EOL>value != curr<EOL>):<EOL><INDENT>delattr(self, index)<EOL><DEDENT><DEDENT>setattr(self, _key, value)<EOL>return value<EOL>
Update the current axis index based on a given key or value

        This is an internal method designed to set the origin or step for
        an index, whilst updating existing Index arrays as appropriate

        Examples
        --------
        >>> self._update_index("x0", 0)
        >>> self._update_index("dx", 0)

        To actually set an index array, use `_set_index`