{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Polar axis\n\nDemo of a line plot on a polar axis.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\nimport matplotlib.pyplot as plt\n\n\nr = np.arange(0, 2, 0.01)\ntheta = 2 * np.pi * r\n\nplt.figure()\nax = plt.subplot(111, projection=\"polar\")\nax.plot(theta, r)\nax.set_rmax(2)\nax.set_rticks([0.5, 1, 1.5, 2]) # less radial ticks\nax.set_rlabel_position(-22.5) # get radial labels away from plotted line\nax.grid(True)\n\nax.set_title(\"A line plot on a polar axis\", va=\"bottom\")\nplt.show()" ] } ], "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.8.10" } }, "nbformat": 4, "nbformat_minor": 0 }