<jupyter_start><jupyter_text>This blog post was written in a Jupyter Notebook> And then converted to markdown... and then converted to html using Jeckyl.- toc: false - badges: true- comments: true- image: images/copied_from_nb/my_icons/wave.png- categories: [jupyter, blogging, visualisation] > Why should I care? I think it's kind of cool that you can write text beside snippets of code that _actually run_ and automatically have the output of your code display alongside it.  A quick example: Say I want to describe a function that plots a sine wave at different amplitudes.  First, I would define the function<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

def plot_sin(amplitude=1):
    '''Plot a sine wave of a given amplitude'''
    time = np.arange(0, 10, 0.1)
    y = np.sin(time)
    plt.plot(time, amplitude*y)
    plt.ylabel('Amplitude')
    plt.xlabel('Time (s)')
    plt.show()<jupyter_output><empty_output><jupyter_text>Then, just after defining it, I could call it with different arguments and display the outputs alongside any text.  Sine wave with the default amplitude of 1<jupyter_code>plot_sin()<jupyter_output><empty_output><jupyter_text>Sine wave with an amplitude of 20<jupyter_code>plot_sin(amplitude=20)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08307210031347963, 'fraction_numerical': 0.008620689655172414, 'mean_word_length': 5.052132701421801, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '284737', 'license': 'Apache-2.0', 'n_tokens_mistral': 413, 'n_tokens_neox': 394, 'n_words': 151, 'path': '_notebooks/2020-01-20-this-blog-post-was-written-in-a-jupyter-notebooks.ipynb', 'repo_name': 'howtodowtle/fastpages', 'size': '1276'}