# Buggy code
def scatter(
    self,
    x,
    y,
    s=20,
    c=None,
    marker="o",
    cmap=None,
    norm=None,
    vmin=None,
    vmax=None,
    alpha=None,
    linewidths=None,
    verts=None,
    edgecolors=None,
    **kwargs,
):
    """
    Make a scatter plot of x vs y, where x and y are sequence like objects
    of the same length.

    Parameters
    ----------
    x, y : array_like, shape (n, )
        Input data

    s : scalar or array_like, shape (n, ), optional, default: 20
        size in points^2.

    c : color, sequence, or sequence of color, optional, default: 'b'
        `c` can be a single color format string, or a sequence of color
        specifications of length `N`, or a sequence of `N` numbers to be
        mapped to colors using the `cmap` and `norm` specified via kwargs
        (see below). Note that `c` should not be a single numeric RGB or
        RGBA sequence because that is indistinguishable from an array of
        values to be colormapped.  `c` can be a 2-D array in which the
        rows are RGB or RGBA, however, including the case of a single
        row to specify the same color for all points.

    marker : `~matplotlib.markers.MarkerStyle`, optional, default: 'o'
        See `~matplotlib.markers` for more information on the different
        styles of markers scatter supports. `marker` can be either
        an instance of the class or the text shorthand for a particular
        marker.

    cmap : `~matplotlib.colors.Colormap`, optional, default: None
        A `~matplotlib.colors.Colormap` instance or registered name.
        `cmap` is only used if `c` is an array of floats. If None,
        defaults to rc `image.cmap`.

    norm : `~matplotlib.colors.Normalize`, optional, default: None
        A `~matplotlib.colors.Normalize` instance is used to scale
        luminance data to 0, 1. `norm` is only used if `c` is an array of
        floats. If `None`, use the default :func:`normalize`.

    vmin, vmax : scalar, optional, default: None
        `vmin` and `vmax` are used in conjunction with `norm` to normalize
        luminance data.  If either are `None`, the min and max of the
        color array is used.  Note if you pass a `norm` instance, your
        settings for `vmin` and `vmax` will be ignored.

    alpha : scalar, optional, default: None
        The alpha blending value, between 0 (transparent) and 1 (opaque)

    linewidths : scalar or array_like, optional, default: None
        If None, defaults to (lines.linewidth,).

    edgecolors : color or sequence of color, optional, default: None
        If None, defaults to (patch.edgecolor).
        If 'face', the edge color will always be the same as
        the face color.  If it is 'none', the patch boundary will not
        be drawn.  For non-filled markers, the `edgecolors` kwarg
        is ignored; color is determined by `c`.

    Returns
    -------
    paths : `~matplotlib.collections.PathCollection`

    Other parameters
    ----------------
    kwargs : `~matplotlib.collections.Collection` properties

    Notes
    ------
    Any or all of `x`, `y`, `s`, and `c` may be masked arrays, in
    which case all masks will be combined and only unmasked points
    will be plotted.

    Fundamentally, scatter works with 1-D arrays; `x`, `y`, `s`,
    and `c` may be input as 2-D arrays, but within scatter
    they will be flattened. The exception is `c`, which
    will be flattened only if its size matches the size of `x`
    and `y`.

    Examples
    --------
    .. plot:: mpl_examples/shapes_and_collections/scatter_demo.py

    """

    if not self._hold:
        self.cla()

    # Process **kwargs to handle aliases, conflicts with explicit kwargs:

    facecolors = None
    ec = kwargs.pop("edgecolor", None)
    if ec is not None:
        edgecolors = ec
    fc = kwargs.pop("facecolor", None)
    if fc is not None:
        facecolors = fc
    fc = kwargs.pop("facecolors", None)
    if fc is not None:
        facecolors = fc
    # 'color' should be deprecated in scatter, or clearly defined;
    # since it isn't, I am giving it low priority.
    co = kwargs.pop("color", None)
    if co is not None:
        if edgecolors is None:
            edgecolors = co
        if facecolors is None:
            facecolors = co
    if c is None:
        if facecolors is not None:
            c = facecolors
        else:
            c = "b"  # The original default

    self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
    x = self.convert_xunits(x)
    y = self.convert_yunits(y)

    # np.ma.ravel yields an ndarray, not a masked array,
    # unless its argument is a masked array.
    x = np.ma.ravel(x)
    y = np.ma.ravel(y)
    if x.size != y.size:
        raise ValueError("x and y must be the same size")

    s = np.ma.ravel(s)  # This doesn't have to match x, y in size.

    # After this block, c_array will be None unless
    # c is an array for mapping.  The potential ambiguity
    # with a sequence of 3 or 4 numbers is resolved in
    # favor of mapping, not rgb or rgba.
    try:
        c_array = np.asanyarray(c, dtype=float)
        if c_array.size == x.size:
            c = np.ma.ravel(c_array)
        else:
            # Wrong size; it must not be intended for mapping.
            c_array = None
    except ValueError:
        # Failed to make a floating-point array; c must be color specs.
        c_array = None

    if c_array is None:
        colors = c  # must be acceptable as PathCollection facecolors
    else:
        colors = None  # use cmap, norm after collection is created

    # c will be unchanged unless it is the same length as x:
    x, y, s, c = cbook.delete_masked_points(x, y, s, c)

    scales = s  # Renamed for readability below.

    # to be API compatible
    if marker is None and not (verts is None):
        marker = (verts, 0)
        verts = None

    if isinstance(marker, mmarkers.MarkerStyle):
        marker_obj = marker
    else:
        marker_obj = mmarkers.MarkerStyle(marker)

    path = marker_obj.get_path().transformed(marker_obj.get_transform())
    if not marker_obj.is_filled():
        edgecolors = "face"

    offsets = np.dstack((x, y))

    collection = mcoll.PathCollection(
        (path,),
        scales,
        facecolors=colors,
        edgecolors=edgecolors,
        linewidths=linewidths,
        offsets=offsets,
        transOffset=kwargs.pop("transform", self.transData),
        alpha=alpha,
    )
    collection.set_transform(mtransforms.IdentityTransform())
    collection.update(kwargs)

    if colors is None:
        if norm is not None and not isinstance(norm, mcolors.Normalize):
            msg = "'norm' must be an instance of 'mcolors.Normalize'"
            raise ValueError(msg)
        collection.set_array(np.asarray(c))
        collection.set_cmap(cmap)
        collection.set_norm(norm)

        if vmin is not None or vmax is not None:
            collection.set_clim(vmin, vmax)
        else:
            collection.autoscale_None()

    # The margin adjustment is a hack to deal with the fact that we don't
    # want to transform all the symbols whose scales are in points
    # to data coords to get the exact bounding box for efficiency
    # reasons.  It can be done right if this is deemed important.
    # Also, only bother with this padding if there is anything to draw.
    if self._xmargin < 0.05 and x.size > 0:
        self.set_xmargin(0.05)

    if self._ymargin < 0.05 and x.size > 0:
        self.set_ymargin(0.05)

    self.add_collection(collection)
    self.autoscale_view()

    return collection


