# Buggy code
def _update_patch_size(self):
    if self.is_on() and self.patch:
        ro, ri = self.size
        self.patch[0].radius = ro
        if ri > 0:
            self.patch[1].radius = ri
        self._update_resizers()
        self.draw_patch()


# Traceback (IndexError)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-1-4e82cadb3c15> in <module>()
11 annular_roi = hs.roi.CircleROI(r=6,cy=64,cx=64,r_inner=3)
12
---> 13 Roi2D = annular_roi.interactive(color='red',signal=s)

~/miniconda3/envs/hyperspy/lib/python3.6/site-packages/hyperspy/roi.py in interactive(self, signal, navigation_signal, out, color, **kwargs)
360             if navigation_signal not in self.signal_map:
361                 self.add_widget(navigation_signal, color=color,
--> 362                                 axes=kwargs.get("axes", None))
363         if (self.update not in
364                 signal.axes_manager.events.any_axis_changed.connected):

~/miniconda3/envs/hyperspy/lib/python3.6/site-packages/hyperspy/roi.py in add_widget(self, signal, axes, widget, color)
445             widget.set_mpl_ax(ax)
446         with widget.events.changed.suppress_callback(self._on_widget_change):
--> 447             self._apply_roi2widget(widget)
448
449         # Connect widget changes to on_widget_change

~/miniconda3/envs/hyperspy/lib/python3.6/site-packages/hyperspy/roi.py in _apply_roi2widget(self, widget)
825         widget.position = (self.cx, self.cy)
826         inner = self.r_inner if self.r_inner != t.Undefined else 0.0
--> 827         widget.size = (self.r, inner)
828
829     def _get_widget_type(self, axes, signal):

~/miniconda3/envs/hyperspy/lib/python3.6/site-packages/hyperspy/drawing/widget.py in <lambda>(s, v)
569             self._size_changed()
570
--> 571     size = property(lambda s: s._get_size(), lambda s, v: s._set_size(v))
572
573     def _do_snap_size(self, value=None):

~/miniconda3/envs/hyperspy/lib/python3.6/site-packages/hyperspy/drawing/_widgets/circle.py in _set_size(self, value)
69             if np.any(self._size != value):
70                 self._size = value
---> 71                 self._size_changed()
72
73     def increase_size(self):

~/miniconda3/envs/hyperspy/lib/python3.6/site-packages/hyperspy/drawing/widget.py in _size_changed(self)
613         self.events.resized.trigger(self)
614         self.events.changed.trigger(self)
--> 615         self._update_patch_size()
616
617     def get_size_in_indices(self):

~/miniconda3/envs/hyperspy/lib/python3.6/site-packages/hyperspy/drawing/_widgets/circle.py in _update_patch_size(self)
153             self.patch[0].radius = ro
154             if ri > 0:
--> 155                 self.patch[1].radius = ri
156             self._update_resizers()
157             self.draw_patch()

IndexError: list index out of range

# Fixed code
def _update_patch_size(self):
    if self.is_on() and self.patch:
        ro, ri = self.size
        self.patch[0].radius = ro
        if ri > 0:
            # Add the inner circle
            if len(self.patch) == 1:
                # Need to remove the previous patch before using
                # `_add_patch_to`
                self.ax.artists.remove(self.patch[0])
                self.patch = []
                self._add_patch_to(self.ax)
            self.patch[1].radius = ri
        self._update_resizers()
        self.draw_patch()