• Title: Notebook with Metacell
• Slug: with-metacell
• Date: 2100-12-31
• Tags: Test
• Author: Daniel Rodriguez- Status: Draft

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur purus mi, sollicitudin ac justo a, dapibus ultrices dolor. Curabitur id eros mattis, tincidunt ligula at, condimentum urna. Morbi accumsan, risus eget porta consequat, tortor nibh blandit dui, in sodales quam elit non erat. Aenean lorem dui, lacinia a metus eu, accumsan dictum urna. Sed a egestas mauris, non porta nisi. Suspendisse eu lacinia neque. Morbi gravida eros non augue pharetra, condimentum auctor purus porttitor.



In [1]:

a = 1




In [2]:

a




Out[2]:

1




In [3]:

b = 'pew'




In [4]:

b




Out[4]:

'pew'




In [5]:

%matplotlib inline




In [6]:

import matplotlib.pyplot as plt




In [7]:

from pylab import *




In [8]:

x = linspace(0, 5, 10)
y = x ** 2




In [9]:

figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()







In [10]:

import numpy as np




In [11]:

num_points = 130
y = np.random.random(num_points)
plt.plot(y)




Out[11]:

[<matplotlib.lines.Line2D at 0x1084b2050>]



This is some text, here comes some latex



In [12]:

%%latex
\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}




\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}



Apos?



In [1]:

import re




In [2]:

text = 'foo bar\t baz \tqux'




In [3]:

re.split('\s+', text)




Out[3]:

['foo', 'bar', 'baz', 'qux']



Javascript plots

plotly



In [1]:

from plotly import __version__
from plotly.graph_objs import Scatter, Figure, Layout




In [3]:

init_notebook_mode(connected=True)




requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window.Plotly) {{require(['plotly'],function(plotly) {window.Plotly=plotly;});}}




In [4]:

iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}])




require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("01a2f515-51a3-43fd-b4f1-e6c4678f2875", [{"x": [1, 2, 3], "y": [3, 1, 6]}], {}, {"showLink": true, "linkText": "Export to plot.ly"})});



bokeh



In [5]:

from bokeh.plotting import figure, output_notebook, show




In [6]:

output_notebook()




var element = $('#22f4fc68-b82e-4131-a897-e592560ab6c4'); (function(global) { function now() { return new Date(); } var force = true; if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) { window._bokeh_onload_callbacks = []; window._bokeh_is_loading = undefined; } if (typeof (window._bokeh_timeout) === "undefined" || force === true) { window._bokeh_timeout = Date.now() + 5000; window._bokeh_failed_load = false; } var NB_LOAD_WARNING = {'data': {'text/html': "<div style='background-color: #fdd'>\n"+ "<p>\n"+ "BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+ "may be due to a slow or bad network connection. Possible fixes:\n"+ "</p>\n"+ "<ul>\n"+ "<li>re-rerun output_notebook() to attempt to load from CDN again, or</li>\n"+ "<li>use INLINE resources instead, as so:</li>\n"+ "</ul>\n"+ "<code>\n"+ "from bokeh.resources import INLINE\n"+ "output_notebook(resources=INLINE)\n"+ "</code>\n"+ "</div>"}}; function display_loaded() { if (window.Bokeh !== undefined) { var el = document.getElementById("2a5c1741-9b87-4ff4-90fb-5b10553324b5"); el.textContent = "BokehJS " + Bokeh.version + " successfully loaded."; } else if (Date.now() < window._bokeh_timeout) { setTimeout(display_loaded, 100) } } function run_callbacks() { try { window._bokeh_onload_callbacks.forEach(function(callback) { callback() }); } finally { delete window._bokeh_onload_callbacks } console.info("Bokeh: all callbacks have finished"); } function load_libs(js_urls, callback) { window._bokeh_onload_callbacks.push(callback); if (window._bokeh_is_loading > 0) { console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now()); return null; } if (js_urls == null || js_urls.length === 0) { run_callbacks(); return null; } console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now()); window._bokeh_is_loading = js_urls.length; for (var i = 0; i < js_urls.length; i++) { var url = js_urls[i]; var s = document.createElement('script'); s.src = url; s.async = false; s.onreadystatechange = s.onload = function() { window._bokeh_is_loading--; if (window._bokeh_is_loading === 0) { console.log("Bokeh: all BokehJS libraries loaded"); run_callbacks() } }; s.onerror = function() { console.warn("failed to load library " + url); }; console.log("Bokeh: injecting script tag for BokehJS library: ", url); document.getElementsByTagName("head")[0].appendChild(s); } };var element = document.getElementById("2a5c1741-9b87-4ff4-90fb-5b10553324b5"); if (element == null) { console.log("Bokeh: ERROR: autoload.js configured with elementid '2a5c1741-9b87-4ff4-90fb-5b10553324b5' but no matching script tag was found. ") return false; } var js_urls = ["https://cdn.pydata.org/bokeh/release/bokeh-0.12.6.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.6.min.js"]; var inline_js = [ function(Bokeh) { Bokeh.set_log_level("info"); }, function(Bokeh) { }, function(Bokeh) { document.getElementById("2a5c1741-9b87-4ff4-90fb-5b10553324b5").textContent = "BokehJS is loading..."; }, function(Bokeh) { console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.6.min.css"); Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-0.12.6.min.css"); console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.6.min.css"); Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.6.min.css"); } ]; function run_inline_js() { if ((window.Bokeh !== undefined) || (force === true)) { for (var i = 0; i < inline_js.length; i++) { inline_js[i](window.Bokeh); }if (force === true) { display_loaded(); }} else if (Date.now() < window._bokeh_timeout) { setTimeout(run_inline_js, 100); } else if (!window._bokeh_failed_load) { console.log("Bokeh: BokehJS failed to load within specified timeout."); window._bokeh_failed_load = true; } else if (force !== true) { var cell =$(document.getElementById("2a5c1741-9b87-4ff4-90fb-5b10553324b5")).parents('.cell').data().cell;
}

}

console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));




In [7]:

p = figure()
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)
show(p)




(function(global) {
function now() {
return new Date();
}

var force = false;

if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
}

if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 0;
}

"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun output_notebook() to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};

if (window.Bokeh !== undefined) {
var el = document.getElementById("f75bf7a4-4ed4-4374-945e-954ed6f5f1e2");
el.textContent = "BokehJS " + Bokeh.version + " successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
}
}

function run_callbacks() {
try {
}
finally {
}
console.info("Bokeh: all callbacks have finished");
}

console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
}
};var element = document.getElementById("f75bf7a4-4ed4-4374-945e-954ed6f5f1e2");
if (element == null) {
console.log("Bokeh: ERROR: autoload.js configured with elementid 'f75bf7a4-4ed4-4374-945e-954ed6f5f1e2' but no matching script tag was found. ")
return false;
}

var js_urls = [];

var inline_js = [
function(Bokeh) {
(function() {
var fn = function() {
var render_items = [{"docid":"f0a5f080-638e-42dd-b76d-659ee815c9b9","elementid":"f75bf7a4-4ed4-4374-945e-954ed6f5f1e2","modelid":"f0b07a8f-ac83-4d82-b11c-7f367c360764"}];

Bokeh.embed.embed_items(docs_json, render_items);
};
})();
},
function(Bokeh) {
}
];

function run_inline_js() {

if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}if (force === true) {
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
console.log("Bokeh: BokehJS failed to load within specified timeout.");
} else if (force !== true) {
var cell = \$(document.getElementById("f75bf7a4-4ed4-4374-945e-954ed6f5f1e2")).parents('.cell').data().cell;
}

}

console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));




In [ ]: