{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Bezier curve\n\nThis example showcases the `~.patches.PathPatch` object to create a Bezier\npolycurve path patch.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n\nimport matplotlib.patches as mpatches\nimport matplotlib.path as mpath\n\nPath = mpath.Path\n\nfig, ax = plt.subplots()\npp1 = mpatches.PathPatch(\n Path([(0, 0), (1, 0), (1, 1), (0, 0)],\n [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]),\n fc=\"none\", transform=ax.transData)\n\nax.add_patch(pp1)\nax.plot([0.75], [0.25], \"ro\")\nax.set_title('The red point should be on the path')\n\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.path`\n - `matplotlib.path.Path`\n - `matplotlib.patches`\n - `matplotlib.patches.PathPatch`\n - `matplotlib.axes.Axes.add_patch`\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.13.2" } }, "nbformat": 4, "nbformat_minor": 0 }