We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add alpha transparency to RadViz
To make the RadViz a bit easier to read, we can add optional transparency, set by the user to be able to distinguish regions of more or less density. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `yellowbrick/features/radviz.py`
Content:
```
1 # yellowbrick.features.radviz
2 # Implements radviz for feature analysis.
3 #
4 # Author:   Benjamin Bengfort <bbengfort@districtdatalabs.com>
5 # Created:  Fri Oct 07 13:18:00 2016 -0400
6 #
7 # Copyright (C) 2016 District Data Labs
8 # For license information, see LICENSE.txt
9 #
10 # ID: radviz.py [0f4b236] benjamin@bengfort.com $
11 
12 """
13 Implements radviz for feature analysis.
14 """
15 
16 ##########################################################################
17 ## Imports
18 ##########################################################################
19 
20 import numpy as np
21 import matplotlib.patches as patches
22 
23 from yellowbrick.utils import is_dataframe
24 from yellowbrick.features.base import DataVisualizer
25 import yellowbrick.utils.nan_warnings as nan_warnings
26 from yellowbrick.style.colors import resolve_colors
27 
28 
29 ##########################################################################
30 ## Quick Methods
31 ##########################################################################
32 
33 def radviz(X, y=None, ax=None, features=None, classes=None,
34            color=None, colormap=None, **kwargs):
35     """
36     Displays each feature as an axis around a circle surrounding a scatter
37     plot whose points are each individual instance.
38 
39     This helper function is a quick wrapper to utilize the RadialVisualizer
40     (Transformer) for one-off analysis.
41 
42     Parameters
43     ----------
44 
45     X : ndarray or DataFrame of shape n x m
46         A matrix of n instances with m features
47 
48     y : ndarray or Series of length n
49         An array or series of target or class values
50 
51     ax : matplotlib Axes, default: None
52         The axes to plot the figure on.
53 
54     features : list of strings, default: None
55         The names of the features or columns
56 
57     classes : list of strings, default: None
58         The names of the classes in the target
59 
60     color : list or tuple of colors, default: None
61         Specify the colors for each individual class
62 
63     colormap : string or matplotlib cmap, default: None
64         Sequential colormap for continuous target
65 
66     Returns
67     -------
68     ax : matplotlib axes
69         Returns the axes that the parallel coordinates were drawn on.
70     """
71     # Instantiate the visualizer
72     visualizer = RadialVisualizer(
73         ax, features, classes, color, colormap, **kwargs
74     )
75 
76     # Fit and transform the visualizer (calls draw)
77     visualizer.fit(X, y, **kwargs)
78     visualizer.transform(X)
79 
80     # Return the axes object on the visualizer
81     return visualizer.ax
82 
83 
84 ##########################################################################
85 ## Static RadViz Visualizer
86 ##########################################################################
87 
88 class RadialVisualizer(DataVisualizer):
89     """
90     RadViz is a multivariate data visualization algorithm that plots each
91     axis uniformely around the circumference of a circle then plots points on
92     the interior of the circle such that the point normalizes its values on
93     the axes from the center to each arc.
94 
95     Parameters
96     ----------
97 
98     ax : matplotlib Axes, default: None
99         The axis to plot the figure on. If None is passed in the current axes
100         will be used (or generated if required).
101 
102     features : list, default: None
103         a list of feature names to use
104         If a DataFrame is passed to fit and features is None, feature
105         names are selected as the columns of the DataFrame.
106 
107     classes : list, default: None
108         a list of class names for the legend
109         If classes is None and a y value is passed to fit then the classes
110         are selected from the target vector.
111 
112     color : list or tuple, default: None
113         optional list or tuple of colors to colorize lines
114         Use either color to colorize the lines on a per class basis or
115         colormap to color them on a continuous scale.
116 
117     colormap : string or cmap, default: None
118         optional string or matplotlib cmap to colorize lines
119         Use either color to colorize the lines on a per class basis or
120         colormap to color them on a continuous scale.
121 
122     kwargs : dict
123         Keyword arguments that are passed to the base class and may influence
124         the visualization as defined in other Visualizers.
125 
126     Examples
127     --------
128 
129     >>> visualizer = RadViz()
130     >>> visualizer.fit(X, y)
131     >>> visualizer.transform(X)
132     >>> visualizer.poof()
133 
134     Notes
135     -----
136     These parameters can be influenced later on in the visualization
137     process, but can and should be set as early as possible.
138     """
139 
140     def __init__(self, ax=None, features=None, classes=None, color=None,
141                  colormap=None, **kwargs):
142         super(RadialVisualizer, self).__init__(
143             ax, features, classes, color, colormap, **kwargs
144         )
145 
146     @staticmethod
147     def normalize(X):
148         """
149         MinMax normalization to fit a matrix in the space [0,1] by column.
150         """
151         a = X.min(axis=0)
152         b = X.max(axis=0)
153         return (X - a[np.newaxis, :]) / ((b - a)[np.newaxis, :])
154 
155     def draw(self, X, y, **kwargs):
156         """
157         Called from the fit method, this method creates the radviz canvas and
158         draws each instance as a class or target colored point, whose location
159         is determined by the feature data set.
160         """
161         # Convert from dataframe
162         if is_dataframe(X):
163             X = X.as_matrix()
164 
165         # Clean out nans and warn that the user they aren't plotted
166         nan_warnings.warn_if_nans_exist(X)
167         X, y = nan_warnings.filter_missing(X, y)
168 
169         # Get the shape of the data
170         nrows, ncols = X.shape
171 
172         # Set the axes limits
173         self.ax.set_xlim([-1,1])
174         self.ax.set_ylim([-1,1])
175 
176         # Create the colors
177         # TODO: Allow both colormap, listed colors, and palette definition
178         # TODO: Make this an independent function or property for override!
179         color_values = resolve_colors(
180             n_colors=len(self.classes_), colormap=self.colormap, colors=self.color
181         )
182         colors = dict(zip(self.classes_, color_values))
183 
184         # Create a data structure to hold scatter plot representations
185         to_plot = {}
186         for kls in self.classes_:
187             to_plot[kls] = [[], []]
188 
189         # Compute the arcs around the circumference for each feature axis
190         # TODO: make this an independent function for override
191         s = np.array([
192                 (np.cos(t), np.sin(t))
193                 for t in [
194                     2.0 * np.pi * (i / float(ncols))
195                     for i in range(ncols)
196                 ]
197             ])
198 
199         # Compute the locations of the scatter plot for each class
200         # Normalize the data first to plot along the 0, 1 axis
201         for i, row in enumerate(self.normalize(X)):
202             row_ = np.repeat(np.expand_dims(row, axis=1), 2, axis=1)
203             xy   = (s * row_).sum(axis=0) / row.sum()
204             kls = self.classes_[y[i]]
205 
206             to_plot[kls][0].append(xy[0])
207             to_plot[kls][1].append(xy[1])
208 
209         # Add the scatter plots from the to_plot function
210         # TODO: store these plots to add more instances to later
211         # TODO: make this a separate function
212         for i, kls in enumerate(self.classes_):
213             self.ax.scatter(to_plot[kls][0], to_plot[kls][1], color=colors[kls], label=str(kls), **kwargs)
214 
215         # Add the circular axis path
216         # TODO: Make this a seperate function (along with labeling)
217         self.ax.add_patch(patches.Circle((0.0, 0.0), radius=1.0, facecolor='none', edgecolor='grey', linewidth=.5 ))
218 
219         # Add the feature names
220         for xy, name in zip(s, self.features_):
221             # Add the patch indicating the location of the axis
222             self.ax.add_patch(patches.Circle(xy, radius=0.025, facecolor='#777777'))
223 
224             # Add the feature names offset around the axis marker
225             if xy[0] < 0.0 and xy[1] < 0.0:
226                 self.ax.text(xy[0] - 0.025, xy[1] - 0.025, name, ha='right', va='top', size='small')
227             elif xy[0] < 0.0 and xy[1] >= 0.0:
228                 self.ax.text(xy[0] - 0.025, xy[1] + 0.025, name, ha='right', va='bottom', size='small')
229             elif xy[0] >= 0.0 and xy[1] < 0.0:
230                 self.ax.text(xy[0] + 0.025, xy[1] - 0.025, name, ha='left', va='top', size='small')
231             elif xy[0] >= 0.0 and xy[1] >= 0.0:
232                 self.ax.text(xy[0] + 0.025, xy[1] + 0.025, name, ha='left', va='bottom', size='small')
233 
234         self.ax.axis('equal')
235 
236     def finalize(self, **kwargs):
237         """
238         Finalize executes any subclass-specific axes finalization steps.
239         The user calls poof and poof calls finalize.
240 
241         Parameters
242         ----------
243         kwargs: generic keyword arguments.
244 
245         """
246         # Set the title
247         self.set_title(
248             'RadViz for {} Features'.format(len(self.features_))
249         )
250 
251         # Remove the ticks from the graph
252         self.ax.set_yticks([])
253         self.ax.set_xticks([])
254 
255         # Add the legend
256         self.ax.legend(loc='best')
257 
258 
259 # Alias for RadViz
260 RadViz = RadialVisualizer
261
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/yellowbrick/features/radviz.py b/yellowbrick/features/radviz.py
--- a/yellowbrick/features/radviz.py
+++ b/yellowbrick/features/radviz.py
@@ -138,10 +138,11 @@
     """
 
     def __init__(self, ax=None, features=None, classes=None, color=None,
-                 colormap=None, **kwargs):
+                 colormap=None, alpha=1, **kwargs):
         super(RadialVisualizer, self).__init__(
             ax, features, classes, color, colormap, **kwargs
         )
+        self.alpha = alpha
 
     @staticmethod
     def normalize(X):
@@ -210,7 +211,7 @@
         # TODO: store these plots to add more instances to later
         # TODO: make this a separate function
         for i, kls in enumerate(self.classes_):
-            self.ax.scatter(to_plot[kls][0], to_plot[kls][1], color=colors[kls], label=str(kls), **kwargs)
+            self.ax.scatter(to_plot[kls][0], to_plot[kls][1], color=colors[kls], label=str(kls), alpha=self.alpha, **kwargs)
 
         # Add the circular axis path
         # TODO: Make this a seperate function (along with labeling)

{"golden_diff": "diff --git a/yellowbrick/features/radviz.py b/yellowbrick/features/radviz.py\n--- a/yellowbrick/features/radviz.py\n+++ b/yellowbrick/features/radviz.py\n@@ -138,10 +138,11 @@\n     \"\"\"\n \n     def __init__(self, ax=None, features=None, classes=None, color=None,\n-                 colormap=None, **kwargs):\n+                 colormap=None, alpha=1, **kwargs):\n         super(RadialVisualizer, self).__init__(\n             ax, features, classes, color, colormap, **kwargs\n         )\n+        self.alpha = alpha\n \n     @staticmethod\n     def normalize(X):\n@@ -210,7 +211,7 @@\n         # TODO: store these plots to add more instances to later\n         # TODO: make this a separate function\n         for i, kls in enumerate(self.classes_):\n-            self.ax.scatter(to_plot[kls][0], to_plot[kls][1], color=colors[kls], label=str(kls), **kwargs)\n+            self.ax.scatter(to_plot[kls][0], to_plot[kls][1], color=colors[kls], label=str(kls), alpha=self.alpha, **kwargs)\n \n         # Add the circular axis path\n         # TODO: Make this a seperate function (along with labeling)\n", "issue": "Add alpha transparency to RadViz\nTo make the RadViz a bit easier to read, we can add optional transparency, set by the user to be able to distinguish regions of more or less density. \n", "before_files": [{"content": "# yellowbrick.features.radviz\n# Implements radviz for feature analysis.\n#\n# Author:   Benjamin Bengfort <bbengfort@districtdatalabs.com>\n# Created:  Fri Oct 07 13:18:00 2016 -0400\n#\n# Copyright (C) 2016 District Data Labs\n# For license information, see LICENSE.txt\n#\n# ID: radviz.py [0f4b236] benjamin@bengfort.com $\n\n\"\"\"\nImplements radviz for feature analysis.\n\"\"\"\n\n##########################################################################\n## Imports\n##########################################################################\n\nimport numpy as np\nimport matplotlib.patches as patches\n\nfrom yellowbrick.utils import is_dataframe\nfrom yellowbrick.features.base import DataVisualizer\nimport yellowbrick.utils.nan_warnings as nan_warnings\nfrom yellowbrick.style.colors import resolve_colors\n\n\n##########################################################################\n## Quick Methods\n##########################################################################\n\ndef radviz(X, y=None, ax=None, features=None, classes=None,\n           color=None, colormap=None, **kwargs):\n    \"\"\"\n    Displays each feature as an axis around a circle surrounding a scatter\n    plot whose points are each individual instance.\n\n    This helper function is a quick wrapper to utilize the RadialVisualizer\n    (Transformer) for one-off analysis.\n\n    Parameters\n    ----------\n\n    X : ndarray or DataFrame of shape n x m\n        A matrix of n instances with m features\n\n    y : ndarray or Series of length n\n        An array or series of target or class values\n\n    ax : matplotlib Axes, default: None\n        The axes to plot the figure on.\n\n    features : list of strings, default: None\n        The names of the features or columns\n\n    classes : list of strings, default: None\n        The names of the classes in the target\n\n    color : list or tuple of colors, default: None\n        Specify the colors for each individual class\n\n    colormap : string or matplotlib cmap, default: None\n        Sequential colormap for continuous target\n\n    Returns\n    -------\n    ax : matplotlib axes\n        Returns the axes that the parallel coordinates were drawn on.\n    \"\"\"\n    # Instantiate the visualizer\n    visualizer = RadialVisualizer(\n        ax, features, classes, color, colormap, **kwargs\n    )\n\n    # Fit and transform the visualizer (calls draw)\n    visualizer.fit(X, y, **kwargs)\n    visualizer.transform(X)\n\n    # Return the axes object on the visualizer\n    return visualizer.ax\n\n\n##########################################################################\n## Static RadViz Visualizer\n##########################################################################\n\nclass RadialVisualizer(DataVisualizer):\n    \"\"\"\n    RadViz is a multivariate data visualization algorithm that plots each\n    axis uniformely around the circumference of a circle then plots points on\n    the interior of the circle such that the point normalizes its values on\n    the axes from the center to each arc.\n\n    Parameters\n    ----------\n\n    ax : matplotlib Axes, default: None\n        The axis to plot the figure on. If None is passed in the current axes\n        will be used (or generated if required).\n\n    features : list, default: None\n        a list of feature names to use\n        If a DataFrame is passed to fit and features is None, feature\n        names are selected as the columns of the DataFrame.\n\n    classes : list, default: None\n        a list of class names for the legend\n        If classes is None and a y value is passed to fit then the classes\n        are selected from the target vector.\n\n    color : list or tuple, default: None\n        optional list or tuple of colors to colorize lines\n        Use either color to colorize the lines on a per class basis or\n        colormap to color them on a continuous scale.\n\n    colormap : string or cmap, default: None\n        optional string or matplotlib cmap to colorize lines\n        Use either color to colorize the lines on a per class basis or\n        colormap to color them on a continuous scale.\n\n    kwargs : dict\n        Keyword arguments that are passed to the base class and may influence\n        the visualization as defined in other Visualizers.\n\n    Examples\n    --------\n\n    >>> visualizer = RadViz()\n    >>> visualizer.fit(X, y)\n    >>> visualizer.transform(X)\n    >>> visualizer.poof()\n\n    Notes\n    -----\n    These parameters can be influenced later on in the visualization\n    process, but can and should be set as early as possible.\n    \"\"\"\n\n    def __init__(self, ax=None, features=None, classes=None, color=None,\n                 colormap=None, **kwargs):\n        super(RadialVisualizer, self).__init__(\n            ax, features, classes, color, colormap, **kwargs\n        )\n\n    @staticmethod\n    def normalize(X):\n        \"\"\"\n        MinMax normalization to fit a matrix in the space [0,1] by column.\n        \"\"\"\n        a = X.min(axis=0)\n        b = X.max(axis=0)\n        return (X - a[np.newaxis, :]) / ((b - a)[np.newaxis, :])\n\n    def draw(self, X, y, **kwargs):\n        \"\"\"\n        Called from the fit method, this method creates the radviz canvas and\n        draws each instance as a class or target colored point, whose location\n        is determined by the feature data set.\n        \"\"\"\n        # Convert from dataframe\n        if is_dataframe(X):\n            X = X.as_matrix()\n\n        # Clean out nans and warn that the user they aren't plotted\n        nan_warnings.warn_if_nans_exist(X)\n        X, y = nan_warnings.filter_missing(X, y)\n\n        # Get the shape of the data\n        nrows, ncols = X.shape\n\n        # Set the axes limits\n        self.ax.set_xlim([-1,1])\n        self.ax.set_ylim([-1,1])\n\n        # Create the colors\n        # TODO: Allow both colormap, listed colors, and palette definition\n        # TODO: Make this an independent function or property for override!\n        color_values = resolve_colors(\n            n_colors=len(self.classes_), colormap=self.colormap, colors=self.color\n        )\n        colors = dict(zip(self.classes_, color_values))\n\n        # Create a data structure to hold scatter plot representations\n        to_plot = {}\n        for kls in self.classes_:\n            to_plot[kls] = [[], []]\n\n        # Compute the arcs around the circumference for each feature axis\n        # TODO: make this an independent function for override\n        s = np.array([\n                (np.cos(t), np.sin(t))\n                for t in [\n                    2.0 * np.pi * (i / float(ncols))\n                    for i in range(ncols)\n                ]\n            ])\n\n        # Compute the locations of the scatter plot for each class\n        # Normalize the data first to plot along the 0, 1 axis\n        for i, row in enumerate(self.normalize(X)):\n            row_ = np.repeat(np.expand_dims(row, axis=1), 2, axis=1)\n            xy   = (s * row_).sum(axis=0) / row.sum()\n            kls = self.classes_[y[i]]\n\n            to_plot[kls][0].append(xy[0])\n            to_plot[kls][1].append(xy[1])\n\n        # Add the scatter plots from the to_plot function\n        # TODO: store these plots to add more instances to later\n        # TODO: make this a separate function\n        for i, kls in enumerate(self.classes_):\n            self.ax.scatter(to_plot[kls][0], to_plot[kls][1], color=colors[kls], label=str(kls), **kwargs)\n\n        # Add the circular axis path\n        # TODO: Make this a seperate function (along with labeling)\n        self.ax.add_patch(patches.Circle((0.0, 0.0), radius=1.0, facecolor='none', edgecolor='grey', linewidth=.5 ))\n\n        # Add the feature names\n        for xy, name in zip(s, self.features_):\n            # Add the patch indicating the location of the axis\n            self.ax.add_patch(patches.Circle(xy, radius=0.025, facecolor='#777777'))\n\n            # Add the feature names offset around the axis marker\n            if xy[0] < 0.0 and xy[1] < 0.0:\n                self.ax.text(xy[0] - 0.025, xy[1] - 0.025, name, ha='right', va='top', size='small')\n            elif xy[0] < 0.0 and xy[1] >= 0.0:\n                self.ax.text(xy[0] - 0.025, xy[1] + 0.025, name, ha='right', va='bottom', size='small')\n            elif xy[0] >= 0.0 and xy[1] < 0.0:\n                self.ax.text(xy[0] + 0.025, xy[1] - 0.025, name, ha='left', va='top', size='small')\n            elif xy[0] >= 0.0 and xy[1] >= 0.0:\n                self.ax.text(xy[0] + 0.025, xy[1] + 0.025, name, ha='left', va='bottom', size='small')\n\n        self.ax.axis('equal')\n\n    def finalize(self, **kwargs):\n        \"\"\"\n        Finalize executes any subclass-specific axes finalization steps.\n        The user calls poof and poof calls finalize.\n\n        Parameters\n        ----------\n        kwargs: generic keyword arguments.\n\n        \"\"\"\n        # Set the title\n        self.set_title(\n            'RadViz for {} Features'.format(len(self.features_))\n        )\n\n        # Remove the ticks from the graph\n        self.ax.set_yticks([])\n        self.ax.set_xticks([])\n\n        # Add the legend\n        self.ax.legend(loc='best')\n\n\n# Alias for RadViz\nRadViz = RadialVisualizer\n", "path": "yellowbrick/features/radviz.py"}], "after_files": [{"content": "# yellowbrick.features.radviz\n# Implements radviz for feature analysis.\n#\n# Author:   Benjamin Bengfort <bbengfort@districtdatalabs.com>\n# Created:  Fri Oct 07 13:18:00 2016 -0400\n#\n# Copyright (C) 2016 District Data Labs\n# For license information, see LICENSE.txt\n#\n# ID: radviz.py [0f4b236] benjamin@bengfort.com $\n\n\"\"\"\nImplements radviz for feature analysis.\n\"\"\"\n\n##########################################################################\n## Imports\n##########################################################################\n\nimport numpy as np\nimport matplotlib.patches as patches\n\nfrom yellowbrick.utils import is_dataframe\nfrom yellowbrick.features.base import DataVisualizer\nimport yellowbrick.utils.nan_warnings as nan_warnings\nfrom yellowbrick.style.colors import resolve_colors\n\n\n##########################################################################\n## Quick Methods\n##########################################################################\n\ndef radviz(X, y=None, ax=None, features=None, classes=None,\n           color=None, colormap=None, **kwargs):\n    \"\"\"\n    Displays each feature as an axis around a circle surrounding a scatter\n    plot whose points are each individual instance.\n\n    This helper function is a quick wrapper to utilize the RadialVisualizer\n    (Transformer) for one-off analysis.\n\n    Parameters\n    ----------\n\n    X : ndarray or DataFrame of shape n x m\n        A matrix of n instances with m features\n\n    y : ndarray or Series of length n\n        An array or series of target or class values\n\n    ax : matplotlib Axes, default: None\n        The axes to plot the figure on.\n\n    features : list of strings, default: None\n        The names of the features or columns\n\n    classes : list of strings, default: None\n        The names of the classes in the target\n\n    color : list or tuple of colors, default: None\n        Specify the colors for each individual class\n\n    colormap : string or matplotlib cmap, default: None\n        Sequential colormap for continuous target\n\n    Returns\n    -------\n    ax : matplotlib axes\n        Returns the axes that the parallel coordinates were drawn on.\n    \"\"\"\n    # Instantiate the visualizer\n    visualizer = RadialVisualizer(\n        ax, features, classes, color, colormap, **kwargs\n    )\n\n    # Fit and transform the visualizer (calls draw)\n    visualizer.fit(X, y, **kwargs)\n    visualizer.transform(X)\n\n    # Return the axes object on the visualizer\n    return visualizer.ax\n\n\n##########################################################################\n## Static RadViz Visualizer\n##########################################################################\n\nclass RadialVisualizer(DataVisualizer):\n    \"\"\"\n    RadViz is a multivariate data visualization algorithm that plots each\n    axis uniformely around the circumference of a circle then plots points on\n    the interior of the circle such that the point normalizes its values on\n    the axes from the center to each arc.\n\n    Parameters\n    ----------\n\n    ax : matplotlib Axes, default: None\n        The axis to plot the figure on. If None is passed in the current axes\n        will be used (or generated if required).\n\n    features : list, default: None\n        a list of feature names to use\n        If a DataFrame is passed to fit and features is None, feature\n        names are selected as the columns of the DataFrame.\n\n    classes : list, default: None\n        a list of class names for the legend\n        If classes is None and a y value is passed to fit then the classes\n        are selected from the target vector.\n\n    color : list or tuple, default: None\n        optional list or tuple of colors to colorize lines\n        Use either color to colorize the lines on a per class basis or\n        colormap to color them on a continuous scale.\n\n    colormap : string or cmap, default: None\n        optional string or matplotlib cmap to colorize lines\n        Use either color to colorize the lines on a per class basis or\n        colormap to color them on a continuous scale.\n\n    kwargs : dict\n        Keyword arguments that are passed to the base class and may influence\n        the visualization as defined in other Visualizers.\n\n    Examples\n    --------\n\n    >>> visualizer = RadViz()\n    >>> visualizer.fit(X, y)\n    >>> visualizer.transform(X)\n    >>> visualizer.poof()\n\n    Notes\n    -----\n    These parameters can be influenced later on in the visualization\n    process, but can and should be set as early as possible.\n    \"\"\"\n\n    def __init__(self, ax=None, features=None, classes=None, color=None,\n                 colormap=None, alpha=1, **kwargs):\n        super(RadialVisualizer, self).__init__(\n            ax, features, classes, color, colormap, **kwargs\n        )\n        self.alpha = alpha\n\n    @staticmethod\n    def normalize(X):\n        \"\"\"\n        MinMax normalization to fit a matrix in the space [0,1] by column.\n        \"\"\"\n        a = X.min(axis=0)\n        b = X.max(axis=0)\n        return (X - a[np.newaxis, :]) / ((b - a)[np.newaxis, :])\n\n    def draw(self, X, y, **kwargs):\n        \"\"\"\n        Called from the fit method, this method creates the radviz canvas and\n        draws each instance as a class or target colored point, whose location\n        is determined by the feature data set.\n        \"\"\"\n        # Convert from dataframe\n        if is_dataframe(X):\n            X = X.as_matrix()\n\n        # Clean out nans and warn that the user they aren't plotted\n        nan_warnings.warn_if_nans_exist(X)\n        X, y = nan_warnings.filter_missing(X, y)\n\n        # Get the shape of the data\n        nrows, ncols = X.shape\n\n        # Set the axes limits\n        self.ax.set_xlim([-1,1])\n        self.ax.set_ylim([-1,1])\n\n        # Create the colors\n        # TODO: Allow both colormap, listed colors, and palette definition\n        # TODO: Make this an independent function or property for override!\n        color_values = resolve_colors(\n            n_colors=len(self.classes_), colormap=self.colormap, colors=self.color\n        )\n        colors = dict(zip(self.classes_, color_values))\n\n        # Create a data structure to hold scatter plot representations\n        to_plot = {}\n        for kls in self.classes_:\n            to_plot[kls] = [[], []]\n\n        # Compute the arcs around the circumference for each feature axis\n        # TODO: make this an independent function for override\n        s = np.array([\n                (np.cos(t), np.sin(t))\n                for t in [\n                    2.0 * np.pi * (i / float(ncols))\n                    for i in range(ncols)\n                ]\n            ])\n\n        # Compute the locations of the scatter plot for each class\n        # Normalize the data first to plot along the 0, 1 axis\n        for i, row in enumerate(self.normalize(X)):\n            row_ = np.repeat(np.expand_dims(row, axis=1), 2, axis=1)\n            xy   = (s * row_).sum(axis=0) / row.sum()\n            kls = self.classes_[y[i]]\n\n            to_plot[kls][0].append(xy[0])\n            to_plot[kls][1].append(xy[1])\n\n        # Add the scatter plots from the to_plot function\n        # TODO: store these plots to add more instances to later\n        # TODO: make this a separate function\n        for i, kls in enumerate(self.classes_):\n            self.ax.scatter(to_plot[kls][0], to_plot[kls][1], color=colors[kls], label=str(kls), alpha=self.alpha, **kwargs)\n\n        # Add the circular axis path\n        # TODO: Make this a seperate function (along with labeling)\n        self.ax.add_patch(patches.Circle((0.0, 0.0), radius=1.0, facecolor='none', edgecolor='grey', linewidth=.5 ))\n\n        # Add the feature names\n        for xy, name in zip(s, self.features_):\n            # Add the patch indicating the location of the axis\n            self.ax.add_patch(patches.Circle(xy, radius=0.025, facecolor='#777777'))\n\n            # Add the feature names offset around the axis marker\n            if xy[0] < 0.0 and xy[1] < 0.0:\n                self.ax.text(xy[0] - 0.025, xy[1] - 0.025, name, ha='right', va='top', size='small')\n            elif xy[0] < 0.0 and xy[1] >= 0.0:\n                self.ax.text(xy[0] - 0.025, xy[1] + 0.025, name, ha='right', va='bottom', size='small')\n            elif xy[0] >= 0.0 and xy[1] < 0.0:\n                self.ax.text(xy[0] + 0.025, xy[1] - 0.025, name, ha='left', va='top', size='small')\n            elif xy[0] >= 0.0 and xy[1] >= 0.0:\n                self.ax.text(xy[0] + 0.025, xy[1] + 0.025, name, ha='left', va='bottom', size='small')\n\n        self.ax.axis('equal')\n\n    def finalize(self, **kwargs):\n        \"\"\"\n        Finalize executes any subclass-specific axes finalization steps.\n        The user calls poof and poof calls finalize.\n\n        Parameters\n        ----------\n        kwargs: generic keyword arguments.\n\n        \"\"\"\n        # Set the title\n        self.set_title(\n            'RadViz for {} Features'.format(len(self.features_))\n        )\n\n        # Remove the ticks from the graph\n        self.ax.set_yticks([])\n        self.ax.set_xticks([])\n\n        # Add the legend\n        self.ax.legend(loc='best')\n\n\n# Alias for RadViz\nRadViz = RadialVisualizer\n", "path": "yellowbrick/features/radviz.py"}]}