git init
or
| """ Shows how to use flask and matplotlib together. | |
| Shows SVG, and png. | |
| The SVG is easier to style with CSS, and hook JS events to in browser. | |
| python3 -m venv venv | |
| . ./venv/bin/activate | |
| pip install flask matplotlib | |
| python flask_matplotlib.py | |
| """ |
| ## code to reproduce Figure 2.5 on page 30 of Statistical Rethinking | |
| library(rethinking) | |
| col1 <- "black" | |
| col2 <- col.alpha( "black" , 0.7 ) | |
| # show posterior as data comes in | |
| # 1 indicates 'water'; 0 indicates 'land' | |
| d <- c(1,0,1,1,1,0,1,0,1) # length 9 |
| # functions for plotting garden of forking data plots | |
| library(rethinking) | |
| polar2screen <- function( dist, origin, theta ) { | |
| ## takes dist, angle and origin and returns x and y of destination point | |
| vx <- cos(theta) * dist; | |
| vy <- sin(theta) * dist; | |
| c( origin[1]+vx , origin[2]+vy ); | |
| } |
| #!/usr/bin/env python3 | |
| # coding: utf-8 | |
| import matplotlib | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| import squarify | |
| import platform | |
| # print versions |
| # Example animations using matplotlib's FuncAnimation | |
| # Ken Hughes. 18 June 2016. | |
| # For more detail, see | |
| # https://brushingupscience.wordpress.com/2016/06/21/matplotlib-animations-the-easy-way/ | |
| # Examples include | |
| # - line plot | |
| # - pcolor plot | |
| # - scatter plot |
| #!/usr/bin/python | |
| import os, zipfile | |
| for filename in os.listdir("."): | |
| if filename.endswith(".zip"): | |
| print filename | |
| name = os.path.splitext(os.path.basename(filename))[0] | |
| if not os.path.isdir(name): | |
| try: | |
| zip = zipfile.ZipFile(filename) |