# Buggy code
def add_markers(self, marker_coords, marker_color="r", marker_size=30, **kwargs):
    """Add markers to the plot.

    Parameters
    ----------
    marker_coords: array of size (n_markers, 3)
        Coordinates of the markers to plot. For each slice, only markers
        that are 2 millimeters away from the slice are plotted.
    marker_color: pyplot compatible color or list of shape (n_markers,)
        List of colors for each marker that can be string or matplotlib
        colors
    marker_size: single float or list of shape (n_markers,)
        Size in pixel for each marker
    """
    defaults = {"marker": "o", "zorder": 1000}
    marker_coords = np.asanyarray(marker_coords)
    for k, v in defaults.items():
        kwargs.setdefault(k, v)

    for display_ax in self.axes.values():
        direction = display_ax.direction
        coord = display_ax.coord
        marker_coords_2d, third_d = _coords_3d_to_2d(
            marker_coords, direction, return_direction=True
        )
        # Heuristic that plots only markers that are 2mm away from the
        # current slice.
        # XXX: should we keep this heuristic?
        mask = np.abs(third_d - coord) <= 2.0
        xdata, ydata = marker_coords_2d.T
        display_ax.ax.scatter(
            xdata[mask], ydata[mask], s=marker_size, c=marker_color, **kwargs
        )


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-8bfe69e50628> in <module>()
4 # and third argument `marker_size` denotes size of the sphere
5 coords = [(-34, -39, -9)]
----> 6 fig.add_markers(coords)

C:\Anaconda2\lib\site-packages\nilearn\plotting\displays.pyc in add_markers(self, marker_coords, marker_color, marker_size, **kwargs)
833             # current slice.
834             # XXX: should we keep this heuristic?
--> 835             mask = np.abs(third_d - coord) <= 2.
836             xdata, ydata = marker_coords_2d.T
837             display_ax.ax.scatter(xdata[mask], ydata[mask],

TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'

# Fixed code
def add_markers(self, marker_coords, marker_color="r", marker_size=30, **kwargs):
    """Add markers to the plot.

    Parameters
    ----------
    marker_coords: array of size (n_markers, 3)
        Coordinates of the markers to plot. For each slice, only markers
        that are 2 millimeters away from the slice are plotted.
    marker_color: pyplot compatible color or list of shape (n_markers,)
        List of colors for each marker that can be string or matplotlib
        colors
    marker_size: single float or list of shape (n_markers,)
        Size in pixel for each marker
    """
    defaults = {"marker": "o", "zorder": 1000}
    marker_coords = np.asanyarray(marker_coords)
    for k, v in defaults.items():
        kwargs.setdefault(k, v)

    for display_ax in self.axes.values():
        direction = display_ax.direction
        coord = display_ax.coord
        marker_coords_2d, third_d = _coords_3d_to_2d(
            marker_coords, direction, return_direction=True
        )
        xdata, ydata = marker_coords_2d.T
        # Check if coord has integer represents a cut in direction
        # to follow the heuristic. If no foreground image is given
        # coordinate is empty or None. This case is valid for plotting
        # markers on glass brain without any foreground image.
        if isinstance(coord, numbers.Number):
            # Heuristic that plots only markers that are 2mm away
            # from the current slice.
            # XXX: should we keep this heuristic?
            mask = np.abs(third_d - coord) <= 2.0
            xdata = xdata[mask]
            ydata = ydata[mask]
        display_ax.ax.scatter(xdata, ydata, s=marker_size, c=marker_color, **kwargs)