# Traceback (ValueError)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgba(self, arg, alpha)
367                     raise ValueError(
--> 368                             'length of rgba sequence should be either 3 or 4')
369             else:

ValueError: length of rgba sequence should be either 3 or 4

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgba_array(self, c, alpha)
398             # Single value? Put it in an array with a single row.
--> 399             return np.array([self.to_rgba(c, alpha)], dtype=np.float)
400         except ValueError:

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgba(self, arg, alpha)
375             raise ValueError(
--> 376                 'to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
377

ValueError: to_rgba: Invalid rgba arg "6574    0.000165
6674    0.000167
6774    0.000168
6873    0.000165
6874    0.000170
6973    0.000166
6974    0.000171
7073    0.000167
7074    0.000173
7172    0.000163
7173    0.000168
7174    0.000174
7272    0.000164
7273    0.000169
7274    0.000176
7372    0.000165
7373    0.000170
7374    0.000177
7472    0.000166
7473    0.000172
7474    0.000179
7571    0.000162
7572    0.000167
7573    0.000173
7574    0.000181
7671    0.000163
7672    0.000168
7673    0.000175
7674    0.000183
7771    0.000163
...
9670    0.000193
9671    0.000207
9672    0.000221
9673    0.000236
9765    0.000138
9766    0.000148
9767    0.000158
9768    0.000170
9769    0.000183
9770    0.000196
9771    0.000211
9772    0.000226
9864    0.000130
9865    0.000140
9866    0.000150
9867    0.000161
9868    0.000173
9869    0.000186
9870    0.000200
9871    0.000215
9872    0.000230
9964    0.000131
9965    0.000142
9966    0.000152
9967    0.000163
9968    0.000176
9969    0.000189
9970    0.000204
9971    0.000219
9972    0.000234
Name: sum_prob, dtype: float64"
length of rgba sequence should be either 3 or 4

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgb(self, arg)
321                 raise ValueError(
--> 322                     'cannot convert argument to rgb sequence')
323

ValueError: cannot convert argument to rgb sequence

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgba(self, arg, alpha)
369             else:
--> 370                 r, g, b = self.to_rgb(arg)
371             if alpha is None:

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgb(self, arg)
327             raise ValueError(
--> 328                 'to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc))
329             # Error messages could be improved by handling TypeError

ValueError: to_rgb: Invalid rgb arg "0.000165462141918"
cannot convert argument to rgb sequence

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-40-c01684ee4af6> in <module>()
22 #plt.show()
23
---> 24 ax.scatter("lon", "lat", color=good_data["sum_prob"], lw = 0, data=good_data, transform=ll_proj)
25 #ax.scatter("lon", "lat", color="sum_prob", lw = 0, data=best, transform=ll_proj)

C:\portabel\miniconda\envs\zalando\lib\site-packages\cartopy\mpl\geoaxes.py in scatter(self, *args, **kwargs)
1179                              '(PlateCarree or RotatedPole).')
1180
-> 1181         result = matplotlib.axes.Axes.scatter(self, *args, **kwargs)
1182         self.autoscale_view()
1183         return result

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\__init__.py in inner(ax, *args, **kwargs)
1809                     warnings.warn(msg % (label_namer, func.__name__),
1810                                   RuntimeWarning, stacklevel=2)
-> 1811             return func(ax, *args, **kwargs)
1812         pre_doc = inner.__doc__
1813         if pre_doc is None:

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\axes\_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
3891                 offsets=offsets,
3892                 transOffset=kwargs.pop('transform', self.transData),
-> 3893                 alpha=alpha
3894                 )
3895         collection.set_transform(mtransforms.IdentityTransform())

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\collections.py in __init__(self, paths, sizes, **kwargs)
829         """
830
--> 831         Collection.__init__(self, **kwargs)
832         self.set_paths(paths)
833         self.set_sizes(sizes)

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\collections.py in __init__(self, edgecolors, facecolors, linewidths, linestyles, antialiaseds, offsets, transOffset, norm, cmap, pickradius, hatch, urls, offset_position, zorder, **kwargs)
114         cm.ScalarMappable.__init__(self, norm, cmap)
115
--> 116         self.set_edgecolor(edgecolors)
117         self.set_facecolor(facecolors)
118         self.set_linewidth(linewidths)

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\collections.py in set_edgecolor(self, c)
658             c = mpl.rcParams['patch.edgecolor']
659         self._edgecolors_original = c
--> 660         self._edgecolors = mcolors.colorConverter.to_rgba_array(c, self._alpha)
661         self.stale = True
662

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgba_array(self, c, alpha)
420             result = np.zeros((nc, 4), dtype=np.float)
421             for i, cc in enumerate(c):
--> 422                 result[i] = self.to_rgba(cc, alpha)
423             return result
424

C:\portabel\miniconda\envs\zalando\lib\site-packages\matplotlib\colors.py in to_rgba(self, arg, alpha)
374         except (TypeError, ValueError) as exc:
375             raise ValueError(
--> 376                 'to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
377
378     def to_rgba_array(self, c, alpha=None):

ValueError: to_rgba: Invalid rgba arg "0.000165462141918"
to_rgb: Invalid rgb arg "0.000165462141918"
cannot convert argument to rgb sequence

# Fixed code
def scatter(
    self,
    x,
    y,
    s=20,
    c=None,
    marker="o",
    cmap=None,
    norm=None,
    vmin=None,
    vmax=None,
    alpha=None,
    linewidths=None,
    verts=None,
    edgecolors=None,
    **kwargs,
):
    """
    Make a scatter plot of x vs y, where x and y are sequence like objects
    of the same length.

    Parameters
    ----------
    x, y : array_like, shape (n, )
        Input data

    s : scalar or array_like, shape (n, ), optional, default: 20
        size in points^2.

    c : color, sequence, or sequence of color, optional, default: 'b'
        `c` can be a single color format string, or a sequence of color
        specifications of length `N`, or a sequence of `N` numbers to be
        mapped to colors using the `cmap` and `norm` specified via kwargs
        (see below). Note that `c` should not be a single numeric RGB or
        RGBA sequence because that is indistinguishable from an array of
        values to be colormapped.  `c` can be a 2-D array in which the
        rows are RGB or RGBA, however, including the case of a single
        row to specify the same color for all points.

    marker : `~matplotlib.markers.MarkerStyle`, optional, default: 'o'
        See `~matplotlib.markers` for more information on the different
        styles of markers scatter supports. `marker` can be either
        an instance of the class or the text shorthand for a particular
        marker.

    cmap : `~matplotlib.colors.Colormap`, optional, default: None
        A `~matplotlib.colors.Colormap` instance or registered name.
        `cmap` is only used if `c` is an array of floats. If None,
        defaults to rc `image.cmap`.

    norm : `~matplotlib.colors.Normalize`, optional, default: None
        A `~matplotlib.colors.Normalize` instance is used to scale
        luminance data to 0, 1. `norm` is only used if `c` is an array of
        floats. If `None`, use the default :func:`normalize`.

    vmin, vmax : scalar, optional, default: None
        `vmin` and `vmax` are used in conjunction with `norm` to normalize
        luminance data.  If either are `None`, the min and max of the
        color array is used.  Note if you pass a `norm` instance, your
        settings for `vmin` and `vmax` will be ignored.

    alpha : scalar, optional, default: None
        The alpha blending value, between 0 (transparent) and 1 (opaque)

    linewidths : scalar or array_like, optional, default: None
        If None, defaults to (lines.linewidth,).

    edgecolors : color or sequence of color, optional, default: None
        If None, defaults to (patch.edgecolor).
        If 'face', the edge color will always be the same as
        the face color.  If it is 'none', the patch boundary will not
        be drawn.  For non-filled markers, the `edgecolors` kwarg
        is ignored; color is determined by `c`.

    Returns
    -------
    paths : `~matplotlib.collections.PathCollection`

    Other parameters
    ----------------
    kwargs : `~matplotlib.collections.Collection` properties

    Notes
    ------
    Any or all of `x`, `y`, `s`, and `c` may be masked arrays, in
    which case all masks will be combined and only unmasked points
    will be plotted.

    Fundamentally, scatter works with 1-D arrays; `x`, `y`, `s`,
    and `c` may be input as 2-D arrays, but within scatter
    they will be flattened. The exception is `c`, which
    will be flattened only if its size matches the size of `x`
    and `y`.

    Examples
    --------
    .. plot:: mpl_examples/shapes_and_collections/scatter_demo.py

    """

    if not self._hold:
        self.cla()

    # Process **kwargs to handle aliases, conflicts with explicit kwargs:

    facecolors = None
    edgecolors = kwargs.pop("edgecolor", edgecolors)
    fc = kwargs.pop("facecolors", None)
    fc = kwargs.pop("facecolor", fc)
    if fc is not None:
        facecolors = fc
    co = kwargs.pop("color", None)
    if co is not None:
        try:
            mcolors.colorConverter.to_rgba_array(co)
        except ValueError:
            raise ValueError(
                "'color' kwarg must be an mpl color"
                " spec or sequence of color specs.\n"
                "For a sequence of values to be"
                " color-mapped, use the 'c' kwarg instead."
            )
        if edgecolors is None:
            edgecolors = co
        if facecolors is None:
            facecolors = co
    if c is None:
        if facecolors is not None:
            c = facecolors
        else:
            c = "b"  # The original default

    self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
    x = self.convert_xunits(x)
    y = self.convert_yunits(y)

    # np.ma.ravel yields an ndarray, not a masked array,
    # unless its argument is a masked array.
    x = np.ma.ravel(x)
    y = np.ma.ravel(y)
    if x.size != y.size:
        raise ValueError("x and y must be the same size")

    s = np.ma.ravel(s)  # This doesn't have to match x, y in size.

    # After this block, c_array will be None unless
    # c is an array for mapping.  The potential ambiguity
    # with a sequence of 3 or 4 numbers is resolved in
    # favor of mapping, not rgb or rgba.
    try:
        c_array = np.asanyarray(c, dtype=float)
        if c_array.size == x.size:
            c = np.ma.ravel(c_array)
        else:
            # Wrong size; it must not be intended for mapping.
            c_array = None
    except ValueError:
        # Failed to make a floating-point array; c must be color specs.
        c_array = None

    if c_array is None:
        colors = c  # must be acceptable as PathCollection facecolors
    else:
        colors = None  # use cmap, norm after collection is created

    # c will be unchanged unless it is the same length as x:
    x, y, s, c = cbook.delete_masked_points(x, y, s, c)

    scales = s  # Renamed for readability below.

    # to be API compatible
    if marker is None and not (verts is None):
        marker = (verts, 0)
        verts = None

    if isinstance(marker, mmarkers.MarkerStyle):
        marker_obj = marker
    else:
        marker_obj = mmarkers.MarkerStyle(marker)

    path = marker_obj.get_path().transformed(marker_obj.get_transform())
    if not marker_obj.is_filled():
        edgecolors = "face"

    offsets = np.dstack((x, y))

    collection = mcoll.PathCollection(
        (path,),
        scales,
        facecolors=colors,
        edgecolors=edgecolors,
        linewidths=linewidths,
        offsets=offsets,
        transOffset=kwargs.pop("transform", self.transData),
        alpha=alpha,
    )
    collection.set_transform(mtransforms.IdentityTransform())
    collection.update(kwargs)

    if colors is None:
        if norm is not None and not isinstance(norm, mcolors.Normalize):
            msg = "'norm' must be an instance of 'mcolors.Normalize'"
            raise ValueError(msg)
        collection.set_array(np.asarray(c))
        collection.set_cmap(cmap)
        collection.set_norm(norm)

        if vmin is not None or vmax is not None:
            collection.set_clim(vmin, vmax)
        else:
            collection.autoscale_None()

    # The margin adjustment is a hack to deal with the fact that we don't
    # want to transform all the symbols whose scales are in points
    # to data coords to get the exact bounding box for efficiency
    # reasons.  It can be done right if this is deemed important.
    # Also, only bother with this padding if there is anything to draw.
    if self._xmargin < 0.05 and x.size > 0:
        self.set_xmargin(0.05)

    if self._ymargin < 0.05 and x.size > 0:
        self.set_ymargin(0.05)

    self.add_collection(collection)
    self.autoscale_view()

    return collection