An alteration to http://bl.ocks.org/mbostock/1667367 that adds a similar vertical zoom axes to the figure.
To get use MongoDB from Tableau, start a mongosqld instance...
mongosqld --mongo-uri "mongodb://<host>:<port>/?connect=direct"
Then from Tableau, select Servers->MongoDB BI Connector with 127.0.0.1 and 3307 as connection details.
Implements constrained zooming of an image put onto an HTML5 Canvas.
This creates a normalized mass density histogram in matplotlib
bins = np.linspace(-1, 1, 101)
# To get a normalized mass density histogram, we have to do it this way...
hist, bins = np.histogram(df['some_column'], bins=bins, density=True)
hist /= len(bins)
width = bins[1]-bins[0]
fig = plt.figure(figsize=(8, 4))
ax = fig.add_axes([.15, .15, .75, .75])
plt.bar(left=bins[:-1], height=hist, width=width)
def columns_via_merge(df: pd.DataFrame, df2: pd.DataFrame, oncols: list, assigning: list): | |
""" | |
Add (or replace) columns to df that map via a merge with df2. | |
Examples: | |
# Add the ord value to a subset of a DataFrame | |
ABC = [chr(x) for x in range(ord('A'), ord('Z') + 1)] | |
AABBCC = [chr(x)+chr(x) for x in range(ord('A'), ord('Z') + 1)] | |
abc = [chr(x) for x in range(ord('a'), ord('z') + 1)] |
This is a recipe for using Sklearn to build a cosine similarity matrix and then to build dendrograms from it.
import numpy as np
import matplotlib.pyplot as plt
import scipy.cluster.hierarchy
import scipy.spatial.distance
from scipy.spatial.distance import pdist
from sklearn.metrics.pairwise import cosine_similarity
This D3 example demonstrates using the zoom event and limits the bounds of the zooming to a specified domain. It is largely based on http://bl.ocks.org/jasondavies/3689931, but with bounds. Most of this bounding is done in the refresh function. You need to zoom in before you can pan or zoom out.
This D3 example demonstrates constrained zooming, much like http://bl.ocks.org/tommct/5671250, but also illustrates the use of hierarchical ordinal tick marks. It does this by using the normalized values that one gets when using a hierarchical partition layout.
Implements constrained zooming of an image constructed from a data-driven ImageData object placed onto an HTML5 Canvas while giving the marginal distributions of the underlying data. Borrows heavily from https://gist.github.com/mbostock/3074470 and https://gist.github.com/tommct/8049508.