{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib widget" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "output_type": "display_data", "data": { "text/plain": "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …", "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "624a1a7c0d9e4354af936e071f4c0314" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …", "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "624a1a7c0d9e4354af936e071f4c0314" } }, "metadata": {} } ], "source": [ "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from math import cos, pi\n", "mpl.rc('text', usetex = True)\n", "mpl.rc('font', family = 'serif')\n", "plt.figure(1, figsize = (6, 4))\n", "ax = plt.axes([0.1, 0.1, 0.8, 0.7])\n", "t = np.arange(0.0, 1.0+0.01, 0.01)\n", "s = np.cos(2*2*pi*t)+2\n", "plt.plot(t, s)\n", "\n", "plt.xlabel(r'\\textbf{time (s)}')\n", "plt.ylabel(r'\\textit{voltage (mV)}', fontsize = 16)\n", "plt.title(r\"\\TeX\\ is Number $\\displaystyle\\sum_{n=1}^\\infty\\frac{-e^{i\\pi}}{2^n}$!\",\n", " fontsize = 16, color = 'r')\n", "plt.grid(True)\n", "plt.gcf().canvas" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.8" } }, "nbformat": 4, "nbformat_minor": 4 }