In [5]:
from modules import *
import tools

In [80]:
pd.DataFrame(X).to_csv('cgn_data.csv', index = False, header = False)

In [78]:
X = tools.generateRandomClusters(n=500, seperation = 10, uniformity = 1, gridSize=3, randomness=2.5)
plt.scatter(pd.DataFrame(X)[0], pd.DataFrame(X)[1])


Out[78]:
<matplotlib.collections.PathCollection at 0x278b9518>

In [74]:
plt.scatter(pd.DataFrame(X)[0], pd.DataFrame(X)[1])


Out[74]:
<matplotlib.collections.PathCollection at 0x270e9630>

In [11]:
plt.scatter(X[0], X[1])


Out[11]:
<matplotlib.collections.PathCollection at 0x1fd431d0>

In [7]:
tools.prettyplotdf(pd.DataFrame(X), 'Curtis', 'Nicasia', 'hello world', s=100)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-3d47e557e182> in <module>()
----> 1 tools.prettyplotdf(pd.DataFrame(X), 'Curtis', 'Nicasia', 'hello world', s=100)

E:\Dropbox (MIT)\cgn\cgntools\tools.py in prettyplotdf(df, title, xlabel, ylabel, kind, figsize, legend, linewidth, c, s, cmap)
    378         x will be first column, y will be next column
    379     '''
--> 380     ax = df.plot(x = df.columns[0], y = df.columns[1], kind = kind, figsize = figsize, legend = legend, linewidth = linewidth, c = c, title = title, s = s, cmap=cmap)
    381     ax.set_xlabel(xlabel)
    382     ax.set_ylabel(ylabel)

C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in __call__(self, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
   3669                           fontsize=fontsize, colormap=colormap, table=table,
   3670                           yerr=yerr, xerr=xerr, secondary_y=secondary_y,
-> 3671                           sort_columns=sort_columns, **kwds)
   3672     __call__.__doc__ = plot_frame.__doc__
   3673 

C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in plot_frame(data, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
   2554                  yerr=yerr, xerr=xerr,
   2555                  secondary_y=secondary_y, sort_columns=sort_columns,
-> 2556                  **kwds)
   2557 
   2558 

C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in _plot(data, x, y, subplots, ax, kind, **kwds)
   2382         plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, **kwds)
   2383 
-> 2384     plot_obj.generate()
   2385     plot_obj.draw()
   2386     return plot_obj.result

C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in generate(self)
    985         self._compute_plot_data()
    986         self._setup_subplots()
--> 987         self._make_plot()
    988         self._add_table()
    989         self._make_legend()

C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in _make_plot(self)
   1563             if self.mpl_ge_1_3_1():
   1564                 kws['label'] = c if c_is_column else ''
-> 1565             self.fig.colorbar(img, **kws)
   1566 
   1567         if label is not None:

C:\Anaconda2\lib\site-packages\matplotlib\figure.pyc in colorbar(self, mappable, cax, ax, use_gridspec, **kw)
   1567                 cax, kw = cbar.make_axes(ax, **kw)
   1568         cax.hold(True)
-> 1569         cb = cbar.colorbar_factory(cax, mappable, **kw)
   1570 
   1571         self.sca(current_ax)

C:\Anaconda2\lib\site-packages\matplotlib\colorbar.pyc in colorbar_factory(cax, mappable, **kwargs)
   1328         cb = ColorbarPatch(cax, mappable, **kwargs)
   1329     else:
-> 1330         cb = Colorbar(cax, mappable, **kwargs)
   1331 
   1332     cid = mappable.callbacksSM.connect('changed', cb.on_mappable_changed)

C:\Anaconda2\lib\site-packages\matplotlib\colorbar.pyc in __init__(self, ax, mappable, **kw)
    878         # Ensure the given mappable's norm has appropriate vmin and vmax set
    879         # even if mappable.draw has not yet been called.
--> 880         mappable.autoscale_None()
    881 
    882         self.mappable = mappable

C:\Anaconda2\lib\site-packages\matplotlib\cm.pyc in autoscale_None(self)
    331         """
    332         if self._A is None:
--> 333             raise TypeError('You must first set_array for mappable')
    334         self.norm.autoscale_None(self._A)
    335         self.changed()

TypeError: You must first set_array for mappable

In [4]:
matplotlib.rc('font', **tools.getfont())

tools.figexamplemultiscatter(niter = 2000, dof = [1,3,5,7,9,50,100,200])



In [2]:
tools.countrymap('United States')


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-30b439a54685> in <module>()
----> 1 tools.countrymap('United States')

/Users/cgn/git/cgn/tools.py in countrymap(country)
    383 
    384 def countrymap(country = None):
--> 385     cmap = buildcountrymap()
    386     if country == None:
    387         return cmap

/Users/cgn/git/cgn/tools.py in buildcountrymap()
    447     locmap['Palestinian Territory, Occupied'] = locmap['Palestine']
    448     locmap['Congo, the Democratic Republic of the'] = locmap['Congo']
--> 449     locmap['Cote D\'Ivoire'] = locmap['Cote d\'Ivoire']
    450     locmap['Virgin Islands, U.s.'] = locmap['Virgin Islands, U.S.']
    451     return locmap

KeyError: "Cote d'Ivoire"

In [7]:
tools.prettyhistpercent(pd.Series(np.arange(.01,1,.01)**2))



In [ ]: