This file contains hidden or 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
import numpy as np | |
import scipy.sparse | |
import scipy.ndimage | |
import scipy.stats | |
import scipy.signal | |
import matplotlib.pyplot as plt | |
def main(): | |
x, y = generate_data(int(1e7)) |
This file contains hidden or 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
import matplotlib.pyplot as plt | |
def main(): | |
resized = (8, 3) | |
basic_example() | |
basic_example(resized) | |
fixed_aspect() | |
fixed_aspect(resized) |
This file contains hidden or 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
import numpy as np | |
import pandas as pd | |
#-- Generate some data similar to yours | |
idx = np.arange(20) | |
np.random.shuffle(idx) | |
idx1 = idx[:15] | |
np.random.shuffle(idx) | |
idx2 = idx[:10] |
This file contains hidden or 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
import random | |
class BadIdea(object): | |
def __getattr__(self, key): | |
return random.randint(0, 1000) | |
def __setattr__(self, key, value): | |
pass | |
x = BadIdea() |
This file contains hidden or 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
import matplotlib.pyplot as plt | |
from matplotlib.mlab import csv2rec | |
from matplotlib.cbook import get_sample_data | |
#fname = get_sample_data('percent_bachelors_degrees_women_usa.csv') | |
fname = 'percent_bachelors_degrees_women_usa.csv' | |
gender_degree_data = csv2rec(fname) | |
# These are the colors that will be used in the plot |
This file contains hidden or 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
import random | |
import matplotlib.pyplot as plt | |
from mpldatacursor import datacursor | |
def main(): | |
accounts = generate_accounts() | |
lookup = plot(accounts) | |
datacursor(formatter=Formatter(lookup), bbox=dict(alpha=1)) | |
plt.show() |
This file contains hidden or 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
import random | |
import matplotlib.pyplot as plt | |
from mpldatacursor import datacursor | |
def main(): | |
accounts = generate_accounts() | |
plot(accounts) | |
datacursor(formatter='Account #\n{label}'.format, bbox=dict(alpha=1)) | |
plt.show() |
This file contains hidden or 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
import numpy as np | |
import matplotlib.pyplot as plt | |
x, y = np.random.normal(0, 1, (2, 1000)) | |
counts, ybins, xbins = np.histogram2d(y, x, bins=30) | |
counts = np.ma.masked_equal(counts, 0) | |
fig, ax = plt.subplots() | |
ax.pcolormesh(xbins, ybins, counts) |
This file contains hidden or 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
import numpy as np | |
import matplotlib.pyplot as plt | |
class DrawDragPoints(object): | |
""" | |
Demonstrates a basic example of the "scaffolding" you need to efficiently | |
blit drawable/draggable/deleteable artists on top of a background. | |
""" | |
def __init__(self): | |
self.fig, self.ax = self.setup_axes() |
This file contains hidden or 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
import matplotlib.pyplot as plt | |
from matplotlib.transforms import Affine2D | |
import mpl_toolkits.axisartist.floating_axes as floating_axes | |
fig = plt.figure() | |
plot_extents = 0, 10, 0, 10 | |
transform = Affine2D().rotate_deg(45) | |
helper = floating_axes.GridHelperCurveLinear(transform, plot_extents) | |
ax = floating_axes.FloatingSubplot(fig, 111, grid_helper=helper) |