This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Object-oriented API | |
# | |
# Memory usage (iteration, object count, memory size) | |
# 100 5637 1562216 | |
# 200 5529 1491528 | |
# 300 5422 1426264 | |
# 400 5758 1587376 | |
# 500 5422 1426288 | |
# 600 5416 1440456 | |
# 700 5610 1515056 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# The MIT License (MIT) | |
# | |
# Copyright (c) 2015 Steven Fernandez | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# push | |
push <- function(x, values) (assign(as.character(substitute(x)), c(x, values), parent.frame())) | |
# pop | |
pop <- function(x) (assign(as.character(substitute(x)), x[-length(x)], parent.frame())) | |
# example | |
z <- 1:3 | |
push(z, 4) | |
z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Plot multiple figures into a single PDF with matplotlib, using the | |
object-oriented interface. | |
""" | |
from matplotlib.backends.backend_pdf import FigureCanvasPdf, PdfPages | |
from matplotlib.figure import Figure | |
import numpy as np | |
with PdfPages('multi.pdf') as pages: | |
for i in range(10): |