Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cmrivers
cmrivers / gist:284ca2a7e1cfd64a95a7
Created January 20, 2016 14:23
A random collection of facts and some sketchy math re: zika
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A random collection of facts and some sketchy math."
]
},
{
#create string variable for Year
r['new_year'] = r.Year.astype('str')
#set colors for different plot type
colors1=sns.color_palette('husl', 8) #number represents how many things being plotted
#create plot in a different way so can enable markers specific to each MACOM
#can mess with the height and width using the figsize=
fig, ax = plt.subplots(figsize=(8, 4))
#Hah now you're getting down into the weeds. This bit of code should put in commas. If you want it to be the y axis, make sure to change the get_xaxis to get_yaxis
ax.get_xaxis().set_major_formatter(matplotlib.ticker.FuncFormatter(lambda x, p: format(int(x), ',')))
#and for colors, the seaborn color palette magic only works if you are using seaborn to plot. Since you're using matplotlib, which is lower level, you'll have to do it like this:
colors = sns.color_palette('husl', 5) #change 5 to however many thigns you are plotting
ax.plot(blah, blah, color=colors[0])
ax.plot(blah, blah, color=colors[1])
{
"metadata": {
"name": "",
"signature": "sha256:e84e57889637dd138adaa0222510c019330e34f0d641d61e0eda7eaf61a68bba"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@cmrivers
cmrivers / lesson_1
Created October 27, 2015 16:27
Lesson 1: Python for data analysis
{
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
{
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
{
"cells": [
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
@cmrivers
cmrivers / legends
Created April 5, 2015 21:50
How do I make fully custom legends?
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Question: how do I (elegeantly) add fully custom legends in matplotlib?"
]
},
{

CS

  • Make an app connecting volunteers to reputable organizations by skill set.
  • Make a directory of organizations accepting monetary donations. Tie in e.g. charity navigator scores.

Epi

  • Analyze county epi data in github.com/cmrivers/ebola (this is enough for several people). Post them online.