In python, create your figure and save it as .eps
. This will generate a vector image of your figure:
fig, ax = plt.subplots()
ax.plot(range(10))
fig.savefig('straightLine.eps', format='eps')
def plot_correlogram(df,figsize=(20,20)): | |
''' Creat an n x n matrix of scatter plots for every | |
combination of numeric columns in a dataframe''' | |
cols = list(df.columns[df.dtypes=='float64']) | |
n = len(cols) | |
fig, ax = plt.subplots(n,n,figsize=figsize) | |
for i,y in enumerate(cols): | |
for j,x in enumerate(cols): | |
if i != n-1: |
################## Plot training skies ################### | |
## | |
## corey.chivers@mail.mcgill.ca | |
## | |
########################################################## | |
## calculate a vector given | |
## x,y,e1,e2 | |
gal_line<-function(g,scale=100) | |
{ |
## Simulate Grime Dice ## | |
red<-c(4,4,4,4,4,9) | |
blue<-c(2,2,2,7,7,7) | |
olive<-c(0,5,5,5,5,5) | |
yellow<-c(3,3,3,3,8,8) | |
magenta<-c(1,1,6,6,6,6) | |
## Play n match-ups between d1 and d2 |
## Functions for simulating Conway's Game of Life | |
## Modified from http://www.petrkeil.com/?p=236 | |
neighbour_count <- function(X) | |
{ | |
side <- nrow(X) | |
# make the shifted copies of the original array | |
allW = cbind( rep(0,side) , X[,-side] ) | |
allNW = rbind(rep(0,side),cbind(rep(0,side-1),X[-side,-side])) | |
allN = rbind(rep(0,side),X[-side,]) |
#!/usr/bin/python | |
""" | |
Parse BMC OA articles from XML to utf-8 text of the title, abstract, and body. | |
""" | |
import libxml2 | |
from os import listdir | |
from time import gmtime, strftime | |
input_dir = './BMC_FTP/content/articles/' | |
files = listdir(input_dir) |
## Warren Buffet's 1B Basketball Challenge ## | |
expected_value <- function(p,ngames=63,prize=1000000000){ | |
p^ngames * prize | |
} | |
## What is the expected value of an entry | |
## given a particular level of prediction accuracy | |
expected_value(p=0.80) | |
expected_value(p=0.85) |
################################################### | |
## | |
## Functions for calculating AUC and plotting ROC | |
## Corey Chivers, 2013 | |
## corey.chivers@mail.mcgill.ca | |
## | |
################################################### | |
## Descrete integration for AUC calc |
def Weierstrass(x, reps=10): | |
res = np.zeros(x.shape[0]) | |
for i in range(reps): | |
num = x*(3**i)*np.pi | |
denom = 2.0**i | |
res = res + np.cos(num)/denom | |
return res | |
title = '$f(x) = {cos(3x\pi)}/{2} + {cos(3^2x\pi)}/{2^2} + {cos(3^3x\pi)}/{2^3} ...$' | |
delta = 0.5 |