{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Basic plot\n\nA basic plot using the `pyplot_interface`.\n\n- `~.pyplot.plot` plots the data y versus x as lines and/or markers.\n- `~.pyplot.title`, `~.pyplot.xlabel` and `~.pyplot.ylabel` set the title,\n x-axis label and y-axis label.\n- `~.pyplot.show` displays the plot.\n\n.. redirect-from:: /gallery/pyplots/fig_axes_labels_simple\n.. redirect-from:: /gallery/pyplots/pyplot_formatstr\n.. redirect-from:: /gallery/pyplots/pyplot_text\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\n\nx = np.arange(0.0, 2.0, 0.01)\ny = np.sin(2 * np.pi * x)\n\nplt.plot(x, y)\nplt.title(\"A basic plot using pyplot\")\nplt.xlabel('Time [s]')\nplt.ylabel('Voltage [mV]')\nplt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ".. admonition:: References\n\n The use of the following functions, methods, classes and modules is shown\n in this example:\n\n - `matplotlib.pyplot.plot`\n - `matplotlib.pyplot.title`\n - `matplotlib.pyplot.ylabel`\n - `matplotlib.pyplot.ylabel`\n - `matplotlib.pyplot.show`\n\n" ] } ], "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.12.15" } }, "nbformat": 4, "nbformat_minor": 0 }