In ggplot for Python, using discrete X scale with geom_point()?
<p>The following example returns an error. It appears that using a discrete (not continuous) scale for the x-axis in ggplot in Python is not supported? </p>

<pre><code>import pandas as pd
import ggplot

df = pd.DataFrame.from_dict({'a':['a','b','c'],
                   'percentage':[.1,.2,.3]})

p = ggplot.ggplot(data=df,
                  aesthetics=ggplot.aes(x='a',
                                        y='percentage'))\
    + ggplot.geom_point()

print(p)
</code></pre>

<p>As mentioned, this returns: </p>

<pre><code>Traceback (most recent call last):
  File "/Users/me/Library/Preferences/PyCharm2016.1/scratches/scratch_1.py", line 30, in &lt;module&gt;
    print(p)
  File "/Users/me/lib/python3.5/site-packages/ggplot/ggplot.py", line 116, in __repr__
    self.make()
  File "/Users/me/lib/python3.5/site-packages/ggplot/ggplot.py", line 627, in make
    layer.plot(ax, facetgroup, self._aes, **kwargs)
  File "/Users/me/lib/python3.5/site-packages/ggplot/geoms/geom_point.py", line 60, in plot
    ax.scatter(x, y, **params)
  File "/Users/me/lib/python3.5/site-packages/matplotlib/__init__.py", line 1819, in inner
    return func(ax, *args, **kwargs)
  File "/Users/me/lib/python3.5/site-packages/matplotlib/axes/_axes.py", line 3838, in scatter
    x, y, s, c = cbook.delete_masked_points(x, y, s, c)
  File "/Users/me/lib/python3.5/site-packages/matplotlib/cbook.py", line 1848, in delete_masked_points
    raise ValueError("First argument must be a sequence")
ValueError: First argument must be a sequence
</code></pre>

<p>Any workarounds for using <code>ggplot</code> with scatters on a discrete scale? </p>

<p>One option is to generate a continuous series, and use the original variable as labels. But this seems like a painful workaround. </p>

<pre><code>df = pd.DataFrame.from_dict( {'a':[0,1,2],
                   'a_name':['a','b','c'],
                   'percentage':[.1,.2,.3]})

p = ggplot.ggplot(data=df,
                  aesthetics=ggplot.aes(x='a',
                                        y='percentage'))\
    + ggplot.geom_point()\
    + ggplot.scale_x_continuous(breaks=list(df['a']),
                              labels=list(df['a_name']))
</code></pre>

python matplotlib ggplot2 scatter python-ggplot