{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial A10" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__1__ Take the point `p(3, 4)`, and plot it as a circle (marker `\"o\"`). Make the edges of the marker show in black. Set the displayed data area (($x_\\mathrm{min}$, $x_\\mathrm{max}$), ($y_\\mathrm{min}$, $y_\\mathrm{max}$)) to `((2, 5), (2, 5))`. Give the plot a title and name the *x*- and *y*-axis. Show only the *x*- and *y*-coordinates of the point in the *x*- and *y*-ticks. Add a data grid (`plt.grid`) to the plot." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__2__ Take the below sequence of *x*- and *y*-data points and plot them as dots. Make the connection between the points a dashed gray line. Add axis-labels and a legend describing what can be seen.\n", "```python\n", "x = [x/10 for x in range(-20, 20)]\n", "y = [\n", " 0.13533528323661, 0.149568619222635, 0.165298888221586, 0.182683524052734, 0.201896517994655,\n", " 0.223130160148429, 0.24659696394160, 0.27253179303401, 0.301194211912202, 0.332871083698079,\n", " 0.367879441171442, 0.40656965974059, 0.449328964117221, 0.49658530379140, 0.54881163609402,\n", " 0.60653065971263, 0.67032004603563, 0.74081822068171, 0.81873075307798, 0.90483741803595,\n", " 1.0, 1.10517091807564, 1.22140275816016, 1.34985880757600, 1.49182469764127, 1.64872127070012,\n", " 1.82211880039050, 2.01375270747047, 2.2255409284924, 2.459603111156, 2.7182818284590,\n", " 3.00416602394643, 3.32011692273654, 3.66929666761924, 4.05519996684467, 4.48168907033806,\n", " 4.9530324243951, 5.47394739172, 6.04964746441294, 6.68589444227926\n", "]\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__Advanced 1__ Continue to work on the plot of __2__: Try to use the Figure/Axes instances directly instead of the pyplot\n", "convenience functions. Plot the cumulative sum of the data points as diamonds (marker `\"D\"`) of a different color and make the connection between them a dashed gray line as well. Use the function `ax.axhline` to draw a solid black line at $y = 40$. Use the function `ax.annotate` to point with an arrow to the first data point in the cumulative sum with $y > 40$." ] } ], "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.6.10" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }