%%html
%%javascript require.config({paths: {d3: "http://d3js.org/d3.v3.min"}}); require(["d3"], function(d3) { var width = 600, height = 400; var color = d3.scale.category20(); var force = d3.layout.force() .charge(-120) .linkDistance(30) .size([width, height]); var svg = d3.select("#d3-example").append("svg") .attr("width", width) .attr("height", height); d3.json("data/miserables.json", function(error, graph) { force.nodes(graph.nodes) .links(graph.links) .start(); var link = svg.selectAll(".link") .data(graph.links) .enter().append("line") .attr("class", "link") .style("stroke-width", function(d) { return Math.sqrt(d.value); }); var node = svg.selectAll(".node") .data(graph.nodes) .enter().append("circle") .attr("class", "node") .attr("r", 5) .style("fill", function(d) { return color(d.group); }) .call(force.drag); node.append("title") .text(function(d) { return d.name; }); force.on("tick", function() { link.attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }); node.attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }); }); }); }); %matplotlib inline import numpy as np from matplotlib import pyplot as plt from mpld3 import enable_notebook, plugins enable_notebook() from sklearn.datasets import load_iris data = load_iris() X = data.data y = data.target # dither the data for clearer plotting X += 0.1 * np.random.random(X.shape) fig, ax = plt.subplots(4, 4, sharex="col", sharey="row", figsize=(8, 8)) fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95, hspace=0.1, wspace=0.1) for i in range(4): for j in range(4): ax[3 - i, j].scatter(X[:, j], X[:, i], c=y, s=40, alpha=0.3) # remove tick labels for axi in ax.flat: for axis in [axi.xaxis, axi.yaxis]: axis.set_major_formatter(plt.NullFormatter()) # add a reset() button plugins.connect(fig, plugins.ResetButton()) plt.show() import plotly py = plotly.plotly('IPython.Demo', '1fw3zw2o13') nr = np.random distributions = [nr.uniform, nr.normal , lambda size: nr.normal(0, 0.2, size=size), lambda size: nr.beta(a=0.5, b=0.5, size=size), lambda size: nr.beta(a=0.5, b=2, size=size)] names = ['Uniform(0,1)', 'Normal(0,1)', 'Normal(0, 0.2)', 'beta(a=0.5, b=0.5)', 'beta(a=0.5, b=2)'] boxes = [{'y': dist(size=50), 'type': 'box', 'boxpoints': 'all', 'jitter': 0.5, 'pointpos': -1.8, 'name': name} for dist, name in zip(distributions, names)] layout = {'title': 'A few distributions', 'showlegend': False, 'xaxis': {'ticks': '', 'showgrid': False, 'showline': False}, 'yaxis': {'zeroline': False, 'ticks': '', 'showline': False}, } py.iplot(boxes, layout = layout, filename='Distributions', fileopt='overwrite', width=1000, height=650)